本文整理汇总了Python中marvin.lib.base.ServiceOffering.create方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceOffering.create方法的具体用法?Python ServiceOffering.create怎么用?Python ServiceOffering.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.lib.base.ServiceOffering
的用法示例。
在下文中一共展示了ServiceOffering.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
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
示例2: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
def setUpClass(cls):
cls.testClient = super(TestUpdateResourceCount, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
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["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering_custom = ServiceOffering.create(
cls.api_client,
cls.services["service_offering_custom"]
)
cls.service_offering_normal = ServiceOffering.create(
cls.api_client,
cls.services["service_offering_normal"]
)
cls._cleanup = [cls.service_offering_custom, cls.service_offering_normal]
return
示例3: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
def setUpClass(cls):
cls.testClient = super(TestHostHighAvailability, 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_with_ha = ServiceOffering.create(
cls.api_client,
cls.services["service_offering_with_ha"],
offerha=True
)
cls.service_offering_without_ha = ServiceOffering.create(
cls.api_client,
cls.services["service_offering_without_ha"],
offerha=False
)
cls._cleanup = [
cls.service_offering_with_ha,
cls.service_offering_without_ha,
]
return
示例4: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
def setUpClass(cls):
testClient = super(TestScaleVm, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls._cleanup = []
cls.unsupportedHypervisor = False
cls.hypervisor = cls.testClient.getHypervisorInfo()
if cls.hypervisor.lower() in ('kvm', 'hyperv', 'lxc'):
cls.unsupportedHypervisor = True
return
# Get Zone, Domain and templates
domain = get_domain(cls.apiclient)
zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = zone.networktype
template = get_template(
cls.apiclient,
zone.id,
cls.services["ostype"]
)
if template == FAILED:
assert False, "get_template() failed to return template\
with description %s" % cls.services["ostype"]
# Set Zones and disk offerings ??
cls.services["small"]["zoneid"] = zone.id
cls.services["small"]["template"] = template.id
# Create account, service offerings, vm.
cls.account = Account.create(
cls.apiclient,
cls.services["account"],
domainid=domain.id
)
cls.small_offering = ServiceOffering.create(
cls.apiclient,
cls.services["service_offerings"]["small"]
)
cls.big_offering = ServiceOffering.create(
cls.apiclient,
cls.services["service_offerings"]["big"]
)
# create a virtual machine
cls.virtual_machine = VirtualMachine.create(
cls.apiclient,
cls.services["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.small_offering.id,
mode=cls.services["mode"]
)
cls._cleanup = [
cls.small_offering,
cls.account
]
示例5: test_02_failure_to_create_service_offering_with_customized_iops
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
def test_02_failure_to_create_service_offering_with_customized_iops(self):
try:
ServiceOffering.create(
self.apiClient,
self.testdata[TestData.systemOfferingFailure]
)
except:
return
self.assert_(False, "The service offering was created, but should not have been.")
示例6: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
def setUpClass(cls):
try:
cls._cleanup = []
cls.testClient = super(TestChangeServiceOfferingForVmWithSnapshots, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.unsupportedHypervisor = False
if cls.hypervisor.lower() in (KVM.lower(), "hyperv", "lxc"):
cls.unsupportedHypervisor = True
return
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(
cls.api_client,
cls.testClient.getZoneForTests()
)
cls.services["small"]["zoneid"] = cls.zone.id
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template\
with description %s" % cls.services["ostype"]
test_offerings = Utils().added_service_offerings
for offering in test_offerings:
cls.services["service_offerings"][offering] = test_offerings[offering]
# Create 2 different service offerings
cls.service_offering_1 = ServiceOffering.create(
cls.api_client,
cls.services["service_offerings"]["testOffering1"]
)
cls._cleanup.append(cls.service_offering_1)
cls.service_offering_2 = ServiceOffering.create(
cls.api_client,
cls.services["service_offerings"]["testOffering2"]
)
cls._cleanup.append(cls.service_offering_2)
cls.account = Account.create(
cls.api_client,
cls.services["account"],
domainid=cls.domain.id
)
cls._cleanup.append(cls.account)
except Exception as e:
cls.tearDownClass()
raise Exception("Warning: Exception in setup : %s" % e)
return
示例7: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
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
示例8: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
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
示例9: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
def setUpClass(cls):
cloudstackTestClient = super(TestVolumeLimits,
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.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._cleanup.append(cls.service_offering)
except Exception as e:
cls.tearDownClass()
raise unittest.SkipTest("Exception in setUpClass: %s" % e)
return
示例10: setUp
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
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
]
示例11: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
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
示例12: setUp
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
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
]
示例13: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
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
示例14: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
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
示例15: setUpClass
# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import create [as 别名]
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