mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
CLOUDSTACK-8547: Modify hypervisor check in testpath_snapshot_hardning.py
Signed-off-by: Gaurav Aradhye <gaurav.aradhye@clogeny.com> This closes #378
This commit is contained in:
parent
7ba2f2274a
commit
f61723dcfb
@ -476,8 +476,8 @@ class TestSnapshotsHardning(cloudstackTestCase):
|
|||||||
in progress attach the volume to A VM verify that volume
|
in progress attach the volume to A VM verify that volume
|
||||||
gets attached successfully also check integrity of snapshot
|
gets attached successfully also check integrity of snapshot
|
||||||
"""
|
"""
|
||||||
if self.hypervisor == "xenserver":
|
if self.hypervisor.lower() != "kvm":
|
||||||
self.skipTest("Skip test for XenServer")
|
self.skipTest("Skip test for Hypervisor other than KVM")
|
||||||
|
|
||||||
# Step 1
|
# Step 1
|
||||||
|
|
||||||
@ -1384,6 +1384,11 @@ class TestHardening(cloudstackTestCase):
|
|||||||
|
|
||||||
cls._cleanup = []
|
cls._cleanup = []
|
||||||
|
|
||||||
|
configs = Configurations.list(
|
||||||
|
cls.apiclient,
|
||||||
|
name="snapshot.delta.max")
|
||||||
|
cls.delta_max = configs[0].value
|
||||||
|
|
||||||
clusterid_tag_mapping = {}
|
clusterid_tag_mapping = {}
|
||||||
cwps_no = 0
|
cwps_no = 0
|
||||||
cls.unsupportedHypervisor = False
|
cls.unsupportedHypervisor = False
|
||||||
@ -1473,6 +1478,12 @@ class TestHardening(cloudstackTestCase):
|
|||||||
|
|
||||||
cls._cleanup.append(cls.service_offering_cluster1)
|
cls._cleanup.append(cls.service_offering_cluster1)
|
||||||
|
|
||||||
|
cls.service_offering = ServiceOffering.create(
|
||||||
|
cls.apiclient,
|
||||||
|
cls.testdata["service_offering"]
|
||||||
|
)
|
||||||
|
cls._cleanup.append(cls.service_offering)
|
||||||
|
|
||||||
# Create Disk offering
|
# Create Disk offering
|
||||||
cls.disk_offering_cluster1 = DiskOffering.create(
|
cls.disk_offering_cluster1 = DiskOffering.create(
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
@ -1576,6 +1587,13 @@ class TestHardening(cloudstackTestCase):
|
|||||||
self.exceptionList.append(e)
|
self.exceptionList.append(e)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def CreateDeltaSnapshot(self, volume):
|
||||||
|
for i in range(int(self.delta_max)):
|
||||||
|
Snapshot.create(
|
||||||
|
self.apiclient,
|
||||||
|
volume.id)
|
||||||
|
return
|
||||||
|
|
||||||
def GetUpdatedRootVolume(self):
|
def GetUpdatedRootVolume(self):
|
||||||
"""
|
"""
|
||||||
Return Updated Root Volume.
|
Return Updated Root Volume.
|
||||||
@ -1683,7 +1701,7 @@ class TestHardening(cloudstackTestCase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Get ROOT Volume
|
# Get ROOT Volume
|
||||||
root_volume = self.GetUpdatedRootVolume(self)
|
root_volume = self.GetUpdatedRootVolume()
|
||||||
|
|
||||||
checksum_root = createChecksum(
|
checksum_root = createChecksum(
|
||||||
service=self.testdata,
|
service=self.testdata,
|
||||||
@ -1700,8 +1718,6 @@ class TestHardening(cloudstackTestCase):
|
|||||||
diskofferingid=self.disk_offering_cluster1.id
|
diskofferingid=self.disk_offering_cluster1.id
|
||||||
)
|
)
|
||||||
|
|
||||||
self.cleanup.append(data_volume_created)
|
|
||||||
|
|
||||||
self.vm.attach_volume(
|
self.vm.attach_volume(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
data_volume_created
|
data_volume_created
|
||||||
@ -1730,7 +1746,7 @@ class TestHardening(cloudstackTestCase):
|
|||||||
|
|
||||||
self.vm.reboot(self.apiclient)
|
self.vm.reboot(self.apiclient)
|
||||||
|
|
||||||
current_storagepool_tag = self.GetStoragePoolTag(self, root_volume)
|
current_storagepool_tag = self.GetStoragePoolTag(root_volume)
|
||||||
|
|
||||||
# Create VM on CWPS
|
# Create VM on CWPS
|
||||||
vm_in_cluster2 = VirtualMachine.create(
|
vm_in_cluster2 = VirtualMachine.create(
|
||||||
@ -1746,28 +1762,9 @@ class TestHardening(cloudstackTestCase):
|
|||||||
|
|
||||||
# Step 1
|
# Step 1
|
||||||
|
|
||||||
try:
|
self.CreateSnapshot(data_volume, False)
|
||||||
create_snapshot_thread = Thread(
|
|
||||||
target=self.CreateSnapshot,
|
|
||||||
args=(
|
|
||||||
data_volume,
|
|
||||||
False))
|
|
||||||
|
|
||||||
attach_volume_thread = Thread(
|
vm_in_cluster2.attach_volume(self.apiclient, data_volume)
|
||||||
target=vm_in_cluster2.attach_volume,
|
|
||||||
args=(
|
|
||||||
self.apiclient,
|
|
||||||
data_volume))
|
|
||||||
|
|
||||||
create_snapshot_thread.start()
|
|
||||||
attach_volume_thread.start()
|
|
||||||
create_snapshot_thread.join()
|
|
||||||
attach_volume_thread.join()
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
raise Exception(
|
|
||||||
"Warning: Exception unable to start thread : %s" %
|
|
||||||
e)
|
|
||||||
|
|
||||||
vm_in_cluster2.reboot(self.apiclient)
|
vm_in_cluster2.reboot(self.apiclient)
|
||||||
|
|
||||||
@ -1789,13 +1786,14 @@ class TestHardening(cloudstackTestCase):
|
|||||||
"check if volume is detached"
|
"check if volume is detached"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.CreateSnapshot(self,
|
self.CreateDeltaSnapshot(data_volume)
|
||||||
data_volume,
|
|
||||||
|
self.CreateSnapshot(data_volume,
|
||||||
False)
|
False)
|
||||||
|
|
||||||
snapshots_list = list_snapshots(
|
snapshots_list = list_snapshots(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
volumeid=data_volume.id,
|
volumeid=data_volume_list[0].id,
|
||||||
listall=True)
|
listall=True)
|
||||||
|
|
||||||
status = validateList(snapshots_list)
|
status = validateList(snapshots_list)
|
||||||
@ -1817,6 +1815,14 @@ class TestHardening(cloudstackTestCase):
|
|||||||
checksum_data,
|
checksum_data,
|
||||||
disk_type="data")
|
disk_type="data")
|
||||||
|
|
||||||
|
# Detach DATA Volume
|
||||||
|
vm_in_cluster2.detach_volume(
|
||||||
|
self.apiclient,
|
||||||
|
data_volume_list[0]
|
||||||
|
)
|
||||||
|
|
||||||
|
vm_in_cluster2.reboot(self.apiclient)
|
||||||
|
|
||||||
# Step 2
|
# Step 2
|
||||||
self.CreateSnapshot(self,
|
self.CreateSnapshot(self,
|
||||||
root_volume,
|
root_volume,
|
||||||
@ -2098,4 +2104,5 @@ class TestHardening(cloudstackTestCase):
|
|||||||
checksum_root,
|
checksum_root,
|
||||||
disk_type="root")
|
disk_type="root")
|
||||||
|
|
||||||
|
data_volume_created.delete(self.apiclient)
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user