You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ga...@apache.org on 2015/06/12 07:55:40 UTC

git commit: updated refs/heads/master to f61723d

Repository: cloudstack
Updated Branches:
  refs/heads/master 7ba2f2274 -> f61723dcf


CLOUDSTACK-8547: Modify hypervisor check in testpath_snapshot_hardning.py

Signed-off-by: Gaurav Aradhye <ga...@clogeny.com>
This closes #378


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f61723dc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f61723dc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f61723dc

Branch: refs/heads/master
Commit: f61723dcfbe2b20d330c65305c94bb40a447155f
Parents: 7ba2f22
Author: Priti Sarap <pr...@clogeny.com>
Authored: Fri Jun 12 11:12:20 2015 +0530
Committer: Gaurav Aradhye <ga...@clogeny.com>
Committed: Fri Jun 12 11:25:03 2015 +0530

----------------------------------------------------------------------
 .../testpaths/testpath_snapshot_hadrning.py     | 67 +++++++++++---------
 1 file changed, 37 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f61723dc/test/integration/testpaths/testpath_snapshot_hadrning.py
----------------------------------------------------------------------
diff --git a/test/integration/testpaths/testpath_snapshot_hadrning.py b/test/integration/testpaths/testpath_snapshot_hadrning.py
index 8a5a496..c062aef 100755
--- a/test/integration/testpaths/testpath_snapshot_hadrning.py
+++ b/test/integration/testpaths/testpath_snapshot_hadrning.py
@@ -476,8 +476,8 @@ class TestSnapshotsHardning(cloudstackTestCase):
                 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
 
@@ -1384,6 +1384,11 @@ class TestHardening(cloudstackTestCase):
 
         cls._cleanup = []
 
+        configs = Configurations.list(
+            cls.apiclient,
+            name="snapshot.delta.max")
+        cls.delta_max = configs[0].value
+
         clusterid_tag_mapping = {}
         cwps_no = 0
         cls.unsupportedHypervisor = False
@@ -1473,6 +1478,12 @@ class TestHardening(cloudstackTestCase):
 
             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,
@@ -1576,6 +1587,13 @@ class TestHardening(cloudstackTestCase):
             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.
@@ -1683,7 +1701,7 @@ class TestHardening(cloudstackTestCase):
         """
 
         # Get ROOT Volume
-        root_volume = self.GetUpdatedRootVolume(self)
+        root_volume = self.GetUpdatedRootVolume()
 
         checksum_root = createChecksum(
             service=self.testdata,
@@ -1700,8 +1718,6 @@ class TestHardening(cloudstackTestCase):
             diskofferingid=self.disk_offering_cluster1.id
         )
 
-        self.cleanup.append(data_volume_created)
-
         self.vm.attach_volume(
             self.apiclient,
             data_volume_created
@@ -1730,7 +1746,7 @@ class TestHardening(cloudstackTestCase):
 
         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(
@@ -1746,28 +1762,9 @@ class TestHardening(cloudstackTestCase):
 
         # 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)
 
@@ -1789,13 +1786,14 @@ class TestHardening(cloudstackTestCase):
             "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)
@@ -1817,6 +1815,14 @@ class TestHardening(cloudstackTestCase):
             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,
@@ -2098,4 +2104,5 @@ class TestHardening(cloudstackTestCase):
             checksum_root,
             disk_type="root")
 
+        data_volume_created.delete(self.apiclient)
         return