mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
marvin: fix test failures when changing service offering of a VM (#4651)
Co-authored-by: Pearl Dsilva <pearl.dsilva@shapeblue.com>
This commit is contained in:
parent
d62d5c6cd2
commit
c9c1d4a6e5
@ -502,6 +502,23 @@ class TestServiceOfferings(cloudstackTestCase):
|
|||||||
self.skipTest("Skipping this test for {} due to bug CS-38153".format(self.hypervisor))
|
self.skipTest("Skipping this test for {} due to bug CS-38153".format(self.hypervisor))
|
||||||
try:
|
try:
|
||||||
self.medium_virtual_machine.stop(self.apiclient)
|
self.medium_virtual_machine.stop(self.apiclient)
|
||||||
|
timeout = self.services["timeout"]
|
||||||
|
while True:
|
||||||
|
time.sleep(self.services["sleep"])
|
||||||
|
# Ensure that VM is in stopped state
|
||||||
|
list_vm_response = list_virtual_machines(
|
||||||
|
self.apiclient,
|
||||||
|
id=self.medium_virtual_machine.id
|
||||||
|
)
|
||||||
|
if isinstance(list_vm_response, list):
|
||||||
|
vm = list_vm_response[0]
|
||||||
|
if vm.state == 'Stopped':
|
||||||
|
self.debug("VM state: %s" % vm.state)
|
||||||
|
break
|
||||||
|
if timeout == 0:
|
||||||
|
raise Exception(
|
||||||
|
"Failed to stop VM (ID: %s) in change service offering" % vm.id)
|
||||||
|
timeout = timeout - 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Failed to stop VM: %s" % e)
|
self.fail("Failed to stop VM: %s" % e)
|
||||||
|
|
||||||
|
|||||||
@ -454,6 +454,30 @@ class TestChangeServiceOfferingForVmWithSnapshots(cloudstackTestCase):
|
|||||||
self.debug("Stopping VM - ID: %s" % virtual_machine.id)
|
self.debug("Stopping VM - ID: %s" % virtual_machine.id)
|
||||||
try:
|
try:
|
||||||
virtual_machine.stop(self.apiclient)
|
virtual_machine.stop(self.apiclient)
|
||||||
|
timeout = self.services["timeout"]
|
||||||
|
|
||||||
|
while True:
|
||||||
|
time.sleep(self.services["sleep"])
|
||||||
|
|
||||||
|
# Ensure that VM is in stopped state
|
||||||
|
list_vm_response = list_virtual_machines(
|
||||||
|
self.apiclient,
|
||||||
|
id=virtual_machine.id
|
||||||
|
)
|
||||||
|
|
||||||
|
if isinstance(list_vm_response, list):
|
||||||
|
|
||||||
|
vm = list_vm_response[0]
|
||||||
|
if vm.state == 'Stopped':
|
||||||
|
self.debug("VM state: %s" % vm.state)
|
||||||
|
break
|
||||||
|
|
||||||
|
if timeout == 0:
|
||||||
|
raise Exception(
|
||||||
|
"Failed to stop VM (ID: %s) in change service offering" % vm.id)
|
||||||
|
|
||||||
|
timeout = timeout - 1
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Failed to stop VM: %s" % e)
|
self.fail("Failed to stop VM: %s" % e)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user