You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2017/01/31 00:31:18 UTC

[3/4] git commit: updated refs/heads/master to 7233ac3

Fixes for testing VM Snapshots on KVM. Related to PR 977


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

Branch: refs/heads/master
Commit: 6f2a5cf04e871cc108795300c7c4d2e7448f8b1d
Parents: a242850
Author: Simon Weller <sw...@ena.com>
Authored: Mon Jan 16 15:47:29 2017 -0600
Committer: Wei Zhou <w....@tech.leaseweb.com>
Committed: Tue Jan 24 21:48:09 2017 +0100

----------------------------------------------------------------------
 test/integration/smoke/test_vm_snapshots.py | 28 +++++++++++++++---------
 1 file changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f2a5cf0/test/integration/smoke/test_vm_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_snapshots.py b/test/integration/smoke/test_vm_snapshots.py
index 31b6822..f320ea6 100644
--- a/test/integration/smoke/test_vm_snapshots.py
+++ b/test/integration/smoke/test_vm_snapshots.py
@@ -104,7 +104,6 @@ class TestVmSnapshot(cloudstackTestCase):
     def setUp(self):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
-        self.cleanup = []
 
         if self.unsupportedHypervisor:
             self.skipTest("Skipping test because unsupported hypervisor\
@@ -112,11 +111,6 @@ class TestVmSnapshot(cloudstackTestCase):
         return
 
     def tearDown(self):
-        try:
-            # Clean up, terminate the created instance, volumes and snapshots
-            cleanup_resources(self.apiclient, self.cleanup)
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
     @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
@@ -150,18 +144,24 @@ class TestVmSnapshot(cloudstackTestCase):
 
         time.sleep(self.services["sleep"])
 
+        #KVM VM Snapshot needs to set snapshot with memory
+        MemorySnapshot = False
+        if self.hypervisor.lower() in (KVM.lower()):
+           MemorySnapshot = True
+
         vm_snapshot = VmSnapshot.create(
             self.apiclient,
             self.virtual_machine.id,
-            "false",
+            MemorySnapshot,
             "TestSnapshot",
-            "Dsiplay Text"
+            "Display Text"
         )
         self.assertEqual(
             vm_snapshot.state,
             "Ready",
             "Check the snapshot of vm is ready!"
         )
+
         return
 
     @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
@@ -213,13 +213,21 @@ class TestVmSnapshot(cloudstackTestCase):
             "Check the snapshot of vm is ready!"
         )
 
-        self.virtual_machine.stop(self.apiclient)
+        #We don't need to stop the VM when taking a VM Snapshot on KVM
+        if self.hypervisor.lower() in (KVM.lower()):
+           pass
+        else:
+           self.virtual_machine.stop(self.apiclient)
 
         VmSnapshot.revertToSnapshot(
             self.apiclient,
             list_snapshot_response[0].id)
 
-        self.virtual_machine.start(self.apiclient)
+        #We don't need to start the VM when taking a VM Snapshot on KVM
+        if self.hypervisor.lower() in (KVM.lower()):
+           pass
+        else:
+           self.virtual_machine.start(self.apiclient)
 
         try:
             ssh_client = self.virtual_machine.get_ssh_client(reconnect=True)