From a1dc17125b57ea279296df2c166dd05adeb31b6c Mon Sep 17 00:00:00 2001 From: Gaurav Aradhye Date: Wed, 27 Aug 2014 21:46:30 +0530 Subject: [PATCH] CLOUDSTACK-7444: Allowing user account to submit async jobs in addition to admin --- test/integration/component/test_snapshots_improvement.py | 7 ++++++- tools/marvin/marvin/cloudstackTestClient.py | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/test/integration/component/test_snapshots_improvement.py b/test/integration/component/test_snapshots_improvement.py index 1646b69e051..6638dddf035 100644 --- a/test/integration/component/test_snapshots_improvement.py +++ b/test/integration/component/test_snapshots_improvement.py @@ -615,8 +615,13 @@ class TestCreateSnapshot(cloudstackTestCase): self.debug("Create a template from snapshot: %s" % snapshot.name) jobs.append(self.create_Template_from_Snapshot(snapshot)) + + userapiclient = self.testClient.getUserApiClient( + UserName=self.account.name, + DomainName=self.account.domain) + # Verify IO usage by submitting the concurrent jobs - self.testClient.submitCmdsAndWait(jobs) + self.testClient.submitCmdsAndWait(jobs, apiclient=userapiclient) self.debug("Verifying if templates are created properly or not?") templates = Template.list( diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py index 521d043009f..ce7ffc9b509 100644 --- a/tools/marvin/marvin/cloudstackTestClient.py +++ b/tools/marvin/marvin/cloudstackTestClient.py @@ -417,12 +417,14 @@ class CSTestClient(object): return FAILED return self.__createUserApiClient(UserName, DomainName, type) - def submitCmdsAndWait(self, cmds, workers=1): + def submitCmdsAndWait(self, cmds, workers=1, apiclient=None): ''' @Desc : FixME, httplib has issue if more than one thread submitted ''' + if not apiclient: + apiclient = self.__apiClient if self.__asyncJobMgr is None: - self.__asyncJobMgr = asyncJobMgr(self.__apiClient, + self.__asyncJobMgr = asyncJobMgr(apiclient, self.__dbConnection) return self.__asyncJobMgr.submitCmdsAndWait(cmds, workers)