• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python base.ServiceOffering类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setUpClass

    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,代码行数:34,代码来源:test_snapshots_improvement.py


示例2: setUpClass

    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,代码行数:57,代码来源:test_service_offerings.py


示例3: test_deployvm_firstfit

    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,代码行数:25,代码来源:test_deploy_vms_with_varied_deploymentplanners.py


示例4: setUpClass

    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,代码行数:25,代码来源:test_non_contiguous_vlan.py


示例5: setUpClass

    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,代码行数:29,代码来源:test_deploy_vm_with_userdata.py


示例6: test_03_deploy_vm_project_limit_reached

    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,代码行数:33,代码来源:test_cpu_max_limits.py


示例7: setUpClass

    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,代码行数:25,代码来源:test_memory_limits.py


示例8: test_04_deploy_multiple_vm_with_multiple_cpus

    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,代码行数:35,代码来源:test_cpu_limits.py


示例9: setUpClass

 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,代码行数:30,代码来源:test_egress_fw_rules.py


示例10: setUpClass

    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,代码行数:26,代码来源:test_vpc_network_pfrules.py


示例11: setUp

    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,代码行数:34,代码来源:test_deploy_vgpu_enabled_vm.py


示例12: setUp

    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,代码行数:26,代码来源:test_deploy_vm.py


示例13: setUp

    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,代码行数:29,代码来源:test_deploy_vm_root_resize.py


示例14: test_01_create_service_offering

    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,代码行数:58,代码来源:test_service_offerings.py


示例15: test_deployvm_userdispersing

    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,代码行数:57,代码来源:test_deploy_vms_with_varied_deploymentplanners.py


示例16: test_deployvm_userconcentrated

    def test_deployvm_userconcentrated(self):
        """Test deploy VMs using user concentrated planner
        """
        self.service_offering_userconcentrated = ServiceOffering.create(
            self.apiclient,
            self.services["service_offering"],
            deploymentplanner='UserConcentratedPodPlanner'
        )

        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_userconcentrated.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_userconcentrated.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"
        )
        self.assertNotEqual(
            vm1.hostid,
            vm2.hostid,
            msg="VMs meant to be concentrated are deployed on the different hosts"
        )
开发者ID:andrew2king,项目名称:cloudstack,代码行数:57,代码来源:test_deploy_vms_with_varied_deploymentplanners.py


