本文整理汇总了Python中marvin.integration.lib.base.Account.create方法的典型用法代码示例。如果您正苦于以下问题:Python Account.create方法的具体用法?Python Account.create怎么用?Python Account.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.integration.lib.base.Account
的用法示例。
在下文中一共展示了Account.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupAccounts
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setupAccounts(self):
self.debug("Creating a sub-domain under: %s" % self.domain.name)
self.child_domain_1 = Domain.create(
self.apiclient,
services=self.services["domain"],
parentdomainid=self.domain.id)
self.child_do_admin_1 = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.child_domain_1.id)
# Cleanup the resources created at end of test
self.cleanup.append(self.child_do_admin_1)
self.cleanup.append(self.child_domain_1)
self.child_domain_2 = Domain.create(
self.apiclient,
services=self.services["domain"],
parentdomainid=self.domain.id)
self.child_do_admin_2 = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.child_domain_2.id)
# Cleanup the resources created at end of test
self.cleanup.append(self.child_do_admin_2)
self.cleanup.append(self.child_domain_2)
return
示例2: setupAccounts
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setupAccounts(self):
self.debug("Creating a domain under: %s" % self.domain.name)
self.parent_domain = Domain.create(
self.apiclient, services=self.services["domain"], parentdomainid=self.domain.id
)
self.parentd_admin = Account.create(
self.apiclient, self.services["account"], admin=True, domainid=self.domain.id
)
self.debug("Updating the Memory resource count for domain: %s" % self.domain.name)
Resources.updateLimit(
self.apiclient,
resourcetype=9,
max=4096,
account=self.parentd_admin.name,
domainid=self.parentd_admin.domainid,
)
self.debug("Creating a sub-domain under: %s" % self.parent_domain.name)
self.cdomain_1 = Domain.create(
self.apiclient, services=self.services["domain"], parentdomainid=self.parent_domain.id
)
self.debug("Creating a sub-domain under: %s" % self.parent_domain.name)
self.cdomain_2 = Domain.create(
self.apiclient, services=self.services["domain"], parentdomainid=self.parent_domain.id
)
self.cadmin_1 = Account.create(self.apiclient, self.services["account"], admin=True, domainid=self.cdomain_1.id)
self.debug("Updating the Memory resource count for domain: %s" % self.cdomain_1.name)
Resources.updateLimit(self.apiclient, resourcetype=9, max=2048, domainid=self.cadmin_1.domainid)
self.debug("Updating the Memory resource count for account: %s" % self.cadmin_1.name)
Resources.updateLimit(
self.apiclient, resourcetype=9, max=2048, account=self.cadmin_1.name, domainid=self.cadmin_1.domainid
)
self.cadmin_2 = Account.create(self.apiclient, self.services["account"], admin=True, domainid=self.cdomain_2.id)
self.debug("Updating the Memory resource count for domain: %s" % self.cdomain_2.name)
Resources.updateLimit(self.apiclient, resourcetype=9, max=2048, domainid=self.cadmin_2.domainid)
self.debug("Updating the Memory resource count for domain: %s" % self.cadmin_2.name)
Resources.updateLimit(
self.apiclient, resourcetype=9, max=2048, account=self.cadmin_2.name, domainid=self.cadmin_2.domainid
)
# Cleanup the resources created at end of test
self.cleanup.append(self.cadmin_1)
self.cleanup.append(self.cadmin_2)
self.cleanup.append(self.cdomain_1)
self.cleanup.append(self.cdomain_2)
self.cleanup.append(self.parentd_admin)
self.cleanup.append(self.parent_domain)
users = {self.parent_domain: self.parentd_admin, self.cdomain_1: self.cadmin_1, self.cdomain_2: self.cadmin_2}
return users
示例3: setupAccounts
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setupAccounts(self):
self.debug("Creating a sub-domain under: %s" % self.domain.name)
self.child_domain = Domain.create(
self.apiclient,
services=self.services["domain"],
parentdomainid=self.domain.id
)
self.child_do_admin = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.child_domain.id
)
# Cleanup the resources created at end of test
self.cleanup.append(self.child_do_admin)
self.cleanup.append(self.child_domain)
Resources.updateLimit(
self.apiclient,
resourcetype=8,
max=16,
account=self.child_do_admin.name,
domainid=self.child_do_admin.domainid
)
self.domain = Domain.create(
self.apiclient,
services=self.services["domain"],
parentdomainid=self.domain.id
)
self.admin = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.domain.id
)
# Cleanup the resources created at end of test
self.cleanup.append(self.admin)
self.cleanup.append(self.domain)
Resources.updateLimit(
self.apiclient,
resourcetype=8,
max=16,
account=self.admin.name,
domainid=self.admin.domainid
)
return
示例4: test_05_remove_used_range
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def test_05_remove_used_range(self):
"""
Test removing used vlan range
"""
# 1. Use a vlan id from existing range by deploying an instance which
# will create a network with vlan id from this range
# 4. Now try to remove this vlan range
# 5. Vlan range should not get removed, should throw error
account = Account.create(self.apiclient,self.services["account"],
domainid=self.domain.id)
self.debug("Deploying instance in the account: %s" % account.name)
try:
self.virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],
accountid=account.name,domainid=account.domainid,
serviceofferingid=self.service_offering.id,
mode=self.zone.networktype)
self.debug("Deployed instance in account: %s" % account.name)
self.debug("Trying to remove vlan range : %s , This should fail" % self.vlan["partial_range"][0])
with self.assertRaises(Exception) as e:
self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = self.vlan["partial_range"][0])
self.debug("operation failed with exception: %s" % e.exception)
account.delete(self.apiclient)
except Exception as e:
self.fail("Exception in test case: %s" % e)
return
示例5: create_domain_account_user
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def create_domain_account_user(parentDomain=None):
domain = Domain.create(cls.api_client,
cls.services["domain"],
parentdomainid=parentDomain.id if parentDomain else None)
cls._cleanup.append(domain)
# Create an Account associated with domain
account = Account.create(cls.api_client,
cls.services["account"],
domainid=domain.id)
cls._cleanup.append(account)
# Create an User, Project, Volume associated with account
user = User.create(cls.api_client,
cls.services["user"],
account=account.name,
domainid=account.domainid)
cls._cleanup.append(user)
project = Project.create(cls.api_client,
cls.services["project"],
account=account.name,
domainid=account.domainid)
cls._cleanup.append(project)
volume = Volume.create(cls.api_client,
cls.services["volume"],
zoneid=cls.zone.id,
account=account.name,
domainid=account.domainid,
diskofferingid=cls.disk_offering.id)
cls._cleanup.append(volume)
return {'domain':domain, 'account':account, 'user':user, 'project':project, 'volume':volume}
示例6: setUpClass
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(TestEgressFWRules,
cls).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone Domain and create Domains and sub Domains.
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.services['mode'] = cls.zone.networktype
# Get and set template id for VM creation.
cls.template = get_template(cls.api_client,
cls.zone.id,
cls.services["ostype"])
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
parentDomain = None
cls.domain = Domain.create(cls.api_client,
cls.services["domain"],
parentdomainid=parentDomain.id if parentDomain else None)
cls._cleanup.append(cls.domain)
# Create an Account associated with domain
cls.account = Account.create(cls.api_client,
cls.services["account"],
domainid=cls.domain.id)
cls._cleanup.append(cls.account)
# Create service offerings.
cls.service_offering = ServiceOffering.create(cls.api_client,
cls.services["service_offering"])
# Cleanup
cls._cleanup.append(cls.service_offering)
示例7: setUpClass
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setUpClass(cls):
cls.apiclient = super(TestDeployVmWithVariedPlanners, cls).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient, cls.services)
cls.zone = get_zone(cls.apiclient, cls.services)
cls.template = get_template(
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["template"] = cls.template.id
cls.services["zoneid"] = cls.zone.id
cls.account = Account.create(
cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
cls.services["account"] = cls.account.name
cls.hosts = Host.list(cls.apiclient, type='Routing')
cls.clusters = Cluster.list(cls.apiclient)
cls.cleanup = [
cls.account
]
示例8: setUp
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setUp(self):
try:
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.account = Account.create(
self.apiclient,
self.services["account"],
domainid=self.domain.id
)
self.cleanup = [
self.account,
]
self.virtual_machine = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
templateid=self.template.id,
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id
)
self.public_ip = PublicIPAddress.create(
self.apiclient,
accountid=self.virtual_machine.account,
zoneid=self.virtual_machine.zoneid,
domainid=self.virtual_machine.domainid,
services=self.services["virtual_machine"]
)
return
except cloudstackAPIException as e:
self.tearDown()
raise e
示例9: setupAccounts
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setupAccounts(self, account_limit=2, domain_limit=2, project_limit=2):
self.debug("Creating a domain under: %s" % self.domain.name)
self.child_domain = Domain.create(self.apiclient,
services=self.services["domain"],
parentdomainid=self.domain.id)
self.debug("domain crated with domain id %s" % self.child_domain.id)
self.child_do_admin = Account.create(self.apiclient,
self.services["account"],
admin=True,
domainid=self.child_domain.id)
self.debug("domain admin created for domain id %s" %
self.child_do_admin.domainid)
# Create project as a domain admin
self.project = Project.create(self.apiclient,
self.services["project"],
account=self.child_do_admin.name,
domainid=self.child_do_admin.domainid)
# Cleanup created project at end of test
self.cleanup.append(self.project)
# Cleanup accounts created
self.cleanup.append(self.child_do_admin)
self.cleanup.append(self.child_domain)
self.debug("Updating the CPU resource count for domain: %s" %
self.child_domain.name)
# Update resource limits for account 1
responses = Resources.updateLimit(self.apiclient,
resourcetype=8,
max=account_limit,
account=self.child_do_admin.name,
domainid=self.child_do_admin.domainid)
self.debug("CPU Resource count for child domain admin account is now: %s" %
responses.max)
self.debug("Updating the CPU limit for project")
responses = Resources.updateLimit(self.apiclient,
resourcetype=8,
max=project_limit,
projectid=self.project.id)
self.debug("CPU Resource count for project is now")
self.debug(responses.max)
self.debug("Updating the CPU limit for domain only")
responses = Resources.updateLimit(self.apiclient,
resourcetype=8,
max=domain_limit,
domainid=self.child_domain.id)
self.debug("CPU Resource count for domain %s with id %s is now %s" %
(responses.domain, responses.domainid, responses.max))
return
示例10: setUp
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.account = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.domain.id
)
self.cleanup = [self.account]
self.debug("Creating a VPC offering..")
self.vpc_off = VpcOffering.create(
self.apiclient,
self.services["vpc_offering"]
)
self.debug("Enabling the VPC offering created")
self.vpc_off.update(self.apiclient, state='Enabled')
self.debug("Creating a VPC network in the account: %s" % self.account.name)
self.services["vpc"]["cidr"] = '10.1.1.1/16'
self.vpc = VPC.create(
self.apiclient,
self.services["vpc"],
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid
)
return
示例11: setUp
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setUp(self):
self.services = Services().services
self.apiclient = self.testClient.getApiClient()
# Get Zone, Domain and Default Built-in template
self.domain = get_domain(self.apiclient, self.services)
self.zone = get_zone(self.apiclient, self.services)
self.services["mode"] = self.zone.networktype
# Before running this test, register a windows template with ostype as 'Windows 7 (32-bit)'
self.template = get_template(self.apiclient, self.zone.id, self.services["ostype"], templatetype='USER')
#create a user account
self.account = Account.create(
self.apiclient,
self.services["account"],
domainid=self.domain.id
)
self.services["vgpu260q"]["zoneid"] = self.zone.id
self.services["vgpu260q"]["template"] = self.template.id
self.services["vgpu140q"]["zoneid"] = self.zone.id
self.services["vgpu140q"]["template"] = self.template.id
#create a service offering
self.service_offering = ServiceOffering.create(
self.apiclient,
self.services["service_offerings"]["vgpu260qwin"],
serviceofferingdetails={'pciDevice': 'VGPU'}
)
#build cleanup list
self.cleanup = [
self.service_offering,
self.account
]
示例12: setUpClass
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setUpClass(cls):
cls.apiClient = super(TestDeployVmWithUserData, cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.zone = get_zone(cls.apiClient, cls.services)
if cls.zone.localstorageenabled:
#For devcloud since localstroage is enabled
cls.services["service_offering"]["storagetype"] = "local"
cls.service_offering = ServiceOffering.create(
cls.apiClient,
cls.services["service_offering"]
)
cls.account = Account.create(cls.apiClient, services=cls.services["account"])
cls.cleanup = [cls.account]
cls.template = get_template(
cls.apiClient,
cls.zone.id,
cls.services["ostype"]
)
cls.debug("Successfully created account: %s, id: \
%s" % (cls.account.name,\
cls.account.id))
# Generate userdata of 2500 bytes. This is larger than the 2048 bytes limit.
# CS however allows for upto 4K bytes in the code. So this must succeed.
# Overall, the query length must not exceed 4K, for then the json decoder
# will fail this operation at the marvin client side itcls.
user_data = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(2500))
cls.services["virtual_machine"]["userdata"] = user_data
示例13: setUp
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.account = Account.create(
self.apiclient,
self.services["account"],
domainid=self.domain.id
)
self.virtual_machine = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
templateid=self.template.id,
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id
)
self.public_ip = PublicIPAddress.create(
self.apiclient,
self.virtual_machine.account,
self.virtual_machine.zoneid,
self.virtual_machine.domainid,
self.services["virtual_machine"]
)
self.cleanup = [
self.account,
]
return
示例14: setUp
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setUp(self):
self.testdata = TestData().testdata
self.apiclient = self.testClient.getApiClient()
# Get Zone, Domain and Default Built-in template
self.domain = get_domain(self.apiclient, self.testdata)
self.zone = get_zone(self.apiclient, self.testdata)
self.testdata["mode"] = self.zone.networktype
self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
#create a user account
self.account = Account.create(
self.apiclient,
self.testdata["account"],
domainid=self.domain.id
)
#create a service offering
self.service_offering = ServiceOffering.create(
self.apiclient,
self.testdata["service_offering"]["small"]
)
#build cleanup list
self.cleanup = [
self.service_offering,
self.account
]
示例15: setupProjectAccounts
# 需要导入模块: from marvin.integration.lib.base import Account [as 别名]
# 或者: from marvin.integration.lib.base.Account import create [as 别名]
def setupProjectAccounts(self):
self.debug("Creating a domain under: %s" % self.domain.name)
self.domain = Domain.create(self.apiclient,
services=self.services["domain"],
parentdomainid=self.domain.id)
self.admin = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.domain.id
)
# Create project as a domain admin
self.project = Project.create(self.apiclient,
self.services["project"],
account=self.admin.name,
domainid=self.admin.domainid)
# Cleanup created project at end of test
self.cleanup.append(self.project)
self.cleanup.append(self.admin)
self.cleanup.append(self.domain)
self.debug("Created project with domain admin with name: %s" %
self.project.name)
projects = Project.list(self.apiclient, id=self.project.id,
listall=True)
self.assertEqual(isinstance(projects, list), True,
"Check for a valid list projects response")
project = projects[0]
self.assertEqual(project.name, self.project.name,
"Check project name from list response")
return