@@ -56,195 +56,195 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
5656
5757 @classmethod
5858 def setUpClass (cls ):
59- cls .apiclient = super (TestDeployVmWithVariedPlanners , cls ).getClsTestClient ().getApiClient ()
60- cls .services = Services ().services
61- # Get Zone, Domain and templates
62- cls .domain = get_domain (cls .apiclient , cls .services )
63- cls .zone = get_zone (cls .apiclient , cls .services )
64- cls .template = get_template (
65- cls .apiclient ,
66- cls .zone .id ,
67- cls .services ["ostype" ]
68- )
69- cls .services ["virtual_machine" ]["zoneid" ] = cls .zone .id
70- cls .services ["template" ] = cls .template .id
71- cls .services ["zoneid" ] = cls .zone .id
72-
73- cls .account = Account .create (
74- cls .apiclient ,
75- cls .services ["account" ],
76- domainid = cls .domain .id
77- )
78- cls .services ["account" ] = cls .account .name
79- cls .cleanup = [
80- cls .account
81- ]
59+ cls .apiclient = super (TestDeployVmWithVariedPlanners , cls ).getClsTestClient ().getApiClient ()
60+ cls .services = Services ().services
61+ # Get Zone, Domain and templates
62+ cls .domain = get_domain (cls .apiclient , cls .services )
63+ cls .zone = get_zone (cls .apiclient , cls .services )
64+ cls .template = get_template (
65+ cls .apiclient ,
66+ cls .zone .id ,
67+ cls .services ["ostype" ]
68+ )
69+ cls .services ["virtual_machine" ]["zoneid" ] = cls .zone .id
70+ cls .services ["template" ] = cls .template .id
71+ cls .services ["zoneid" ] = cls .zone .id
72+
73+ cls .account = Account .create (
74+ cls .apiclient ,
75+ cls .services ["account" ],
76+ domainid = cls .domain .id
77+ )
78+ cls .services ["account" ] = cls .account .name
79+ cls .cleanup = [
80+ cls .account
81+ ]
8282
8383 @attr (tags = ["simulator" , "advanced" , "basic" , "sg" ])
8484 def test_deployvm_firstfit (self ):
85- """Test to deploy vm with a first fit offering
86- """
87- #FIXME: How do we know that first fit actually happened?
88- self .service_offering_firstfit = ServiceOffering .create (
89- self .apiclient ,
90- self .services ["service_offering" ],
91- deploymentplanner = 'FirstFitPlanner'
92- )
93-
94- self .virtual_machine = VirtualMachine .create (
95- self .apiclient ,
96- self .services ["virtual_machine" ],
97- accountid = self .account .name ,
98- zoneid = self .zone .id ,
99- domainid = self .account .domainid ,
100- serviceofferingid = self .service_offering_firstfit .id ,
101- templateid = self .template .id
102- )
103-
104- list_vms = VirtualMachine .list (self .apiclient , id = self .virtual_machine .id )
105- self .debug (
106- "Verify listVirtualMachines response for virtual machine: %s" \
107- % self .virtual_machine .id
108- )
109- self .assertEqual (
110- isinstance (list_vms , list ),
111- True ,
112- "List VM response was not a valid list"
113- )
114- self .assertNotEqual (
115- len (list_vms ),
116- 0 ,
117- "List VM response was empty"
118- )
119-
120- vm = list_vms [0 ]
121- self .assertEqual (
122- vm .state ,
123- "Running" ,
124- msg = "VM is not in Running state"
125- )
85+ """Test to deploy vm with a first fit offering
86+ """
87+ #FIXME: How do we know that first fit actually happened?
88+ self .service_offering_firstfit = ServiceOffering .create (
89+ self .apiclient ,
90+ self .services ["service_offering" ],
91+ deploymentplanner = 'FirstFitPlanner'
92+ )
93+
94+ self .virtual_machine = VirtualMachine .create (
95+ self .apiclient ,
96+ self .services ["virtual_machine" ],
97+ accountid = self .account .name ,
98+ zoneid = self .zone .id ,
99+ domainid = self .account .domainid ,
100+ serviceofferingid = self .service_offering_firstfit .id ,
101+ templateid = self .template .id
102+ )
103+
104+ list_vms = VirtualMachine .list (self .apiclient , id = self .virtual_machine .id )
105+ self .debug (
106+ "Verify listVirtualMachines response for virtual machine: %s" \
107+ % self .virtual_machine .id
108+ )
109+ self .assertEqual (
110+ isinstance (list_vms , list ),
111+ True ,
112+ "List VM response was not a valid list"
113+ )
114+ self .assertNotEqual (
115+ len (list_vms ),
116+ 0 ,
117+ "List VM response was empty"
118+ )
119+
120+ vm = list_vms [0 ]
121+ self .assertEqual (
122+ vm .state ,
123+ "Running" ,
124+ msg = "VM is not in Running state"
125+ )
126126
127127 @attr (tags = ["simulator" , "advanced" , "basic" , "sg" ])
128128 def test_deployvm_userdispersing (self ):
129- """Test deploy VMs using user dispersion planner
130- """
131- self .service_offering_userdispersing = ServiceOffering .create (
132- self .apiclient ,
133- self .services ["service_offering" ],
134- deploymentplanner = 'UserDispersingPlanner'
135- )
136-
137- self .virtual_machine_1 = VirtualMachine .create (
138- self .apiclient ,
139- self .services ["virtual_machine" ],
140- accountid = self .account .name ,
141- zoneid = self .zone .id ,
142- domainid = self .account .domainid ,
143- serviceofferingid = self .service_offering_userdispersing .id ,
144- templateid = self .template .id
145- )
146- self .virtual_machine_2 = VirtualMachine .create (
147- self .apiclient ,
148- self .services ["virtual_machine" ],
149- accountid = self .account .name ,
150- zoneid = self .zone .id ,
151- domainid = self .account .domainid ,
152- serviceofferingid = self .service_offering_userdispersing .id ,
153- templateid = self .template .id
154- )
155-
156- list_vm_1 = VirtualMachine .list (self .apiclient , id = self .virtual_machine_1 .id )
157- list_vm_2 = VirtualMachine .list (self .apiclient , id = self .virtual_machine_2 .id )
158- self .assertEqual (
159- isinstance (list_vm_1 , list ),
160- True ,
161- "List VM response was not a valid list"
162- )
163- self .assertEqual (
164- isinstance (list_vm_2 , list ),
165- True ,
166- "List VM response was not a valid list"
167- )
168- vm1 = list_vm_1 [0 ]
169- vm2 = list_vm_2 [0 ]
170- self .assertEqual (
171- vm1 .state ,
172- "Running" ,
173- msg = "VM is not in Running state"
174- )
175- self .assertEqual (
176- vm2 .state ,
177- "Running" ,
178- msg = "VM is not in Running state"
179- )
180- self .assertNotEqual (
181- vm1 .hostid ,
182- vm2 .hostid ,
183- msg = "VMs meant to be dispersed are deployed on the same host"
184- )
129+ """Test deploy VMs using user dispersion planner
130+ """
131+ self .service_offering_userdispersing = ServiceOffering .create (
132+ self .apiclient ,
133+ self .services ["service_offering" ],
134+ deploymentplanner = 'UserDispersingPlanner'
135+ )
136+
137+ self .virtual_machine_1 = VirtualMachine .create (
138+ self .apiclient ,
139+ self .services ["virtual_machine" ],
140+ accountid = self .account .name ,
141+ zoneid = self .zone .id ,
142+ domainid = self .account .domainid ,
143+ serviceofferingid = self .service_offering_userdispersing .id ,
144+ templateid = self .template .id
145+ )
146+ self .virtual_machine_2 = VirtualMachine .create (
147+ self .apiclient ,
148+ self .services ["virtual_machine" ],
149+ accountid = self .account .name ,
150+ zoneid = self .zone .id ,
151+ domainid = self .account .domainid ,
152+ serviceofferingid = self .service_offering_userdispersing .id ,
153+ templateid = self .template .id
154+ )
155+
156+ list_vm_1 = VirtualMachine .list (self .apiclient , id = self .virtual_machine_1 .id )
157+ list_vm_2 = VirtualMachine .list (self .apiclient , id = self .virtual_machine_2 .id )
158+ self .assertEqual (
159+ isinstance (list_vm_1 , list ),
160+ True ,
161+ "List VM response was not a valid list"
162+ )
163+ self .assertEqual (
164+ isinstance (list_vm_2 , list ),
165+ True ,
166+ "List VM response was not a valid list"
167+ )
168+ vm1 = list_vm_1 [0 ]
169+ vm2 = list_vm_2 [0 ]
170+ self .assertEqual (
171+ vm1 .state ,
172+ "Running" ,
173+ msg = "VM is not in Running state"
174+ )
175+ self .assertEqual (
176+ vm2 .state ,
177+ "Running" ,
178+ msg = "VM is not in Running state"
179+ )
180+ self .assertNotEqual (
181+ vm1 .hostid ,
182+ vm2 .hostid ,
183+ msg = "VMs meant to be dispersed are deployed on the same host"
184+ )
185185
186186 @attr (tags = ["simulator" , "advanced" , "basic" , "sg" ])
187187 def test_deployvm_userconcentrated (self ):
188- """Test deploy VMs using user concentrated planner
189- """
190- self .service_offering_userconcentrated = ServiceOffering .create (
191- self .apiclient ,
192- self .services ["service_offering" ],
193- deploymentplanner = 'UserConcentratedPodPlanner'
194- )
195-
196- self .virtual_machine_1 = VirtualMachine .create (
197- self .apiclient ,
198- self .services ["virtual_machine" ],
199- accountid = self .account .name ,
200- zoneid = self .zone .id ,
201- domainid = self .account .domainid ,
202- serviceofferingid = self .service_offering_userconcentrated .id ,
203- templateid = self .template .id
204- )
205- self .virtual_machine_2 = VirtualMachine .create (
206- self .apiclient ,
207- self .services ["virtual_machine" ],
208- accountid = self .account .name ,
209- zoneid = self .zone .id ,
210- domainid = self .account .domainid ,
211- serviceofferingid = self .service_offering_userconcentrated .id ,
212- templateid = self .template .id
213- )
214-
215- list_vm_1 = VirtualMachine .list (self .apiclient , id = self .virtual_machine_1 .id )
216- list_vm_2 = VirtualMachine .list (self .apiclient , id = self .virtual_machine_2 .id )
217- self .assertEqual (
218- isinstance (list_vm_1 , list ),
219- True ,
220- "List VM response was not a valid list"
221- )
222- self .assertEqual (
223- isinstance (list_vm_2 , list ),
224- True ,
225- "List VM response was not a valid list"
226- )
227- vm1 = list_vm_1 [0 ]
228- vm2 = list_vm_2 [0 ]
229- self .assertEqual (
230- vm1 .state ,
231- "Running" ,
232- msg = "VM is not in Running state"
233- )
234- self .assertEqual (
235- vm2 .state ,
236- "Running" ,
237- msg = "VM is not in Running state"
238- )
239- self .assertNotEqual (
240- vm1 .hostid ,
241- vm2 .hostid ,
242- msg = "VMs meant to be concentrated are deployed on the different hosts"
243- )
188+ """Test deploy VMs using user concentrated planner
189+ """
190+ self .service_offering_userconcentrated = ServiceOffering .create (
191+ self .apiclient ,
192+ self .services ["service_offering" ],
193+ deploymentplanner = 'UserConcentratedPodPlanner'
194+ )
195+
196+ self .virtual_machine_1 = VirtualMachine .create (
197+ self .apiclient ,
198+ self .services ["virtual_machine" ],
199+ accountid = self .account .name ,
200+ zoneid = self .zone .id ,
201+ domainid = self .account .domainid ,
202+ serviceofferingid = self .service_offering_userconcentrated .id ,
203+ templateid = self .template .id
204+ )
205+ self .virtual_machine_2 = VirtualMachine .create (
206+ self .apiclient ,
207+ self .services ["virtual_machine" ],
208+ accountid = self .account .name ,
209+ zoneid = self .zone .id ,
210+ domainid = self .account .domainid ,
211+ serviceofferingid = self .service_offering_userconcentrated .id ,
212+ templateid = self .template .id
213+ )
214+
215+ list_vm_1 = VirtualMachine .list (self .apiclient , id = self .virtual_machine_1 .id )
216+ list_vm_2 = VirtualMachine .list (self .apiclient , id = self .virtual_machine_2 .id )
217+ self .assertEqual (
218+ isinstance (list_vm_1 , list ),
219+ True ,
220+ "List VM response was not a valid list"
221+ )
222+ self .assertEqual (
223+ isinstance (list_vm_2 , list ),
224+ True ,
225+ "List VM response was not a valid list"
226+ )
227+ vm1 = list_vm_1 [0 ]
228+ vm2 = list_vm_2 [0 ]
229+ self .assertEqual (
230+ vm1 .state ,
231+ "Running" ,
232+ msg = "VM is not in Running state"
233+ )
234+ self .assertEqual (
235+ vm2 .state ,
236+ "Running" ,
237+ msg = "VM is not in Running state"
238+ )
239+ self .assertNotEqual (
240+ vm1 .hostid ,
241+ vm2 .hostid ,
242+ msg = "VMs meant to be concentrated are deployed on the different hosts"
243+ )
244244
245245 @classmethod
246246 def tearDownClass (cls ):
247- try :
248- cleanup_resources (cls .apiclient , cls .cleanup )
249- except Exception as e :
250- raise Exception ("Warning: Exception during cleanup : %s" % e )
247+ try :
248+ cleanup_resources (cls .apiclient , cls .cleanup )
249+ except Exception as e :
250+ raise Exception ("Warning: Exception during cleanup : %s" % e )
0 commit comments