Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 37 additions & 30 deletions test/integration/testpaths/testpath_snapshot_hadrning.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ def test_01_snapshot_hardning_kvm(self):
in progress attach the volume to A VM verify that volume
gets attached successfully also check integrity of snapshot
"""
if self.hypervisor == "xenserver":
self.skipTest("Skip test for XenServer")
if self.hypervisor.lower() != "kvm":
self.skipTest("Skip test for Hypervisor other than KVM")

# Step 1

Expand Down Expand Up @@ -1384,6 +1384,11 @@ def setUpClass(cls):

cls._cleanup = []

configs = Configurations.list(
cls.apiclient,
name="snapshot.delta.max")
cls.delta_max = configs[0].value

clusterid_tag_mapping = {}
cwps_no = 0

Expand Down Expand Up @@ -1474,6 +1479,12 @@ def setUpClass(cls):

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
cls.disk_offering_cluster1 = DiskOffering.create(
cls.apiclient,
Expand Down Expand Up @@ -1575,6 +1586,13 @@ def CreateSnapshot(self, root_volume, is_recurring):
self.exceptionList.append(e)
return

def CreateDeltaSnapshot(self, volume):
for i in range(int(self.delta_max)):
Snapshot.create(
self.apiclient,
volume.id)
return

def GetUpdatedRootVolume(self):
"""
Return Updated Root Volume.
Expand Down Expand Up @@ -1682,7 +1700,7 @@ def test_06_hardening(self):
"""

# Get ROOT Volume
root_volume = self.GetUpdatedRootVolume(self)
root_volume = self.GetUpdatedRootVolume()

checksum_root = createChecksum(
service=self.testdata,
Expand All @@ -1699,8 +1717,6 @@ def test_06_hardening(self):
diskofferingid=self.disk_offering_cluster1.id
)

self.cleanup.append(data_volume_created)

self.vm.attach_volume(
self.apiclient,
data_volume_created
Expand Down Expand Up @@ -1729,7 +1745,7 @@ def test_06_hardening(self):

self.vm.reboot(self.apiclient)

current_storagepool_tag = self.GetStoragePoolTag(self, root_volume)
current_storagepool_tag = self.GetStoragePoolTag(root_volume)

# Create VM on CWPS
vm_in_cluster2 = VirtualMachine.create(
Expand All @@ -1745,28 +1761,9 @@ def test_06_hardening(self):

# Step 1

try:
create_snapshot_thread = Thread(
target=self.CreateSnapshot,
args=(
data_volume,
False))
self.CreateSnapshot(data_volume, False)

attach_volume_thread = Thread(
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.attach_volume(self.apiclient, data_volume)

vm_in_cluster2.reboot(self.apiclient)

Expand All @@ -1788,13 +1785,14 @@ def test_06_hardening(self):
"check if volume is detached"
)

self.CreateSnapshot(self,
data_volume,
self.CreateDeltaSnapshot(data_volume)

self.CreateSnapshot(data_volume,
False)

snapshots_list = list_snapshots(
self.apiclient,
volumeid=data_volume.id,
volumeid=data_volume_list[0].id,
listall=True)

status = validateList(snapshots_list)
Expand All @@ -1816,6 +1814,14 @@ def test_06_hardening(self):
checksum_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
self.CreateSnapshot(self,
root_volume,
Expand Down Expand Up @@ -2097,4 +2103,5 @@ def test_06_hardening(self):
checksum_root,
disk_type="root")

data_volume_created.delete(self.apiclient)
return