Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7F3B010956 for ; Tue, 23 Dec 2014 09:22:53 +0000 (UTC) Received: (qmail 84733 invoked by uid 500); 23 Dec 2014 09:22:53 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 84697 invoked by uid 500); 23 Dec 2014 09:22:53 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 84684 invoked by uid 99); 23 Dec 2014 09:22:53 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Dec 2014 09:22:53 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id F2FA2A34BA3; Tue, 23 Dec 2014 09:22:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: talluri@apache.org To: commits@cloudstack.apache.org Date: Tue, 23 Dec 2014 09:22:52 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: updated refs/heads/master to fc2c1a0 Repository: cloudstack Updated Branches: refs/heads/master cb211f18d -> fc2c1a09a CLOUDSTACK-8098: Fixed VM snapshot issue in smoke/test_vm_snapshots.py Signed-off-by: SrikanteswaraRao Talluri Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fc2c1a09 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fc2c1a09 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fc2c1a09 Branch: refs/heads/master Commit: fc2c1a09a7064aa9121ead7c9f88fb268698c22e Parents: 0d75682 Author: Gaurav Aradhye Authored: Fri Dec 19 17:38:06 2014 +0530 Committer: SrikanteswaraRao Talluri Committed: Tue Dec 23 14:46:10 2014 +0530 ---------------------------------------------------------------------- test/integration/smoke/test_vm_snapshots.py | 100 ++++++++++++----------- 1 file changed, 51 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fc2c1a09/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 131da99..94c0f33 100644 --- a/test/integration/smoke/test_vm_snapshots.py +++ b/test/integration/smoke/test_vm_snapshots.py @@ -19,7 +19,6 @@ from marvin.codes import FAILED, KVM from nose.plugins.attrib import attr from marvin.cloudstackTestCase import cloudstackTestCase, unittest -from marvin.cloudstackAPI import startVirtualMachine from marvin.lib.utils import random_gen, cleanup_resources from marvin.lib.base import (Account, ServiceOffering, @@ -27,10 +26,10 @@ from marvin.lib.base import (Account, VmSnapshot) from marvin.lib.common import (get_zone, get_domain, - get_template, - list_virtual_machines) + get_template) import time + class TestVmSnapshot(cloudstackTestCase): @classmethod @@ -39,7 +38,8 @@ class TestVmSnapshot(cloudstackTestCase): hypervisor = testClient.getHypervisorInfo() if hypervisor.lower() in (KVM.lower(), "hyperv", "lxc"): - raise unittest.SkipTest("VM snapshot feature is not supported on KVM, Hyper-V or LXC") + raise unittest.SkipTest( + "VM snapshot feature is not supported on KVM, Hyper-V or LXC") cls.apiclient = testClient.getApiClient() cls.services = testClient.getParsedTestDataConfig() @@ -48,12 +48,13 @@ class TestVmSnapshot(cloudstackTestCase): cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests()) template = get_template( - cls.apiclient, - cls.zone.id, - cls.services["ostype"] - ) + cls.apiclient, + cls.zone.id, + cls.services["ostype"] + ) if template == FAILED: - assert False, "get_template() failed to return template with description %s" % cls.services["ostype"] + assert False, "get_template() failed to return template\ + with description %s" % cls.services["ostype"] cls.services["domainid"] = cls.domain.id cls.services["server"]["zoneid"] = cls.zone.id @@ -62,31 +63,31 @@ class TestVmSnapshot(cloudstackTestCase): # Create VMs, NAT Rules etc cls.account = Account.create( - cls.apiclient, - cls.services["account"], - domainid=cls.domain.id - ) + cls.apiclient, + cls.services["account"], + domainid=cls.domain.id + ) cls.service_offering = ServiceOffering.create( - cls.apiclient, - cls.services["service_offerings"] - ) + cls.apiclient, + cls.services["service_offerings"] + ) cls.virtual_machine = VirtualMachine.create( - cls.apiclient, - cls.services["server"], - templateid=template.id, - accountid=cls.account.name, - domainid=cls.account.domainid, - serviceofferingid=cls.service_offering.id, - mode=cls.zone.networktype - ) + cls.apiclient, + cls.services["server"], + templateid=template.id, + accountid=cls.account.name, + domainid=cls.account.domainid, + serviceofferingid=cls.service_offering.id, + mode=cls.zone.networktype + ) cls.random_data_0 = random_gen(size=100) cls.test_dir = "/tmp" cls.random_data = "random.data" cls._cleanup = [ - cls.service_offering, - cls.account, - ] + cls.service_offering, + cls.account, + ] return @classmethod @@ -122,9 +123,10 @@ class TestVmSnapshot(cloudstackTestCase): ssh_client = self.virtual_machine.get_ssh_client() cmds = [ - "echo %s > %s/%s" % (self.random_data_0, self.test_dir, self.random_data), - "cat %s/%s" % (self.test_dir, self.random_data) - ] + "echo %s > %s/%s" % + (self.random_data_0, self.test_dir, self.random_data), + "cat %s/%s" % + (self.test_dir, self.random_data)] for c in cmds: self.debug(c) @@ -183,7 +185,10 @@ class TestVmSnapshot(cloudstackTestCase): time.sleep(self.services["sleep"]) - list_snapshot_response = VmSnapshot.list(self.apiclient, vmid=self.virtual_machine.id, listall=True) + list_snapshot_response = VmSnapshot.list( + self.apiclient, + vmid=self.virtual_machine.id, + listall=True) self.assertEqual( isinstance(list_snapshot_response, list), @@ -202,24 +207,13 @@ class TestVmSnapshot(cloudstackTestCase): "Check the snapshot of vm is ready!" ) - VmSnapshot.revertToSnapshot(self.apiclient, list_snapshot_response[0].id) + self.virtual_machine.stop(self.apiclient) - list_vm_response = list_virtual_machines( + VmSnapshot.revertToSnapshot( self.apiclient, - id=self.virtual_machine.id - ) + list_snapshot_response[0].id) - self.assertEqual( - list_vm_response[0].state, - "Stopped", - "Check the state of vm is Stopped!" - ) - - cmd = startVirtualMachine.startVirtualMachineCmd() - cmd.id = list_vm_response[0].id - self.apiclient.startVirtualMachine(cmd) - - time.sleep(self.services["sleep"]) + self.virtual_machine.start(self.apiclient) try: ssh_client = self.virtual_machine.get_ssh_client(reconnect=True) @@ -248,7 +242,10 @@ class TestVmSnapshot(cloudstackTestCase): """Test to delete vm snapshots """ - list_snapshot_response = VmSnapshot.list(self.apiclient, vmid=self.virtual_machine.id, listall=True) + list_snapshot_response = VmSnapshot.list( + self.apiclient, + vmid=self.virtual_machine.id, + listall=True) self.assertEqual( isinstance(list_snapshot_response, list), @@ -260,11 +257,16 @@ class TestVmSnapshot(cloudstackTestCase): None, "Check if snapshot exists in ListSnapshot" ) - VmSnapshot.deleteVMSnapshot(self.apiclient, list_snapshot_response[0].id) + VmSnapshot.deleteVMSnapshot( + self.apiclient, + list_snapshot_response[0].id) time.sleep(self.services["sleep"] * 3) - list_snapshot_response = VmSnapshot.list(self.apiclient, vmid=self.virtual_machine.id, listall=True) + list_snapshot_response = VmSnapshot.list( + self.apiclient, + vmid=self.virtual_machine.id, + listall=True) self.assertEqual( list_snapshot_response,