CLOUDSTACK-7444: Allowing user account to submit async jobs in addition to admin

This commit is contained in:
Gaurav Aradhye 2014-08-27 21:46:30 +05:30 committed by Girish Shilamkar
parent 6827d677a4
commit a1dc17125b
2 changed files with 10 additions and 3 deletions

View File

@ -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(

View File

@ -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)