示例17: setUpClass

    def setUpClass(cls):
        cls.api_client = super(TestBaseImageUpdate, 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_with_reset = ServiceOffering.create(
            cls.api_client, cls.services["service_offering_with_reset"]
        )

        cls.service_offering_without_reset = ServiceOffering.create(
            cls.api_client, cls.services["service_offering_without_reset"]
        )

        cls.account = Account.create(cls.api_client, cls.services["account"], admin=True, domainid=cls.domain.id)

        cls.vm_with_reset = VirtualMachine.create(
            cls.api_client,
            cls.services["virtual_machine"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering_with_reset.id,
        )
        cls.vm_with_reset_root_disk_id = cls.get_root_device_uuid_for_vm(
            cls.vm_with_reset.id, cls.vm_with_reset.rootdeviceid
        )

        cls.vm_without_reset = VirtualMachine.create(
            cls.api_client,
            cls.services["virtual_machine"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering_without_reset.id,
        )
        cls.vm_without_reset_root_disk_id = cls.get_root_device_uuid_for_vm(
            cls.vm_without_reset.id, cls.vm_without_reset.rootdeviceid
        )

        cls._cleanup = [cls.account, cls.service_offering_with_reset, cls.service_offering_without_reset]
        return
开发者ID:Bhathiya90,项目名称:cloudstack,代码行数:44,代码来源:test_base_image_updation.py


示例18: test_deploy_virtual_machines_static_offering

    def test_deploy_virtual_machines_static_offering(self, value):
        """Test deploy VM with static offering"""

        # Steps:
        # 1. Create admin/user account and create its user api client
        # 2. Create a static compute offering
        # 3. Deploy a VM with account api client and static service offering
        # 4. Repeat step 3 but also pass custom values for cpu number, cpu speed and memory
        #    while deploying VM

        # Validations:
        # 1. Step 3 should succeed
        # 2. Step 4 should fail

        isadmin=True
        if value == USER_ACCOUNT:
            isadmin=False

        # Create Account
        self.account = Account.create(self.apiclient,self.services["account"],domainid=self.domain.id, admin=isadmin)
        apiclient = self.testClient.createUserApiClient(
                                    UserName=self.account.name,
                                    DomainName=self.account.domain)
        self.cleanup.append(self.account)

        # Create service offering
        self.services["service_offering"]["cpunumber"] = 2
        self.services["service_offering"]["cpuspeed"] = 256
        self.services["service_offering"]["memory"] = 128

        serviceOffering = ServiceOffering.create(self.apiclient,
                                                 self.services["service_offering"])

        self.cleanup_co.append(serviceOffering)

        # Deploy VM with static service offering
        try:
            VirtualMachine.create(apiclient,self.services["virtual_machine"],
                                                    serviceofferingid=serviceOffering.id,
                                                    accountid=self.account.name,domainid=self.account.domainid)
        except Exception as e:
            self.fail("vm creation failed: %s" % e)

        # Deploy VM with static service offering, also with custom values
        try:
            VirtualMachine.create(apiclient,self.services["virtual_machine"],
                serviceofferingid=serviceOffering.id,
                customcpunumber=4,
                customcpuspeed=512,
                custommemory=256,
                accountid=self.account.name,domainid=self.account.domainid)
            self.fail("VM creation should have failed, it succeeded")
        except Exception as e:
            self.debug("vm creation failed as expected: %s" % e)
        return
开发者ID:dbac,项目名称:cloudstack,代码行数:55,代码来源:test_dynamic_compute_offering.py


示例19: setUpClass

    def setUpClass(cls):
        cls.services = Services().services
        cls.apiclient = super(TestDeployVM, cls).getClsTestClient().getApiClient()
        # Get Zone, Domain and templates
        domain = get_domain(cls.apiclient, cls.services)
        cls.zone = get_zone(cls.apiclient, cls.services)
        cls.services['mode'] = cls.zone.networktype

        #If local storage is enabled, alter the offerings to use localstorage
        #this step is needed for devcloud
        if cls.zone.localstorageenabled == True:
            cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
            cls.services["service_offerings"]["small"]["storagetype"] = 'local'
            cls.services["service_offerings"]["medium"]["storagetype"] = 'local'

        template = get_template(
            cls.apiclient,
            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
        cls.services["iso"]["zoneid"] = cls.zone.id

        cls.account = Account.create(
            cls.apiclient,
            cls.services["account"],
            domainid=domain.id
        )
        cls.debug(cls.account.id)

        cls.service_offering = ServiceOffering.create(
            cls.apiclient,
            cls.services["service_offerings"]["tiny"]
        )

        cls.virtual_machine = VirtualMachine.create(
            cls.apiclient,
            cls.services["small"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            mode=cls.services['mode']
        )

        cls.cleanup = [
            cls.service_offering,
            cls.account
        ]
开发者ID:baishuo,项目名称:cloudstack,代码行数:53,代码来源:test_vm_life_cycle.py


示例20: setUpClass

    def setUpClass(cls):

        cls.api_client = super(TestVMPlacement, 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.pod = get_pod(cls.api_client, zoneid=cls.zone.id, services=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"], offerha=True)
        cls._cleanup = [cls.service_offering]
        return
开发者ID:j0rg1,项目名称:cloudstack,代码行数:15,代码来源:test_vmware_drs.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.VirtualMachine类代码示例发布时间:2022-05-27
下一篇:
Python base.LoadBalancerRule类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap