本文整理汇总了Python中marvin.lib.base.Template类的典型用法代码示例。如果您正苦于以下问题:Python Template类的具体用法?Python Template怎么用?Python Template使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Template类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_vm_nic_adapter_vmxnet3
def test_vm_nic_adapter_vmxnet3(self):
"""
# 1. Register a template for VMware with nicAdapter vmxnet3
# 2. Deploy a VM using this template
# 3. Create an isolated network
# 4. Add network to VM
# 5. Verify that the NIC adapter for VM for both the nics
# is vmxnet3
"""
if self.hypervisor.lower() not in ["vmware"]:
self.skipTest("This test case is written specifically\
for Vmware hypervisor")
# Register a private template in the account with nic adapter vmxnet3
template = Template.register(
self.userapiclient,
self.testdata["configurableData"]["vmxnet3template"],
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid,
details=[{"nicAdapter": self.testdata["configurableData"]["vmxnet3template"]["nicadapter"]}]
)
self.cleanup.append(template)
template.download(self.apiclient)
templates = Template.list(
self.userapiclient,
listall=True,
id=template.id,
templatefilter="self")
self.assertEqual(
validateList(templates)[0],
PASS,
"Templates list validation failed")
self.testdata["virtual_machine"]["zoneid"] = self.zone.id
self.testdata["virtual_machine"]["template"] = template.id
virtual_machine = VirtualMachine.create(
self.apiclient,
self.testdata["virtual_machine"],
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id)
isolated_network = Network.create(
self.apiclient,
self.testdata["isolated_network"],
self.account.name,
self.account.domainid,
networkofferingid=self.isolated_network_offering.id)
virtual_machine.add_nic(self.apiclient, isolated_network.id)
# TODO: Add steps to check the Nic Adapter type in VCenter
# using VCenter APIs
return
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:60,代码来源:test_nic_adapter_type.py
示例2: registerTemplate
def registerTemplate(self, inProject=False):
"""Register and download template by default in the account/domain,
in project if stated so"""
try:
builtin_info = get_builtin_template_info(self.apiclient, self.zone.id)
self.services["template_2"]["url"] = builtin_info[0]
self.services["template_2"]["hypervisor"] = builtin_info[1]
self.services["template_2"]["format"] = builtin_info[2]
template = Template.register(self.apiclient,
self.services["template_2"],
zoneid=self.zone.id,
account=self.child_do_admin.name if not inProject else None,
domainid=self.child_do_admin.domainid if not inProject else None,
projectid=self.project.id if inProject else None)
template.download(self.apiclient)
templates = Template.list(self.apiclient,
templatefilter=\
self.services["template_2"]["templatefilter"],
id=template.id)
self.assertEqual(validateList(templates)[0], PASS,\
"templates list validation failed")
self.templateSize = (templates[0].size / (1024**3))
except Exception as e:
return [FAIL, e]
return [PASS, None]
开发者ID:Skotha,项目名称:cloudstack,代码行数:30,代码来源:test_ss_max_limits.py
示例3: test_02_create_template_snapshot
def test_02_create_template_snapshot(self, value):
"""Test create snapshot and templates from volume
# Validate the following
1. Create root domain/child domain admin account
2. Deploy VM in the account
3. Create snapshot from the virtual machine root volume
4. Create template from the snapshot
5. Verify that the secondary storage count of the account equals
the size of the template"""
response = self.setupAccount(value)
self.assertEqual(response[0], PASS, response[1])
self.virtualMachine = VirtualMachine.create(
self.api_client,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
)
self.assertNotEqual(self.virtualMachine, FAILED, "VM deployment failed")
apiclient = self.testClient.getUserApiClient(UserName=self.account.name, DomainName=self.account.domain)
self.assertNotEqual(apiclient, FAILED, "Failed to create api client for account: %s" % self.account.name)
try:
self.virtualMachine.stop(apiclient)
except Exception as e:
self.fail("Failed to stop instance: %s" % e)
self.debug("Creating snapshot from ROOT volume: %s" % self.virtualMachine.name)
response = createSnapshotFromVirtualMachineVolume(apiclient, self.account, self.virtualMachine.id)
self.assertEqual(response[0], PASS, response[1])
snapshot = response[1]
snapshotSize = snapshot.physicalsize / (1024 ** 3)
try:
template = Template.create_from_snapshot(apiclient, snapshot=snapshot, services=self.services["template_2"])
except Exception as e:
self.fail("Failed to create template: %s" % e)
templates = Template.list(
apiclient, templatefilter=self.services["template_2"]["templatefilter"], id=template.id
)
self.assertEqual(validateList(templates)[0], PASS, "templates list validation failed")
templateSize = templates[0].size / (1024 ** 3)
expectedSecondaryStorageCount = int(templateSize + snapshotSize)
response = matchResourceCount(
self.apiclient,
expectedSecondaryStorageCount,
resourceType=RESOURCE_SECONDARY_STORAGE,
accountid=self.account.id,
)
self.assertEqual(response[0], PASS, response[1])
return
开发者ID:MissionCriticalCloudOldRepos,项目名称:cosmic-core,代码行数:60,代码来源:test_ss_limits.py
示例4: test_es_1863_register_template_s3_domain_admin_user
def test_es_1863_register_template_s3_domain_admin_user(self):
"""
@Desc: Test whether cloudstack allows Domain admin or user
to register a template using S3/Swift object store.
@Steps:
Step1: create a Domain and users in it.
Step2: Register a template as Domain admin.
Step3: Register a template as Domain user.
Step4: Template should be registered successfully.
"""
# Step1: create a Domain and users in it.
self.newdomain = Domain.create(self.apiClient,
self.services["domain"])
# create account in the domain
self.account_domain = Account.create(
self.apiClient,
self.services["account"],
domainid=self.newdomain.id
)
self.cleanup.append(self.account_domain)
self.cleanup.append(self.newdomain)
# Getting authentication for user in newly created Account in domain
self.domain_user = self.account_domain.user[0]
self.domain_userapiclient = self.testClient.getUserApiClient(
self.domain_user.username, self.newdomain.name
)
# Step2: Register a template as Domain admin.
self.services["templateregister"]["ostype"] = self.services["ostype"]
self.domain_template = Template.register(
self.apiClient,
self.services["templateregister"],
zoneid=self.zone.id,
account=self.account_domain.name,
domainid=self.newdomain.id,
hypervisor=self.hypervisor
)
# Wait for template to download
self.domain_template.download(self.api_client)
# Wait for template status to be changed across
time.sleep(60)
# Step3: Register a template as Domain user.
self.domain_user_template = Template.register(
self.domain_userapiclient,
self.services["templateregister"],
zoneid=self.zone.id,
account=self.account_domain.name,
domainid=self.newdomain.id,
hypervisor=self.hypervisor
)
# Wait for template to download
self.domain_user_template.download(self.api_client)
# Wait for template status to be changed across
time.sleep(60)
# TODO: Step4: Template should be registered successfully.
return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:60,代码来源:test_bugs.py
示例5: test_listtemplate
def test_listtemplate(self):
# Register template under one domain admin(root/domain1->account 1)
template_register = Template.register(
self.apiclient,
self.testdata["privatetemplate"],
zoneid=self.zone.id,
hypervisor=self.hypervisor,
account=self.account1.name,
domainid=self.domain1.id)
template_register.download(self.apiclient)
self.download(self.apiclient, template_register.id)
listtemplate = Template.list(
self.apiclient,
zoneid=self.zone.id,
hypervisor=self.hypervisor,
account=self.account2.name,
domainid=self.account2.domainid,
templatefilter="executable")
self.assertEqual(
listtemplate,
None,
"Check templates are not listed - CLOUDSTACK-10149"
)
return
开发者ID:PCextreme,项目名称:cloudstack,代码行数:30,代码来源:test_escalation_listTemplateDomainAdmin.py
示例6: test_01_create_template
def test_01_create_template(self):
"""Test create public & private template
"""
# Validate the following:
# 1. database (vm_template table) should be updated
# with newly created template
# 2. UI should show the newly added template
# 3. ListTemplates API should show the newly added template
#Create template from Virtual machine and Volume ID
template = Template.create(
self.apiclient,
self.services["template"],
self.volume.id,
account=self.account.name,
domainid=self.account.domainid
)
self.cleanup.append(template)
self.debug("Created template with ID: %s" % template.id)
list_template_response = Template.list(
self.apiclient,
templatefilter=\
self.services["templatefilter"],
id=template.id
)
self.assertEqual(
isinstance(list_template_response, list),
True,
"Check list response returns a valid list"
)
#Verify template response to check whether template added successfully
self.assertNotEqual(
len(list_template_response),
0,
"Check template available in List Templates"
)
template_response = list_template_response[0]
self.assertEqual(
template_response.displaytext,
self.services["template"]["displaytext"],
"Check display text of newly created template"
)
name = template_response.name
self.assertEqual(
name.count(self.services["template"]["name"]),
1,
"Check name of newly created template"
)
self.assertEqual(
template_response.ostypeid,
self.services["template"]["ostypeid"],
"Check osTypeID of newly created template"
)
return
开发者ID:krissterckx,项目名称:cloudstack,代码行数:59,代码来源:test_templates.py
示例7: test_01_register_template
def test_01_register_template(self, value):
"""Test register template
# Validate the following:
1. Create a root domain admin/ child domain admin account
2. Register and download a template according to hypervisor type
3. Verify that the template is listed
4. Verify that the secondary storage count for the account equals the size
of the template
5. Delete the template
6. Verify that the secondary storage resource count of the account equals 0
"""
response = self.setupAccount(value)
self.assertEqual(response[0], PASS, response[1])
builtin_info = get_builtin_template_info(self.apiclient, self.zone.id)
self.services["template_2"]["url"] = builtin_info[0]
self.services["template_2"]["hypervisor"] = builtin_info[1]
self.services["template_2"]["format"] = builtin_info[2]
try:
template = Template.register(self.apiclient,
self.services["template_2"],
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid,
hypervisor=self.hypervisor)
template.download(self.apiclient)
except Exception as e:
self.fail("Failed to register template: %s" % e)
templates = Template.list(self.apiclient,
templatefilter=\
self.services["template_2"]["templatefilter"],
id=template.id)
self.assertEqual(validateList(templates)[0],PASS,\
"templates list validation failed")
templateSize = (templates[0].size / (1024**3))
expectedCount = templateSize
response = matchResourceCount(
self.apiclient, expectedCount,
RESOURCE_SECONDARY_STORAGE,
accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
try:
template.delete(self.apiclient)
except Exception as e:
self.fail("Failed to delete template: %s" % e)
expectedCount = 0
response = matchResourceCount(
self.apiclient, expectedCount,
RESOURCE_SECONDARY_STORAGE,
accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
return
开发者ID:Skotha,项目名称:cloudstack,代码行数:58,代码来源:test_ss_limits.py
示例8: get_builtin_template_info
def get_builtin_template_info(apiclient, zoneid):
"""Returns hypervisor specific infor for templates"""
list_template_response = Template.list(apiclient, templatefilter="featured", zoneid=zoneid)
for b_template in list_template_response:
if b_template.templatetype == "BUILTIN":
break
extract_response = Template.extract(apiclient, b_template.id, "HTTP_DOWNLOAD", zoneid)
return extract_response.url, b_template.hypervisor, b_template.format
开发者ID:rafaelthedevops,项目名称:cloudstack,代码行数:12,代码来源:common.py
示例9: test_03_delete_template
def test_03_delete_template(self):
"""Test Delete template
"""
# Validate the following:
# 1. Create a template and verify it is shown in list templates response
# 2. Delete the created template and again verify list template response
# Verify template response for updated attributes
list_template_response = Template.list(
self.apiclient,
templatefilter=\
self.services["template"]["templatefilter"],
id=self.template.id,
zoneid=self.zone.id)
self.assertEqual(
isinstance(list_template_response, list),
True,
"Check for list template response return valid list"
)
self.assertNotEqual(
len(list_template_response),
0,
"Check template available in List Templates"
)
template_response = list_template_response[0]
self.assertEqual(
template_response.id,
self.template.id,
"Template id %s in the list is not matching with created template id %s" %
(template_response.id, self.template.id)
)
self.debug("Deleting template: %s" % self.template)
# Delete the template
self.template.delete(self.apiclient)
self.debug("Delete template: %s successful" % self.template)
list_template_response = Template.list(
self.apiclient,
templatefilter=\
self.services["template"]["templatefilter"],
id=self.template.id,
zoneid=self.zone.id
)
self.assertEqual(
list_template_response,
None,
"Check template available in List Templates"
)
return
开发者ID:K0zka,项目名称:cloudstack,代码行数:53,代码来源:test_templates.py
示例10: test_04_template_from_snapshot
def test_04_template_from_snapshot(self):
"""Create Template from snapshot
"""
# Validate the following
# 2. Snapshot the Root disk
# 3. Create Template from snapshot
# 4. Deploy Virtual machine using this template
# 5. VM should be in running state
userapiclient = self.testClient.getUserApiClient(UserName=self.account.name, DomainName=self.account.domain)
volumes = Volume.list(userapiclient, virtualmachineid=self.virtual_machine.id, type="ROOT", listall=True)
volume = volumes[0]
self.debug("Creating a snapshot from volume: %s" % volume.id)
# Create a snapshot of volume
snapshot = Snapshot.create(userapiclient, volume.id, account=self.account.name, domainid=self.account.domainid)
self.debug("Creating a template from snapshot: %s" % snapshot.id)
# Generate template from the snapshot
template = Template.create_from_snapshot(userapiclient, snapshot, self.services["template"])
self.cleanup.append(template)
# Verify created template
templates = Template.list(
userapiclient, templatefilter=self.services["template"]["templatefilter"], id=template.id
)
self.assertNotEqual(templates, None, "Check if result exists in list item call")
self.assertEqual(templates[0].id, template.id, "Check new template id in list resources call")
self.debug("Deploying a VM from template: %s" % template.id)
# Deploy new virtual machine using template
virtual_machine = VirtualMachine.create(
userapiclient,
self.services["virtual_machine"],
templateid=template.id,
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
)
self.cleanup.append(virtual_machine)
vm_response = VirtualMachine.list(
userapiclient, id=virtual_machine.id, account=self.account.name, domainid=self.account.domainid
)
self.assertEqual(isinstance(vm_response, list), True, "Check for list VM response return valid list")
# Verify VM response to check whether VM deployment was successful
self.assertNotEqual(len(vm_response), 0, "Check VMs available in List VMs response")
vm = vm_response[0]
self.assertEqual(vm.state, "Running", "Check the state of VM created from Template")
return
开发者ID:MissionCriticalCloudOldRepos,项目名称:cosmic-core,代码行数:51,代码来源:test_templates.py
示例11: 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.hypervisor = cls.testClient.getHypervisorInfo()
cls.template = Template.register(cls.api_client, cls.services["template"][cls.hypervisor.lower(
)], cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
cls.template.download(cls.api_client)
if cls.template == FAILED:
assert False, "get_template() failed to return template"
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.template]
cls.logger = logging.getLogger('TestVPCRedundancy')
cls.stream_handler = logging.StreamHandler()
cls.logger.setLevel(logging.DEBUG)
cls.logger.addHandler(cls.stream_handler)
return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:34,代码来源:test_vpc_redundant.py
示例12: test_08_list_system_templates
def test_08_list_system_templates(self):
"""Test System templates are not visible to normal user"""
# Validate the following
# 1. ListTemplates should not show 'SYSTEM' templates for normal user
list_template_response = Template.list(
self.apiclient,
templatefilter='featured',
account=self.user.name,
domainid=self.user.domainid
)
self.assertEqual(
isinstance(list_template_response, list),
True,
"Check list response returns a valid list"
)
self.assertNotEqual(
len(list_template_response),
0,
"Check template available in List Templates"
)
for template in list_template_response:
self.assertNotEqual(
template.templatetype,
'SYSTEM',
"ListTemplates should not list any system templates"
)
return
开发者ID:krissterckx,项目名称:cloudstack,代码行数:31,代码来源:test_templates.py
示例13: setUpClass
def setUpClass(cls):
cls.logger = logging.getLogger('TestVPCSite2SiteVPN')
cls.stream_handler = logging.StreamHandler()
cls.logger.setLevel(logging.DEBUG)
cls.logger.addHandler(cls.stream_handler)
testClient = super(TestVpcSite2SiteVpn, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = Services().services
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.services["compute_offering"]
)
cls.account = Account.create(
cls.apiclient, services=cls.services["account"])
cls.hypervisor = cls.services["default_hypervisor"]
cls.logger.debug("Downloading Template: %s from: %s" % (cls.services["template"][
cls.hypervisor]["name"], cls.services["template"][cls.hypervisor]["url"]))
cls.template = Template.register(cls.apiclient, cls.services["template"][
cls.hypervisor], cls.zone.id, hypervisor=cls.hypervisor, account=cls.account.name, domainid=cls.domain.id)
cls.template.download(cls.apiclient)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services[
"compute_offering"]
cls.services["virtual_machine"][
"hypervisor"] = cls.services["default_hypervisor"]
cls.cleanup = [cls.account]
开发者ID:tianshangjun,项目名称:cloudstack,代码行数:33,代码来源:test_vpc_vpn.py
示例14: test_01_check_template_size
def test_01_check_template_size(self):
"""TS_BUG_009-Test the size of template created from root disk
"""
# Validate the following:
# 1. Deploy new VM using the template created from Volume
# 2. VM should be in Up and Running state
#Create template from volume
template = Template.create(
self.apiclient,
self.services["template"],
self.volume.id,
account=self.account.name,
domainid=self.account.domainid
)
self.debug("Creating template with ID: %s" % template.id)
# Volume and Template Size should be same
self.assertEqual(
template.size,
self.volume.size,
"Check if size of template and volume are same"
)
return
开发者ID:MountHuang,项目名称:cloudstack,代码行数:25,代码来源:test_blocker_bugs.py
示例15: test_07_list_public_templates
def test_07_list_public_templates(self):
"""Test only public templates are visible to normal user"""
# Validate the following
# 1. ListTemplates should show only 'public' templates for normal user
list_template_response = Template.list(
self.apiclient,
templatefilter='featured',
account=self.user.name,
domainid=self.user.domainid
)
self.assertEqual(
isinstance(list_template_response, list),
True,
"Check list response returns a valid list"
)
self.assertNotEqual(
len(list_template_response),
0,
"Check template available in List Templates"
)
#Template response should list all 'public' templates
for template in list_template_response:
self.assertEqual(
template.ispublic,
True,
"ListTemplates should list only public templates"
)
return
开发者ID:krissterckx,项目名称:cloudstack,代码行数:30,代码来源:test_templates.py
示例16: test_03_delete_template
def test_03_delete_template(self):
"""Test delete template
"""
# Validate the following:
# 1. UI should not show the deleted template
# 2. database (vm_template table) should not contain deleted template
self.debug("Deleting Template ID: %s" % self.template_1.id)
self.template_1.delete(self.apiclient)
list_template_response = Template.list(
self.apiclient,
templatefilter=\
self.services["templatefilter"],
id=self.template_1.id,
account=self.account.name,
domainid=self.account.domainid
)
# Verify template is deleted properly using ListTemplates
self.assertEqual(
list_template_response,
None,
"Check if template exists in List Templates"
)
return
开发者ID:krissterckx,项目名称:cloudstack,代码行数:27,代码来源:test_templates.py
示例17: setUp
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.dbclient = self.testClient.getDbConnection()
self.services = Services().services
self.services["virtual_machine"]["zoneid"] = self.zone.id
self.account = Account.create(self.apiclient, self.services["account"], domainid=self.domain.id)
builtin_info = get_builtin_template_info(self.apiclient, self.zone.id)
self.services["template"]["url"] = builtin_info[0]
self.services["template"]["hypervisor"] = builtin_info[1]
self.services["template"]["format"] = builtin_info[2]
# Register new template
self.template = Template.register(
self.apiclient,
self.services["template"],
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid,
hypervisor=self.hypervisor,
)
self.debug(
"Registered a template of format: %s with ID: %s" % (self.services["template"]["format"], self.template.id)
)
try:
self.template.download(self.apiclient)
except Exception as e:
raise Exception("Template download failed: %s" % e)
self.cleanup = [self.account]
return
开发者ID:rafaelthedevops,项目名称:cloudstack,代码行数:32,代码来源:test_stopped_vm.py
示例18: test_02_deploy_vm_account_limit_reached
def test_02_deploy_vm_account_limit_reached(self):
"""Test Try to deploy VM with admin account where account has used
the resources but @ domain they are available
# Validate the following
# 1. Try to register template with admin account where account has used the
# resources but @ domain they are available
# 2. Template registration should fail"""
response = self.setupAccounts()
self.assertEqual(response[0], PASS, response[1])
response = self.registerTemplate()
self.assertEqual(response[0], PASS, response[1])
expectedCount = self.templateSize
response = matchResourceCount(
self.apiclient, expectedCount,
RESOURCE_SECONDARY_STORAGE,
accountid=self.child_do_admin.id)
self.assertEqual(response[0], PASS, response[1])
accountLimit = self.templateSize
response = self.updateSecondaryStorageLimits(accountLimit=accountLimit)
self.assertEqual(response[0], PASS, response[1])
with self.assertRaises(Exception):
template = Template.register(self.apiclient,
self.services["template_2"],
zoneid=self.zone.id,
account=self.child_do_admin.name,
domainid=self.child_do_admin.domainid)
return
开发者ID:Skotha,项目名称:cloudstack,代码行数:34,代码来源:test_ss_max_limits.py
示例19: setUpClass
def setUpClass(cls):
testClient = super(TestSnapshotRootDisk, 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.services['mode'] = cls.zone.networktype
cls.hypervisorNotSupported = False
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ['hyperv', 'lxc'] or 'kvm-centos6' in cls.testClient.getZoneForTests():
cls.hypervisorNotSupported = True
cls._cleanup = []
if not cls.hypervisorNotSupported:
macchinina = Templates().templates["macchinina"]
cls.template = Template.register(cls.apiclient, macchinina[cls.hypervisor.lower()],
cls.zone.id, hypervisor=cls.hypervisor.lower(), domainid=cls.domain.id)
cls.template.download(cls.apiclient)
if cls.template == FAILED:
assert False, "get_template() failed to return template"
cls.services["domainid"] = cls.domain.id
cls.services["small"]["zoneid"] = cls.zone.id
cls.services["templates"]["ostypeid"] = cls.template.ostypeid
cls.services["zoneid"] = cls.zone.id
# Create VMs, NAT Rules etc
cls.account = Account.create(
cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.services["service_offerings"]["tiny"]
)
cls.virtual_machine = cls.virtual_machine_with_disk = \
VirtualMachine.create(
cls.apiclient,
cls.services["small"],
templateid=cls.template.id,
accountid=cls.account.name,
domainid=cls.account.domainid,
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id,
mode=cls.services["mode"]
)
cls._cleanup.append(cls.virtual_machine)
cls._cleanup.append(cls.service_offering)
cls._cleanup.append(cls.account)
cls._cleanup.append(cls.template)
return
开发者ID:milamberspace,项目名称:cloudstack,代码行数:58,代码来源:test_snapshots.py
示例20: test_Scale_VM
def test_Scale_VM(self):
"""
@desc:
1. Enable dynamic scaling in Global settings
2. Register an CentOS 7 tempplate(with tools) and tick dynamic scaling
3. Deploy VM with this template
4.Start the VM and try to change service offering
"""
self.hypervisor = str(get_hypervisor_type(self.api_client)).lower()
if self.hypervisor != "xenserver":
self.skipTest("This test can be run only on xenserver")
self.updateConfigurAndRestart("enable.dynamic.scale.vm","true")
template = Template.register(
self.userapiclient,
self.services["CentOS7template"],
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid
)
self.assertIsNotNone(template,"Failed to register CentOS 7 template")
self.debug(
"Registered a template with format {} and id {}".format(
self.services["CentOS7template"]["format"],template.id)
)
template.download(self.userapiclient)
self.cleanup.append(template)
vm = VirtualMachine.create(
self.userapiclient,
self.services["virtual_machine"],
accountid=self.account
|
请发表评论