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 234CFF2DD for ; Tue, 16 Apr 2013 18:03:40 +0000 (UTC) Received: (qmail 53712 invoked by uid 500); 16 Apr 2013 18:03:35 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 53578 invoked by uid 500); 16 Apr 2013 18:03:35 -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 53476 invoked by uid 99); 16 Apr 2013 18:03:35 -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, 16 Apr 2013 18:03:35 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id CD38D1F9FB; Tue, 16 Apr 2013 18:03:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bfederle@apache.org To: commits@cloudstack.apache.org Date: Tue, 16 Apr 2013 18:03:51 -0000 Message-Id: <1f3a550d52954884aa7c1876fbcc308c@git.apache.org> In-Reply-To: <509132ed9c8b41949fc3b80bdc05905e@git.apache.org> References: <509132ed9c8b41949fc3b80bdc05905e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [18/50] [abbrv] git commit: updated refs/heads/ui-new-project-switcher to a748988 CLOUDSTACK-1995: Enhance resize volume tests to support xenserver hypervisor and fix few test flow errors Signed-off-by: Prasanna Santhanam Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0abfe240 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0abfe240 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0abfe240 Branch: refs/heads/ui-new-project-switcher Commit: 0abfe240c31e410e286169ac1f75aa564f267280 Parents: 48c1c00 Author: Talluri Authored: Mon Apr 15 16:47:34 2013 +0530 Committer: Prasanna Santhanam Committed: Mon Apr 15 12:00:08 2013 +0530 ---------------------------------------------------------------------- test/integration/smoke/test_volumes.py | 55 ++++++++++++++++++++++----- 1 files changed, 45 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0abfe240/test/integration/smoke/test_volumes.py ---------------------------------------------------------------------- diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py index 36eb5de..7d910d4 100644 --- a/test/integration/smoke/test_volumes.py +++ b/test/integration/smoke/test_volumes.py @@ -78,13 +78,13 @@ class Services: "password": "password", "ssh_port": 22, "diskname": "TestDiskServ", - "hypervisor": 'XenServer', + "hypervisor": 'KVM', "privateport": 22, "publicport": 22, "protocol": 'TCP', "diskdevice": "/dev/xvdb", - "ostype": 'CentOS 5.3 (64-bit)', - "mode": 'basic', + "ostype": 'CentOS 5.5 (64-bit)', + "mode": 'advanced', "sleep": 10, "timeout": 600, } @@ -358,6 +358,12 @@ class TestVolumes(cloudstackTestCase): def setUp(self): self.apiClient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() + self.cleanup = [] + + def tearDown(self): + #Clean up, terminate the created volumes + cleanup_resources(self.apiClient, self.cleanup) + return @attr(tags = ["advanced", "advancedns", "smoke"]) def test_02_attach_volume(self): @@ -535,9 +541,13 @@ class TestVolumes(cloudstackTestCase): try: response = self.apiClient.resizeVolume(cmd) except Exception as ex: - if str(ex) == "HTTP Error 431: 431": + #print str(ex) + if "HTTP Error 431:" in str(ex): success = True - self.assertEqual(success, True, "ResizeVolume - verify invalid id is handled appropriately") + self.assertEqual( + success, + True, + "ResizeVolume - verify invalid id is handled appropriately") # Next, we'll try an invalid disk offering id cmd.id = self.volume.id @@ -546,16 +556,29 @@ class TestVolumes(cloudstackTestCase): try: response = self.apiClient.resizeVolume(cmd) except Exception as ex: - if "need to specify a disk offering" in str(ex): + if "HTTP Error 431:" in str(ex): success = True - self.assertEqual(success, True, "ResizeVolume - verify disk offering is handled appropriately") - + self.assertEqual( + success, + True, + "ResizeVolume - verify disk offering is handled appropriately") # Ok, now let's try and resize a volume that is not custom. cmd.id = self.volume.id cmd.diskofferingid = self.services['diskofferingid'] cmd.size = 4 currentSize = self.volume.size + self.debug( + "Attaching volume (ID: %s) to VM (ID: %s)" % ( + self.volume.id, + self.virtual_machine.id) + ) + #attach the volume + self.virtual_machine.attach_volume(self.apiClient, self.volume) + #stop the vm if it is on xenserver + if self.services['hypervisor'].lower() == "xenserver": + self.virtual_machine.stop(self.apiClient) + self.apiClient.resizeVolume(cmd) count = 0 success = True @@ -566,7 +589,7 @@ class TestVolumes(cloudstackTestCase): type='DATADISK' ) for vol in list_volume_response: - if vol.id == self.volume.id and vol.size != currentSize: + if vol.id == self.volume.id and vol.size != currentSize and vol.state != "Resizing": success = False if success: break @@ -579,12 +602,21 @@ class TestVolumes(cloudstackTestCase): True, "Verify the volume did not resize" ) - + self.virtual_machine.detach_volume(self.apiClient, self.volume) + self.cleanup.append(self.volume) @attr(tags = ["advanced", "advancedns", "smoke"]) def test_08_resize_volume(self): """Resize a volume""" # Verify the size is the new size is what we wanted it to be. + self.debug( + "Attaching volume (ID: %s) to VM (ID: %s)" % ( + self.volume.id, + self.virtual_machine.id + )) + self.virtual_machine.attach_volume(self.apiClient, self.volume) + if self.services['hypervisor'].lower() == "xenserver": + self.virtual_machine.stop(self.apiClient) self.debug("Resize Volume ID: %s" % self.volume.id) cmd = resizeVolume.resizeVolumeCmd() @@ -616,6 +648,9 @@ class TestVolumes(cloudstackTestCase): "Check if the volume resized appropriately" ) + self.virtual_machine.detach_volume(self.apiClient, self.volume) + self.cleanup.append(self.volume) + @attr(tags = ["advanced", "advancedns", "smoke"]) def test_09_delete_detached_volume(self): """Delete a Volume unattached to an VM