MCPcopy Create free account
hub / github.com/apache/cloudstack / test_01_scale_vm

Method test_01_scale_vm

test/integration/smoke/test_scale_vm.py:190–324  ·  view source on GitHub ↗

Test scale virtual machine

(self)

Source from the content-addressed store, hash-verified

188 @attr(hypervisor="xenserver")
189 @attr(tags=["advanced", "basic"], required_hardware="false")
190 def test_01_scale_vm(self):
191 """Test scale virtual machine
192 """
193 # Validate the following
194 # Scale up the vm and see if it scales to the new svc offering and is
195 # finally in running state
196
197 # VirtualMachine should be updated to tell cloudstack
198 # it has PV tools
199 # available and successfully scaled. We will only mock
200 # that behaviour
201 # here but it is not expected in production since the VM
202 # scaling is not
203 # guaranteed until tools are installed, vm rebooted
204
205 # create a virtual machine
206 self.virtual_machine = VirtualMachine.create(
207 self.apiclient,
208 self.services["small"],
209 accountid=self.account.name,
210 domainid=self.account.domainid,
211 serviceofferingid=self.small_offering.id,
212 mode=self.services["mode"]
213 )
214 self.cleanup.append(self.virtual_machine)
215
216 # If hypervisor is Vmware, then check if
217 # the vmware tools are installed and the process is running
218 # Vmware tools are necessary for scale VM operation
219 if self.hypervisor.lower() == "vmware":
220 sshClient = self.virtual_machine.get_ssh_client()
221 result = str(
222 sshClient.execute("service vmware-tools status")).lower()
223 self.debug("and result is: %s" % result)
224 if "running" not in result:
225 self.skipTest("Skipping scale VM operation because\
226 VMware tools are not installed on the VM")
227 res = None
228 if self.hypervisor.lower() != 'simulator':
229 hostid = self.virtual_machine.hostid
230 host = Host.list(
231 self.apiclient,
232 zoneid=self.zone.id,
233 hostid=hostid,
234 type='Routing'
235 )[0]
236
237 try:
238 username = self.hostConfig["username"]
239 password = self.hostConfig["password"]
240 ssh_client = self.get_ssh_client(host.ipaddress, username, password)
241 res = ssh_client.execute("hostnamectl | grep 'Operating System' | cut -d':' -f2")
242 except Exception as e:
243 pass
244
245 if 'XenServer' in res[0]:
246 self.skipTest("Skipping test for XenServer as it's License does not allow scaling")
247

Callers

nothing calls this directly

Calls 9

get_ssh_clientMethod · 0.95
is_host_xcpng8Method · 0.95
debugMethod · 0.80
assertEqualMethod · 0.80
createMethod · 0.65
executeMethod · 0.65
listMethod · 0.65
updateMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected