mirror of https://github.com/apache/cloudstack.git
Correct the resize volume tests
Resize would fail on XenServer if the VM isn't stopped before resizing. Ensuring VM stop based on the hypervisor host detected that the VM is resident on. Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
parent
a6d13cb799
commit
09c6030ae9
|
|
@ -536,7 +536,7 @@ class TestVolumes(cloudstackTestCase):
|
|||
|
||||
@attr(tags = ["advanced", "advancedns", "smoke", "basic"])
|
||||
def test_07_resize_fail(self):
|
||||
"""Verify invalid options fail to Resize a volume"""
|
||||
"""Test resize (negative) non-existent volume"""
|
||||
# Verify the size is the new size is what we wanted it to be.
|
||||
self.debug("Fail Resize Volume ID: %s" % self.volume.id)
|
||||
|
||||
|
|
@ -584,7 +584,12 @@ class TestVolumes(cloudstackTestCase):
|
|||
self.virtual_machine.attach_volume(self.apiClient, self.volume)
|
||||
self.attached = True
|
||||
#stop the vm if it is on xenserver
|
||||
if self.services['hypervisor'].lower() == "xenserver":
|
||||
hosts = Host.list(self.apiClient, id=self.virtual_machine.hostid)
|
||||
self.assertTrue(isinstance(hosts, list))
|
||||
self.assertTrue(len(hosts) > 0)
|
||||
self.debug("Found %s host" % hosts[0].hypervisor)
|
||||
|
||||
if hosts[0].hypervisor == "XenServer":
|
||||
self.virtual_machine.stop(self.apiClient)
|
||||
|
||||
self.apiClient.resizeVolume(cmd)
|
||||
|
|
@ -610,23 +615,28 @@ class TestVolumes(cloudstackTestCase):
|
|||
True,
|
||||
"Verify the volume did not resize"
|
||||
)
|
||||
if self.services['hypervisor'].lower() == "xenserver":
|
||||
if hosts[0].hypervisor == "XenServer":
|
||||
self.virtual_machine.start(self.apiClient)
|
||||
|
||||
|
||||
@attr(tags = ["advanced", "advancedns", "smoke", "basic"])
|
||||
def test_08_resize_volume(self):
|
||||
"""Resize a volume"""
|
||||
"""Test resize a volume"""
|
||||
# Verify the size is the new size is what we wanted it to be.
|
||||
self.debug(
|
||||
"Attaching volume (ID: %s) to VM (ID: %s)" % (
|
||||
self.volume.id,
|
||||
self.virtual_machine.id
|
||||
))
|
||||
|
||||
self.virtual_machine.attach_volume(self.apiClient, self.volume)
|
||||
self.attached = True
|
||||
hosts = Host.list(self.apiClient, id=self.virtual_machine.hostid)
|
||||
self.assertTrue(isinstance(hosts, list))
|
||||
self.assertTrue(len(hosts) > 0)
|
||||
self.debug("Found %s host" % hosts[0].hypervisor)
|
||||
|
||||
if self.services['hypervisor'].lower() == "xenserver":
|
||||
if hosts[0].hypervisor == "XenServer":
|
||||
self.virtual_machine.stop(self.apiClient)
|
||||
self.debug("Resize Volume ID: %s" % self.volume.id)
|
||||
|
||||
|
|
@ -659,7 +669,9 @@ class TestVolumes(cloudstackTestCase):
|
|||
"Check if the volume resized appropriately"
|
||||
)
|
||||
|
||||
if self.services['hypervisor'].lower() == "xenserver":
|
||||
#start the vm if it is on xenserver
|
||||
|
||||
if hosts[0].hypervisor == "XenServer":
|
||||
self.virtual_machine.start(self.apiClient)
|
||||
|
||||
@attr(tags = ["advanced", "advancedns", "smoke","basic"])
|
||||
|
|
|
|||
Loading…
Reference in New Issue