本文整理汇总了Python中marvin.lib.base.DiskOffering.create方法的典型用法代码示例。如果您正苦于以下问题:Python DiskOffering.create方法的具体用法?Python DiskOffering.create怎么用?Python DiskOffering.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.lib.base.DiskOffering
的用法示例。
在下文中一共展示了DiskOffering.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
cloudstackTestClient = super(TestResizeVolume,
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._cleanup = []
cls.unsupportedStorageType = False
if cls.hypervisor.lower() == 'lxc':
if not find_storage_pool_type(cls.api_client, storagetype='rbd'):
cls.unsupportedStorageType = True
return
cls.resourcetypemapping = {RESOURCE_PRIMARY_STORAGE: 10,
RESOURCE_SECONDARY_STORAGE: 11}
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
try:
cls.hypervisor = str(get_hypervisor_type(cls.api_client)).lower()
# Creating service offering with normal config
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"])
cls._cleanup.append(cls.service_offering)
cls.services["disk_offering"]["disksize"] = 5
cls.disk_offering_5_GB = DiskOffering.create(
cls.api_client,
cls.services["disk_offering"]
)
cls._cleanup.append(cls.disk_offering_5_GB)
cls.services["disk_offering"]["disksize"] = 20
cls.disk_offering_20_GB = DiskOffering.create(
cls.api_client,
cls.services["disk_offering"]
)
cls._cleanup.append(cls.disk_offering_20_GB)
except Exception as e:
cls.tearDownClass()
raise unittest.SkipTest(
"Failure while creating disk offering: %s" %
e)
return
示例2: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
testClient = super(TestVolumes, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls._cleanup = []
# 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.hypervisor = testClient.getHypervisorInfo()
cls.invalidStoragePoolType = False
cls.disk_offering = DiskOffering.create(cls.apiclient, cls.services["disk_offering"])
cls.resized_disk_offering = DiskOffering.create(cls.apiclient, cls.services["resized_disk_offering"])
cls.custom_resized_disk_offering = DiskOffering.create(
cls.apiclient, cls.services["resized_disk_offering"], custom=True
)
template = get_template(cls.apiclient, cls.zone.id, cls.services["ostype"])
if template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
cls.services["template"] = template.id
cls.services["diskofferingid"] = cls.disk_offering.id
cls.services["resizeddiskofferingid"] = cls.resized_disk_offering.id
cls.services["customresizeddiskofferingid"] = cls.custom_resized_disk_offering.id
# Create VMs, VMs 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 = VirtualMachine.create(
cls.apiclient,
cls.services,
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
mode=cls.services["mode"],
)
pools = StoragePool.list(cls.apiclient)
# cls.assertEqual(
# validateList(pools)[0],
# PASS,
# "storage pool list validation failed")
cls.volume = Volume.create(cls.apiclient, cls.services, account=cls.account.name, domainid=cls.account.domainid)
cls._cleanup = [
cls.resized_disk_offering,
cls.custom_resized_disk_offering,
cls.service_offering,
cls.disk_offering,
cls.volume,
cls.account,
]
示例3: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
cls.testClient = super(TestDeployVMFromISO, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.testdata = 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.testdata["ostype"]
)
# Create service, disk offerings etc
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.testdata["service_offering"]
)
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.testdata["disk_offering"]
)
cls._cleanup = [
cls.service_offering,
cls.disk_offering
]
return
示例4: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
testClient = super(TestAttachDataDiskOnCWPS, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.testdata = testClient.getParsedTestDataConfig()
cls.hypervisor = cls.testClient.getHypervisorInfo()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls._cleanup = []
cls.template = get_template(
cls.apiclient,
cls.zone.id,
cls.testdata["ostype"])
cls.skiptest = False
try:
cls.pools = StoragePool.list(
cls.apiclient,
zoneid=cls.zone.id,
scope="CLUSTER")
except Exception as e:
cls.skiptest = True
return
try:
# Create an account
cls.account = Account.create(
cls.apiclient,
cls.testdata["account"],
domainid=cls.domain.id
)
cls._cleanup.append(cls.account)
# Create user api client of the account
cls.userapiclient = testClient.getUserApiClient(
UserName=cls.account.name,
DomainName=cls.account.domain
)
# Create Service offering
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.testdata["service_offering"],
)
cls._cleanup.append(cls.service_offering)
# Create Disk offering
cls.disk_offering = DiskOffering.create(
cls.apiclient,
cls.testdata["disk_offering"],
custom=True,
tags=CLUSTERTAG1,
)
cls._cleanup.append(cls.disk_offering)
except Exception as e:
cls.tearDownClass()
raise e
return
示例5: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
cloudstacktestclient = super(TestPrimaryResourceLimitsVolume, 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._cleanup = []
cls.unsupportedStorageType = False
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
try:
cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
cls.services["disk_offering"]["disksize"] = 2
cls.disk_offering = DiskOffering.create(cls.api_client, cls.services["disk_offering"])
cls._cleanup.append(cls.service_offering)
cls._cleanup.append(cls.disk_offering)
except Exception as e:
cls.tearDownClass()
raise unittest.SkipTest("Exception in setUpClass: %s" % e)
return
示例6: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
cls.testClient = super(TestDeployVmWithCustomDisk, 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
cls._cleanup = []
cls.unsupportedStorageType = False
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() == "lxc":
if not find_storage_pool_type(cls.api_client, storagetype="rbd"):
cls.unsupportedStorageType = True
return
cls.disk_offering = DiskOffering.create(cls.api_client, cls.services["disk_offering"], custom=True)
cls._cleanup.append(cls.disk_offering)
template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
cls.services["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = template.id
# Create VMs, NAT Rules etc
cls.account = Account.create(cls.api_client, cls.services["account"], domainid=cls.domain.id)
cls._cleanup.append(cls.account)
cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
cls._cleanup.append(cls.service_offering)
示例7: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
cls.testClient = super(TestVolumes, 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
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() == 'lxc':
if not find_storage_pool_type(cls.api_client, storagetype='rbd'):
raise unittest.SkipTest("RBD storage type is required for data volumes for LXC")
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.services["disk_offering"]
)
template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.services["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = template.id
cls.services["virtual_machine"][
"diskofferingid"] = cls.disk_offering.id
# Create VMs, VMs etc
cls.account = Account.create(
cls.api_client,
cls.services["account"],
domainid=cls.domain.id
)
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
)
cls.volume = Volume.create(
cls.api_client,
cls.services["volume"],
zoneid=cls.zone.id,
account=cls.account.name,
domainid=cls.account.domainid,
diskofferingid=cls.disk_offering.id
)
cls._cleanup = [
cls.service_offering,
cls.disk_offering,
cls.account
]
示例8: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
cls.testClient = super(TestSnapshots, 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
cls.disk_offering = DiskOffering.create(cls.api_client, cls.services["disk_offering"])
cls.template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
cls.services["domainid"] = cls.domain.id
cls.services["volume"]["zoneid"] = cls.services["server_with_disk"]["zoneid"] = cls.zone.id
cls.services["server_with_disk"]["diskoffering"] = cls.disk_offering.id
cls.services["server_without_disk"]["zoneid"] = cls.zone.id
cls.services["templates"]["ostypeid"] = cls.template.ostypeid
cls.services["zoneid"] = cls.zone.id
cls.services["diskoffering"] = cls.disk_offering.id
cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
# Get Hypervisor Type
cls.hypervisor = (get_hypervisor_type(cls.api_client)).lower()
cls._cleanup = [cls.service_offering, cls.disk_offering]
return
示例9: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
cls.testClient = super(TestResourceLimitsProject, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services = Services().services
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["server"]["zoneid"] = cls.zone.id
# Create Domains, Account etc
cls.domain = Domain.create(cls.api_client, cls.services["domain"])
cls.account = Account.create(cls.api_client, cls.services["account"], domainid=cls.domain.id)
cls.userapiclient = cls.testClient.getUserApiClient(UserName=cls.account.name, DomainName=cls.account.domain)
# Create project as a domain admin
cls.project = Project.create(
cls.api_client, cls.services["project"], account=cls.account.name, domainid=cls.account.domainid
)
cls.services["account"] = cls.account.name
# Create Service offering and disk offerings etc
cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
cls.disk_offering = DiskOffering.create(cls.api_client, cls.services["disk_offering"])
cls._cleanup = [cls.project, cls.service_offering, cls.disk_offering, cls.account, cls.domain]
return
示例10: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
testClient = super(TestMultipleVolumeSnapshots, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.testdata = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.template = get_template(
cls.apiclient,
cls.zone.id,
cls.testdata["ostype"])
cls._cleanup = []
cls.skiptest = False
clus_list = list_clusters(cls.apiclient)
if cls.hypervisor.lower() not in ['vmware'] or len(clus_list) < 2:
cls.skiptest = True
return
try:
# Create an account
cls.account = Account.create(
cls.apiclient,
cls.testdata["account"],
domainid=cls.domain.id
)
# Create user api client of the account
cls.userapiclient = testClient.getUserApiClient(
UserName=cls.account.name,
DomainName=cls.account.domain
)
# Create Service offering
cls.service_offering_zwps = ServiceOffering.create(
cls.apiclient,
cls.testdata["service_offering"],
tags=ZONETAG1
)
cls.disk_offering_zwps = DiskOffering.create(
cls.apiclient,
cls.testdata["disk_offering"],
tags=ZONETAG1
)
cls._cleanup = [
cls.account,
cls.service_offering_zwps,
cls.disk_offering_zwps,
]
except Exception as e:
cls.tearDownClass()
raise e
return
示例11: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
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.pod = get_pod(cls.apiclient, cls.zone.id)
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:
cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
if cls.template == FAILED:
assert False, "get_test_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.disk_offering = DiskOffering.create(
cls.apiclient,
cls.services["disk_offering"]
)
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.service_offering)
cls._cleanup.append(cls.account)
cls._cleanup.append(cls.disk_offering)
return
示例12: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
cls.testClient = super(TestVolumes, 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
cls._cleanup = []
cls.unsupportedStorageType = False
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.services["disk_offering"]
)
cls._cleanup.append(cls.disk_offering)
template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
cls.services["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = template.id
cls.services["virtual_machine"][
"diskofferingid"] = cls.disk_offering.id
# Create VMs, VMs etc
cls.account = Account.create(
cls.api_client,
cls.services["account"],
domainid=cls.domain.id
)
cls._cleanup.append(cls.account)
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls._cleanup.append(cls.service_offering)
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
)
cls.volume = Volume.create(
cls.api_client,
cls.services["volume"],
zoneid=cls.zone.id,
account=cls.account.name,
domainid=cls.account.domainid,
diskofferingid=cls.disk_offering.id
)
示例13: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
cls.testClient = super(TestSnapshotOnRootVolume, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls._cleanup = []
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.unsupportedHypervisor = False
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ['hyperv', 'lxc']:
cls.unsupportedHypervisor = True
return
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)
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]
示例14: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
try:
cls._cleanup = []
cls.testClient = super(TestInstance, 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"]
)
if cls.zone.localstorageenabled:
cls.storagetype = 'local'
cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
cls.services["disk_offering"]["storagetype"] = 'local'
else:
cls.storagetype = 'shared'
cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
cls.services["disk_offering"]["storagetype"] = 'shared'
cls.services['mode'] = cls.zone.networktype
cls.services["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.services["custom_volume"]["zoneid"] = cls.zone.id
# Creating Disk offering, Service Offering and Account
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.services["disk_offering"]
)
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offerings"]["small"]
)
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.disk_offering)
cls._cleanup.append(cls.service_offering)
cls._cleanup.append(cls.account)
cls.mgtSvrDetails = cls.config.__dict__["mgtSvr"][0].__dict__
except Exception as e:
cls.tearDownClass()
raise Exception("Warning: Exception in setup : %s" % e)
return
示例15: setUpClass
# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
def setUpClass(cls):
testClient = super(TestMultipleVolumeAttach, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls._cleanup = []
# 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.hypervisor = testClient.getHypervisorInfo()
cls.invalidStoragePoolType = False
cls.disk_offering = DiskOffering.create(cls.apiclient, cls.services["disk_offering"])
template = get_template(cls.apiclient, cls.zone.id, cls.services["ostype"])
if template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
cls.services["template"] = template.id
cls.services["diskofferingid"] = cls.disk_offering.id
# Create VMs, VMs etc
cls.account = Account.create(cls.apiclient, cls.services["account"], domainid=cls.domain.id)
cls.service_offering = ServiceOffering.create(cls.apiclient, cls.services["service_offering"])
cls.virtual_machine = VirtualMachine.create(
cls.apiclient,
cls.services,
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
mode=cls.services["mode"],
)
# Create volumes (data disks)
cls.volume1 = Volume.create(
cls.apiclient, cls.services, account=cls.account.name, domainid=cls.account.domainid
)
cls.volume2 = Volume.create(
cls.apiclient, cls.services, account=cls.account.name, domainid=cls.account.domainid
)
cls.volume3 = Volume.create(
cls.apiclient, cls.services, account=cls.account.name, domainid=cls.account.domainid
)
cls.volume4 = Volume.create(
cls.apiclient, cls.services, account=cls.account.name, domainid=cls.account.domainid
)
cls._cleanup = [cls.service_offering, cls.disk_offering, cls.account]