当前位置: 首页>>代码示例>>Python>>正文


Python ServiceOffering.create方法代码示例

本文整理汇总了Python中marvin.integration.lib.base.ServiceOffering.create方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceOffering.create方法的具体用法?Python ServiceOffering.create怎么用?Python ServiceOffering.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在marvin.integration.lib.base.ServiceOffering的用法示例。


在下文中一共展示了ServiceOffering.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUpClass

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    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]
开发者ID:Bhathiya90,项目名称:cloudstack,代码行数:36,代码来源:test_snapshots_improvement.py

示例2: setUpClass

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    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
开发者ID:Bhathiya90,项目名称:cloudstack,代码行数:59,代码来源:test_service_offerings.py

示例3: test_deployvm_firstfit

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    def test_deployvm_firstfit(self):
        """Test to deploy vm with a first fit offering
        """
        # FIXME: How do we know that first fit actually happened?
        self.service_offering_firstfit = ServiceOffering.create(
            self.apiclient, self.services["service_offering"], deploymentplanner="FirstFitPlanner"
        )

        self.virtual_machine = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            zoneid=self.zone.id,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_firstfit.id,
            templateid=self.template.id,
        )

        list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
        self.debug("Verify listVirtualMachines response for virtual machine: %s" % self.virtual_machine.id)
        self.assertEqual(isinstance(list_vms, list), True, "List VM response was not a valid list")
        self.assertNotEqual(len(list_vms), 0, "List VM response was empty")

        vm = list_vms[0]
        self.assertEqual(vm.state, "Running", msg="VM is not in Running state")
开发者ID:jtperry,项目名称:cloudstack,代码行数:27,代码来源:test_deploy_vms_with_varied_deploymentplanners.py

示例4: setUpClass

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    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
开发者ID:Bhathiya90,项目名称:cloudstack,代码行数:27,代码来源:test_non_contiguous_vlan.py

示例5: setUpClass

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    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.cleanup = [cls.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))


        # 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:Bhathiya90,项目名称:cloudstack,代码行数:31,代码来源:test_deploy_vm_with_userdata.py

示例6: test_03_deploy_vm_project_limit_reached

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    def test_03_deploy_vm_project_limit_reached(self):
        """Test TTry to deploy VM with admin account where account has not used
        the resources but @ project they are not available"""

        # Validate the following
        # 1. Try to deploy VM with admin account where account has not used the
        #    resources but @ project they are not available
        # 2. Deploy VM should error out saying  ResourceAllocationException
        #    with "resource limit exceeds"

        self.debug("Creating service offering with 3 CPU cores")

        self.services["service_offering"]["cpunumber"] = 3
        self.service_offering = ServiceOffering.create(
            self.apiclient,
            self.services["service_offering"]
        )
        # Adding to cleanup list after execution
        self.cleanup.append(self.service_offering)

        self.debug("Setting up account and domain hierarchy")
        self.setupAccounts(account_limit=4, domain_limit=4, project_limit=2)

        api_client_admin = self.testClient.createUserApiClient(
            UserName=self.child_do_admin.name,
            DomainName=self.child_do_admin.domain)

        self.debug("Deploying instance in account 2 when CPU limit is reached")

        with self.assertRaises(Exception):
            self.createInstance(project=self.project,
                service_off=self.service_offering, api_client=api_client_admin)
        return
开发者ID:Bhathiya90,项目名称:cloudstack,代码行数:35,代码来源:test_cpu_max_limits.py

示例7: setUpClass

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    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
开发者ID:dbac,项目名称:cloudstack,代码行数:27,代码来源:test_memory_limits.py

示例8: test_04_deploy_multiple_vm_with_multiple_cpus

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    def test_04_deploy_multiple_vm_with_multiple_cpus(self):
        """Test Deploy multiple VM with 4 core CPU & verify the usage"""

        # Validate the following
        # 1. Create compute offering with 4 core CPU
        # 2. Deploy multiple VMs with this service offering
        # 3. List Resource count for the root admin CPU usage
        # 4. CPU usage should list properly
        # 5. Destroy one VM among multiple VM's and verify the resource count
        # 6. Migrate VM from & verify resource updates
        # 7. List resource count for Root Admin
        # 8. Failed to deploy VM and verify the resource usage

        self.debug("Creating service offering with 4 CPU cores")
        self.service_offering = ServiceOffering.create(
            self.apiclient, self.services["service_offering"])
        # Adding to cleanup list after execution
        self.cleanup.append(self.service_offering)

        self.debug("Creating an instance with service offering: %s" %
                   self.service_offering.name)
        vm_1 = self.createInstance(service_off=self.service_offering)
        vm_2 = self.createInstance(service_off=self.service_offering)
        self.createInstance(service_off=self.service_offering)

        account_list = Account.list(self.apiclient, id=self.account.id)
        self.assertIsInstance(account_list, list,
                              "List Accounts should return a valid response")
        resource_count = account_list[0].cputotal

        expected_resource_count = int(
            self.services["service_offering"]["cpunumber"]) * 4  #Total 4 Vms
        self.assertTrue(resource_count == expected_resource_count,
                        "Resource count does not match the expected vavlue")
        return
