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 00FE910AB1 for ; Thu, 8 Aug 2013 16:50:28 +0000 (UTC) Received: (qmail 77989 invoked by uid 500); 8 Aug 2013 16:50:27 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 77973 invoked by uid 500); 8 Aug 2013 16:50:27 -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 77966 invoked by uid 99); 8 Aug 2013 16:50:27 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Aug 2013 16:50:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 35AA38BA001; Thu, 8 Aug 2013 16:50:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: commits@cloudstack.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.2 to e8383cc Date: Thu, 8 Aug 2013 16:50:27 +0000 (UTC) Updated Branches: refs/heads/4.2 ea50c6663 -> e8383cce2 include test for volumes created in non-root domains Test verifies that volumes in non-root domains are visible to the user that created them. Signed-off-by: Prasanna Santhanam (cherry picked from commit fb6aa4ebfa2c2ee956e4e8511f6d7eba777d4375) Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e8383cce Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e8383cce Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e8383cce Branch: refs/heads/4.2 Commit: e8383cce2723db880233c80874cd6c6ab23ed8ee Parents: ea50c66 Author: Prasanna Santhanam Authored: Thu Aug 8 22:19:08 2013 +0530 Committer: Prasanna Santhanam Committed: Thu Aug 8 22:19:53 2013 +0530 ---------------------------------------------------------------------- test/integration/component/test_volumes.py | 65 +++++++++++++++++++++---- 1 file changed, 55 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8383cce/test/integration/component/test_volumes.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py index 2c2301a..14109dc 100644 --- a/test/integration/component/test_volumes.py +++ b/test/integration/component/test_volumes.py @@ -17,14 +17,12 @@ """ P1 tests for Volumes """ #Import Local Modules -import marvin from nose.plugins.attrib import attr from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * from marvin.integration.lib.utils import * from marvin.integration.lib.base import * from marvin.integration.lib.common import * -from marvin.remoteSSHClient import remoteSSHClient #Import System modules import time @@ -136,7 +134,6 @@ class TestAttachVolume(cloudstackTestCase): domainid=cls.domain.id ) - cls.services["account"] = cls.account.name cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] @@ -188,7 +185,7 @@ class TestAttachVolume(cloudstackTestCase): # 5. Start The VM. Start VM should be successful # Create 5 volumes and attach to VM - for i in range(self.services["volume"]["max"]): + for i in range(self.services["volume"]["max"] - 1): volume = Volume.create( self.apiclient, self.services["volume"], @@ -428,7 +425,7 @@ class TestAttachDetachVolume(cloudstackTestCase): domainid=cls.domain.id ) - cls.services["account"] = cls.account.name + cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] @@ -480,7 +477,7 @@ class TestAttachDetachVolume(cloudstackTestCase): volumes = [] # Create 5 volumes and attach to VM - for i in range(self.services["volume"]["max"]): + for i in range(self.services["volume"]["max"] - 1): volume = Volume.create( self.apiclient, self.services["volume"], @@ -693,7 +690,7 @@ class TestAttachVolumeISO(cloudstackTestCase): cls.services["account"], domainid=cls.domain.id ) - cls.services["account"] = cls.account.name + cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] @@ -743,7 +740,7 @@ class TestAttachVolumeISO(cloudstackTestCase): # 3. Verify that attach ISO is successful # Create 5 volumes and attach to VM - for i in range(self.services["volume"]["max"]): + for i in range(self.services["volume"]["max"] - 1): volume = Volume.create( self.apiclient, self.services["volume"], @@ -885,7 +882,7 @@ class TestVolumes(cloudstackTestCase): domainid=cls.domain.id ) - cls.services["account"] = cls.account.name + cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] @@ -1089,6 +1086,54 @@ class TestVolumes(cloudstackTestCase): ) return + @attr(tags=["advanced", "advancedns", "simulator", "basic", "eip", "sg"]) + def test_create_volume_under_domain(self): + """Create a volume under a non-root domain as non-root-domain user + + 1. Create a domain under ROOT + 2. Create a user within this domain + 3. As user in step 2. create a volume with standard disk offering + 4. Ensure the volume is created in the domain and available to the user in his listVolumes call + """ + dom = Domain.create( + self.apiclient, + services={}, + name="NROOT", + parentdomainid=self.domain.id + ) + self.assertTrue(dom is not None, msg="Domain creation failed") + + domuser = Account.create( + apiclient=self.apiclient, + services=self.services["account"], + admin=False, + domainid=dom.id + ) + self.assertTrue(domuser is not None) + + domapiclient = self.testClient.getUserApiClient(account=domuser.name, domain=dom.name) + + diskoffering = DiskOffering.list(self.apiclient) + self.assertTrue(isinstance(diskoffering, list), msg="DiskOffering list is not a list?") + self.assertTrue(len(diskoffering) > 0, "no disk offerings in the deployment") + + vol = Volume.create( + domapiclient, + services=self.services["volume"], + zoneid=self.zone.id, + account=domuser.name, + domainid=dom.id, + diskofferingid=diskoffering[0].id + ) + self.assertTrue(vol is not None, "volume creation fails in domain %s as user %s" % (dom.name, domuser.name)) + + listed_vol = Volume.list(domapiclient, id=vol.id) + self.assertTrue(listed_vol is not None and isinstance(listed_vol, list), + "invalid response from listVolumes for volume %s" % vol.id) + self.assertTrue(listed_vol[0].id == vol.id, + "Volume returned by list volumes %s not matching with queried volume %s in domain %s" % ( + listed_vol[0].id, vol.id, dom.name)) + class TestDeployVmWithCustomDisk(cloudstackTestCase): @@ -1125,7 +1170,7 @@ class TestDeployVmWithCustomDisk(cloudstackTestCase): domainid=cls.domain.id ) - cls.services["account"] = cls.account.name + cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"]