mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-7998: test_escalations_instances.py - Correcting code related to detach volume
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
parent
c2c7ee25ed
commit
1f7699f458
@ -2850,17 +2850,33 @@ class TestInstances(cloudstackTestCase):
|
||||
len(list_volumes_page1),
|
||||
"VM's volume count is not matching in page 1"
|
||||
)
|
||||
# stopping VM before detaching volumes
|
||||
vm_created.stop(self.userapiclient)
|
||||
|
||||
# Detaching root volume is allowed on XenServer only
|
||||
if self.hypervisor.lower() == 'xenserver':
|
||||
# Detaching all the volumes attached from VM
|
||||
for i in range(0, len(list_volumes_page1)):
|
||||
vm_created.detach_volume(
|
||||
self.userapiclient,
|
||||
list_volumes_page1[i]
|
||||
)
|
||||
list_data_disks = Volume.list(
|
||||
self.userapiclient,
|
||||
listall=self.services["listall"],
|
||||
virtualmachineid=vm_created.id,
|
||||
page=1,
|
||||
pagesize=self.services["pagesize"],
|
||||
type="DATADISK"
|
||||
)
|
||||
|
||||
for volume in list_data_disks:
|
||||
vm_created.detach_volume(self.userapiclient, volume)
|
||||
|
||||
volumes = Volume.list(
|
||||
self.userapiclient,
|
||||
listall=self.services["listall"],
|
||||
virtualmachineid=vm_created.id,
|
||||
page=1,
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
len(volumes),
|
||||
len(list_volumes_page1) - len(list_data_disks),
|
||||
"The volumes number should match with (volumes initially\
|
||||
present minus volumes detached")
|
||||
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "basic"], required_hardware="true")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user