开发者ID:ngtuna,项目名称:cloudstack-autoscale,代码行数:37,代码来源:test_cpu_limits.py

示例9: setUpClass

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
 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)
开发者ID:Bhathiya90,项目名称:cloudstack,代码行数:32,代码来源:test_egress_fw_rules.py

示例10: setUpClass

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    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
开发者ID:baishuo,项目名称:cloudstack,代码行数:28,代码来源:test_vpc_network_pfrules.py

示例11: setUp

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    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
        ]
开发者ID:dbac,项目名称:cloudstack,代码行数:36,代码来源:test_deploy_vgpu_enabled_vm.py

示例12: setUp

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    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
        ]
开发者ID:dbac,项目名称:cloudstack,代码行数:28,代码来源:test_deploy_vm.py

示例13: setUp

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    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
        ]
开发者ID:baishuo,项目名称:cloudstack,代码行数:31,代码来源:test_deploy_vm_root_resize.py

示例14: test_01_create_service_offering

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    def test_01_create_service_offering(self):
        """Test to create service offering"""

        # Validate the following:
        # 1. createServiceOfferings should return a valid information for newly created offering
        # 2. The Cloud Database contains the valid information

        service_offering = ServiceOffering.create(
            self.apiclient,
            self.services["off"]
        )
        self.cleanup.append(service_offering)

        self.debug("Created service offering with ID: %s" % service_offering.id)

        list_service_response = list_service_offering(
            self.apiclient,
            id=service_offering.id
        )
        self.assertEqual(
            isinstance(list_service_response, list),
            True,
            "Check list response returns a valid list"
        )

        self.assertNotEqual(
            len(list_service_response),
            0,
            "Check Service offering is created"
        )
        service_response = list_service_response[0]

        self.assertEqual(
            list_service_response[0].cpunumber,
            self.services["off"]["cpunumber"],
            "Check server id in createServiceOffering"
        )
        self.assertEqual(
            list_service_response[0].cpuspeed,
            self.services["off"]["cpuspeed"],
            "Check cpuspeed in createServiceOffering"
        )
        self.assertEqual(
            list_service_response[0].displaytext,
            self.services["off"]["displaytext"],
            "Check server displaytext in createServiceOfferings"
        )
        self.assertEqual(
            list_service_response[0].memory,
            self.services["off"]["memory"],
            "Check memory in createServiceOffering"
        )
        self.assertEqual(
            list_service_response[0].name,
            self.services["off"]["name"],
            "Check name in createServiceOffering"
        )
        return
开发者ID:Bhathiya90,项目名称:cloudstack,代码行数:60,代码来源:test_service_offerings.py

示例15: test_deployvm_userdispersing

# 需要导入模块: from marvin.integration.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.integration.lib.base.ServiceOffering import create [as 别名]
    def test_deployvm_userdispersing(self):
        """Test deploy VMs using user dispersion planner
        """
        self.service_offering_userdispersing = ServiceOffering.create(
            self.apiclient,
            self.services["service_offering"],
            deploymentplanner='UserDispersingPlanner'
        )

        self.virtual_machine_1 = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            zoneid=self.zone.id,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_userdispersing.id,
            templateid=self.template.id
        )
        self.virtual_machine_2 = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            zoneid=self.zone.id,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_userdispersing.id,
            templateid=self.template.id
        )

        list_vm_1 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_1.id)
        list_vm_2 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_2.id)
        self.assertEqual(
            isinstance(list_vm_1, list),
            True,
            "List VM response was not a valid list"
        )
        self.assertEqual(
            isinstance(list_vm_2, list),
            True,
            "List VM response was not a valid list"
        )
        vm1 = list_vm_1[0]
        vm2 = list_vm_2[0]
        self.assertEqual(
            vm1.state,
            "Running",
            msg="VM is not in Running state"
        )
        self.assertEqual(
            vm2.state,
            "Running",
            msg="VM is not in Running state"
        )
        vm1clusterid = filter(lambda c: c.id == vm1.hostid, self.hosts)[0].clusterid
        vm2clusterid = filter(lambda c: c.id == vm2.hostid, self.hosts)[0].clusterid
        if vm1clusterid == vm2clusterid:
            self.debug("VMs (%s, %s) meant to be dispersed are deployed in the same cluster %s" % (
            vm1.id, vm2.id, vm1clusterid))
开发者ID:baishuo,项目名称:cloudstack,代码行数:59,代码来源:test_deploy_vms_with_varied_deploymentplanners.py


注:本文中的marvin.integration.lib.base.ServiceOffering.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。