本文整理汇总了Python中marvin.lib.common.get_template函数的典型用法代码示例。如果您正苦于以下问题:Python get_template函数的具体用法?Python get_template怎么用?Python get_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_template函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUpClass
def setUpClass(cls):
cls.testClient = super(TestCreateSnapshot, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
# Create VMs, NAT Rules etc
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls._cleanup = [
cls.service_offering,
]
return
开发者ID:fengyueyugu,项目名称:cloudstack,代码行数:26,代码来源:test_snapshots_improvement.py
示例2: setUpClass
def setUpClass(cls):
cloudstackTestClient = super(TestSecondaryStorageLimits, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
# Fill services from the external config file
cls.services = cloudstackTestClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cloudstackTestClient.getZoneForTests())
cls.services["mode"] = cls.zone.networktype
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
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.services["volume"]["zoneid"] = cls.zone.id
cls._cleanup = []
try:
cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
if cls.service_offering == FAILED:
raise Exception("Creating service offering failed")
except Exception as e:
cls.tearDownClass()
raise unittest.SkipTest("Exception in setup class: %s" % e)
return
开发者ID:MissionCriticalCloudOldRepos,项目名称:cosmic-core,代码行数:26,代码来源:test_ss_limits.py
示例3: setUp
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.testdata = self.testClient.getParsedTestDataConfig()
# Get Zone, Domain and Default Built-in template
self.domain = get_domain(self.apiclient)
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
self.testdata["mode"] = self.zone.networktype
self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
if self.template == FAILED:
self.fail("get_template() failed to return template with description %s" % 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_offerings"]["small"]
)
#build cleanup list
self.cleanup = [
self.service_offering,
self.account
]
开发者ID:aali-dincloud,项目名称:cloudstack,代码行数:29,代码来源:test_deploy_vm.py
示例4: setUpClass
def setUpClass(cls):
# We want to fail quicker if it's failure
socket.setdefaulttimeout(60)
cls.testClient = super(TestVPCRedundancy, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
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]
cls.logger = logging.getLogger('TestVPCRedundancy')
cls.stream_handler = logging.StreamHandler()
cls.logger.setLevel(logging.DEBUG)
cls.logger.addHandler(cls.stream_handler)
return
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:29,代码来源:test_vpc_redundant.py
示例5: setUp
def setUp(self):
self.testdata = TestData().testdata
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
# Get Zone, Domain and Default Built-in template
self.domain = get_domain(self.apiclient)
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
self.testdata["mode"] = self.zone.networktype
self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
if self.template == FAILED:
assert False, "get_template() failed to return template "
# 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
]
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:32,代码来源:test_deploy_vm_root_resize.py
示例6: setUpClass
def setUpClass(cls):
testClient = super(TestDeployVmWithUserData, cls).getClsTestClient()
cls.apiClient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls.zone = get_zone(cls.apiClient, testClient.getZoneForTests())
if cls.zone.localstorageenabled:
#For devcloud since localstroage is enabled
cls.services["service_offerings"]["storagetype"] = "local"
cls.service_offering = ServiceOffering.create(
cls.apiClient,
cls.services["service_offerings"]
)
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"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % 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
开发者ID:K0zka,项目名称:cloudstack,代码行数:35,代码来源:test_deploy_vm_with_userdata.py
示例7: setUpClass
def setUpClass(cls):
cls.testClient = super(TestMultipleChildDomains, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.testdata = cls.testClient.getParsedTestDataConfig()
#cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.testdata["mode"] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.testdata["ostype"]
)
# Create service, disk offerings etc
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.testdata["service_offering_multiple_cores"]
)
cls.testdata["virtual_machine"]["zoneid"] = cls.zone.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.testdata["service_offering_multiple_cores"]
)
cls._cleanup = []
return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:30,代码来源:test_cpu_domain_limits.py
示例8: setUpClass
def setUpClass(cls):
cloudstackTestClient = super(TestProjectsVolumeLimits,
cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
# Fill services from the external config file
cls.services = cloudstackTestClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cloudstackTestClient.getZoneForTests())
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.services["volume"]["zoneid"] = cls.zone.id
cls._cleanup = []
try:
cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
cls._cleanup.append(cls.service_offering)
except Exception as e:
cls.tearDownClass()
raise unittest.SkipTest("Exception in setUpClass: %s" % e)
return
开发者ID:aali-dincloud,项目名称:cloudstack,代码行数:27,代码来源:test_ps_project_limits.py
示例9: setUpClass
def setUpClass(cls):
try:
cls._cleanup = []
cls.testClient = super(TestIsos, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Domain, Zone, Template
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services['mode'] = cls.zone.networktype
cls.account = Account.create(
cls.api_client,
cls.services["account"],
domainid=cls.domain.id
)
# Getting authentication for user in newly created Account
cls.user = cls.account.user[0]
cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
cls._cleanup.append(cls.account)
except Exception as e:
cls.tearDownClass()
raise Exception("Warning: Exception in setup : %s" % e)
return
开发者ID:fengyueyugu,项目名称:cloudstack,代码行数:29,代码来源:test_escalations_isos.py
示例10: setUpClass
def setUpClass(cls):
cls.testClient = super(TestHAProxyStickyness, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["service_offering"]["name"] = "Medium Instance"
cls.services["service_offering"]["cpuspeed"] = "1024"
cls.services["service_offering"]["memory"] = "1024"
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls._cleanup = [cls.service_offering, ]
return
开发者ID:K0zka,项目名称:cloudstack,代码行数:25,代码来源:test_haproxy.py
示例11: setUpClass
def setUpClass(cls):
cls.testClient = super(TestTemplates, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
cls.services['mode'] = cls.zone.networktype
template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.account = Account.create(
cls.api_client,
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"],
)
# create virtual machine
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
)
#Stop virtual machine
cls.virtual_machine.stop(cls.api_client)
#Wait before server has be successfully stopped
time.sleep(30)
list_volume = Volume.list(
cls.api_client,
virtualmachineid=cls.virtual_machine.id,
type='ROOT',
listall=True
)
try:
if isinstance(list_volume, list):
cls.volume = list_volume[0]
except Exception as e:
raise Exception("Warning: Exception during setup : %s" % e)
cls._cleanup = [
cls.service_offering,
cls.account,
]
开发者ID:MANIKANDANVEN,项目名称:cloudstack,代码行数:60,代码来源:test_blocker_bugs.py
示例12: setUpClass
def setUpClass(cls):
cls._cleanup = []
cls.testClient = super(TestEgressFWRules, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
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)
开发者ID:MANIKANDANVEN,项目名称:cloudstack,代码行数:31,代码来源:test_egress_fw_rules.py
示例13: setUpClass
def setUpClass(cls):
cls.logger = logging.getLogger("TestRedundantIsolateNetworks")
cls.stream_handler = logging.StreamHandler()
cls.logger.setLevel(logging.DEBUG)
cls.logger.addHandler(cls.stream_handler)
cls.testClient = super(TestRedundantIsolateNetworks, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
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
# Create an account, network, VM and IP addresses
cls.account = Account.create(cls.api_client, cls.services["account"], admin=True, domainid=cls.domain.id)
cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
cls.services["nw_off_persistent_RVR_egress_true"] = cls.services["nw_off_persistent_RVR"].copy()
cls.services["nw_off_persistent_RVR_egress_true"]["egress_policy"] = "true"
cls.services["nw_off_persistent_RVR_egress_false"] = cls.services["nw_off_persistent_RVR"].copy()
cls.services["nw_off_persistent_RVR_egress_false"]["egress_policy"] = "false"
cls.services["egress_80"] = {"startport": 80, "endport": 80, "protocol": "TCP", "cidrlist": ["0.0.0.0/0"]}
cls.services["egress_53"] = {"startport": 53, "endport": 53, "protocol": "UDP", "cidrlist": ["0.0.0.0/0"]}
cls._cleanup = [cls.service_offering, cls.account]
return
开发者ID:MissionCriticalCloudOldRepos,项目名称:cosmic-core,代码行数:35,代码来源:test_routers_network_ops.py
示例14: setUpClass
def setUpClass(cls):
testClient = super(TestDeployVmWithVariedPlanners, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.template = get_template(
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % 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.hosts = Host.list(cls.apiclient, type='Routing')
cls.clusters = Cluster.list(cls.apiclient)
cls.cleanup = [
cls.account
]
开发者ID:Accelerite,项目名称:cloudstack,代码行数:31,代码来源:test_deploy_vms_with_varied_deploymentplanners.py
示例15: setUpClass
def setUpClass(cls):
cls.testClient = super(TestMaxProjectNetworks, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls.network_offering = NetworkOffering.create(
cls.api_client,
cls.services["network_offering"],
conservemode=True
)
# Enable Network offering
cls.network_offering.update(cls.api_client, state='Enabled')
cls._cleanup = [
cls.service_offering,
cls.network_offering
]
return
开发者ID:diejiazhao,项目名称:cloudstack,代码行数:30,代码来源:test_project_limits.py
示例16: setUpClass
def setUpClass(cls):
cls.testClient = super(TestAffinityRules, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
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.account = Account.create(
cls.api_client,
cls.services["account"],
domainid=cls.domain.id
)
cls._cleanup = [cls.account]
return
开发者ID:MANIKANDANVEN,项目名称:cloudstack,代码行数:31,代码来源:test_vmware_drs.py
示例17: setUpClass
def setUpClass(cls):
try:
cls._cleanup = []
cls.testClient = super(TestTemplates, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Domain, Zone, Template
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(
cls.api_client,
cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services['mode'] = cls.zone.networktype
builtin_info = get_builtin_template_info(cls.api_client, cls.zone.id)
cls.services["privatetemplate"]["url"] = builtin_info[0]
cls.services["privatetemplate"]["hypervisor"] = builtin_info[1]
cls.services["privatetemplate"]["format"] = builtin_info[2]
except Exception as e:
cls.tearDownClass()
raise Exception("Warning: Exception in setup : %s" % e)
return
开发者ID:K0zka,项目名称:cloudstack,代码行数:27,代码来源:test_escalations_templates.py
示例18: setUpClass
def setUpClass(cls):
cls.testClient = super(TestHighAvailability, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(
cls.api_client,
zone_id=cls.zone.id
)
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ['lxc']:
raise unittest.SkipTest("Template creation from root volume is not supported in LXC")
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
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:33,代码来源:test_high_availability.py
示例19: setUpClass
def setUpClass(cls):
cls.testClient = super(TestAffinityRules, cls).getClsTestClient()
if cls.testClient.getHypervisorInfo().lower() != "vmware":
raise unittest.SkipTest("VMWare tests only valid on VMWare hypervisor")
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
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.account = Account.create(
cls.api_client,
cls.services["account"],
domainid=cls.domain.id
)
cls._cleanup = [cls.account]
return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:33,代码来源:test_vmware_drs.py
示例20: setUpClass
def setUpClass(cls):
# We want to fail quicker if it's failure
socket.setdefaulttimeout(60)
cls.testClient = super(TestVPCNetworkPFRules, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
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
开发者ID:abnercosta,项目名称:cloudstack,代码行数:25,代码来源:test_vpc_network_pfrules.py
注:本文中的marvin.lib.common.get_template函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论