def AddCluster(self, cluster_size): #Create clusters with Hypervisor type XEN/KVM/VWare for k, v in self.services["clusters"].items(): v["clustername"] = str(uuid.uuid1()) cluster = Cluster.create( self.apiclient, v, zoneid=self.zone.id, podid=self.pod.id ) self.debug( "Created Cluster for hypervisor type %s & ID: %s" %( v["hypervisor"], cluster.id )) self.assertEqual( cluster.allocationstate, 'Enabled', "Check whether allocation state of cluster is enabled" ) hypervisor_type = str(cluster.hypervisortype.lower()) i = 1 while i < cluster_size: i+=1 host_services = self.services["hosts"][hypervisor_type] host_services["url"] = "http://sim/" + str(uuid.uuid1()) + "/" host = Host.create( self.apiclient, cluster, host_services, zoneid=self.zone.id, podid=self.pod.id ) self.debug( "Created host (ID: %s) in cluster ID %s" %( host.id, cluster.id )) storage_services = { "url": "nfs://nfsstor:/export/home/sandbox/" + str(uuid.uuid1()) + "/", "name": str(uuid.uuid1()) } storage = StoragePool.create(self.apiclient, storage_services, clusterid=cluster.id, zoneid=self.zone.id, podid=self.pod.id ) return