本文整理汇总了Python中marvin.integration.lib.common.get_zone函数的典型用法代码示例。如果您正苦于以下问题:Python get_zone函数的具体用法?Python get_zone怎么用?Python get_zone使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_zone函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
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
]
示例2: setUp
def setUp(self):
self.pp = pprint.PrettyPrinter(indent=4, depth=6)
self.apiclient = super(TestScenario, self).getClsTestClient().getApiClient()
self.services = Services().services
# Get Zone, Domain and templates
self.domain = get_domain(self.apiclient, self.services)
self.zone = get_zone(self.apiclient, self.services)
self.pod = get_pod(self.apiclient, self.zone.id)
self.template = get_template(
self.apiclient,
self.zone.id,
self.services["ostype"]
)
self.accounts = []
for account in self.services["scenario"]["accounts"]:
self.accounts.append(self.CreateAccount(account))
self.service_offerings = []
for service_offering in self.services["scenario"]["service_offerings"]:
self.service_offerings.append(self.CreateServiceOffering(service_offering))
self.cleanup = [
# self.account
]
self.file_to_write = open('/home/sg-user/cloudstack-sim-gen/test_scenario.out', 'w')
self.file_to_write.truncate()
self.datapoints = []
示例3: setUpClass
def setUpClass(cls):
cls.api_client = super(TestSnapshotOnRootVolume,
cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"])
cls.account = Account.create(cls.api_client,
cls.services["account"],
domainid=cls.domain.id)
# pdb.set_trace()
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"])
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.services["disk_offering"],
domainid=cls.domain.id)
cls.service_offering2 = ServiceOffering.create(
cls.api_client,
cls.services["service_offering2"])
cls.disk_offering2 = DiskOffering.create(
cls.api_client,
cls.services["disk_offering2"],
domainid=cls.domain.id)
cls._cleanup = [cls.account,
cls.service_offering,
cls.disk_offering,
cls.service_offering2,
cls.disk_offering2]
示例4: setUpClass
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.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))
cls.cleanup = [cls.account]
# 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
示例5: setUpClass
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)
示例6: setUp
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"])
# for testing with specific template
# self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"], templatetype='USER', services = {"template":'31f52a4d-5681-43f7-8651-ad4aaf823618'})
#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
]
示例7: setUpClass
def setUpClass(cls):
cls.api_client = super(TestMemoryLimits,
cls).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.services["mode"] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls._cleanup = [cls.service_offering, ]
return
示例8: setUpClass
def setUpClass(cls):
# We want to fail quicker if it's failure
socket.setdefaulttimeout(60)
cls.api_client = super(
TestVPCNetworkPFRules,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
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
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls._cleanup = [cls.service_offering]
return
示例9: setUpClass
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
]
示例10: setUpClass
def setUpClass(cls):
cls.api_client = super(TestNonContiguousVLANRanges, cls).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, pod, domain
cls.zone = get_zone(cls.api_client, cls.services)
cls.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.domain = get_domain(cls.api_client, cls.services)
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.services["virtual_machine"]["template"] = cls.template.id
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls._cleanup = [cls.service_offering]
return
示例11: setUp
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
def setUpClass(cls):
cls.api_client = super(TestServiceOfferings, cls).getClsTestClient().getApiClient()
cls.services = Services().services
domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.services['mode'] = cls.zone.networktype
cls.service_offering_1 = ServiceOffering.create(
cls.api_client,
cls.services["off"]
)
cls.service_offering_2 = ServiceOffering.create(
cls.api_client,
cls.services["off"]
)
template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
# Set Zones and disk offerings
cls.services["small"]["zoneid"] = cls.zone.id
cls.services["small"]["template"] = template.id
cls.services["medium"]["zoneid"] = cls.zone.id
cls.services["medium"]["template"] = template.id
# Create VMs, NAT Rules etc
cls.account = Account.create(
cls.api_client,
cls.services["account"],
domainid=domain.id
)
cls.small_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offerings"]["small"]
)
cls.medium_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offerings"]["medium"]
)
cls.medium_virtual_machine = VirtualMachine.create(
cls.api_client,
cls.services["medium"],
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.medium_offering.id,
mode=cls.services["mode"]
)
cls._cleanup = [
cls.small_offering,
cls.medium_offering,
cls.account
]
return
示例13: setUpClass
def setUpClass(cls):
cls.services = Services().services
cls.apiclient = super(TestDeployVM, cls).getClsTestClient().getApiClient()
# Get Zone, Domain and templates
domain = get_domain(cls.apiclient, cls.services)
cls.zone = get_zone(cls.apiclient, cls.services)
cls.services['mode'] = cls.zone.networktype
#If local storage is enabled, alter the offerings to use localstorage
#this step is needed for devcloud
if cls.zone.localstorageenabled == True:
cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
cls.services["service_offerings"]["small"]["storagetype"] = 'local'
cls.services["service_offerings"]["medium"]["storagetype"] = 'local'
template = get_template(
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
# Set Zones and disk offerings
cls.services["small"]["zoneid"] = cls.zone.id
cls.services["small"]["template"] = template.id
cls.services["medium"]["zoneid"] = cls.zone.id
cls.services["medium"]["template"] = template.id
cls.services["iso"]["zoneid"] = cls.zone.id
cls.account = Account.create(
cls.apiclient,
cls.services["account"],
domainid=domain.id
)
cls.debug(cls.account.id)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.services["service_offerings"]["tiny"]
)
cls.virtual_machine = VirtualMachine.create(
cls.apiclient,
cls.services["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
mode=cls.services['mode']
)
cls.cleanup = [
cls.service_offering,
cls.account
]
示例14: setUpClass
def setUpClass(cls):
cls.api_client = super(TestMultipleChildDomainsMemory, cls).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.services["mode"] = cls.zone.networktype
cls.template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls._cleanup = []
return
示例15: setUpClass
def setUpClass(cls):
cls.api_client = super(TestVMPlacement, cls).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.pod = get_pod(cls.api_client, zoneid=cls.zone.id, services=cls.services)
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
cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"], offerha=True)
cls._cleanup = [cls.service_offering]
return