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

Python base.DiskOffering类代码示例

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

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



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

示例1: setUpClass

    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
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:60,代码来源:test_ps_resize_volume.py


示例2: setUpClass

    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,
        ]
开发者ID:MissionCriticalCloudOldRepos,项目名称:cosmic-core,代码行数:54,代码来源:test_volumes.py


示例3: setUpClass

 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
开发者ID:tianshangjun,项目名称:cloudstack,代码行数:26,代码来源:test_ps_resource_limits_volume.py


示例4: setUpClass

    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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:60,代码来源:testpath_attach_disk_zwps.py


示例5: setUpClass

    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)
开发者ID:bheuvel,项目名称:cloudstack,代码行数:28,代码来源:test_volumes.py


示例6: test_02_list_all_diskofferings_with_noparams

    def test_02_list_all_diskofferings_with_noparams(self):
        """
        Test List Disk Offerings with No Parameters
        """

        diskofferingvailable=0
        listdiskofferings=DiskOffering.list(self.user_api_client)

        self.assertEqual(
                            isinstance(listdiskofferings, list),
                            True,
                            "Check list Disk Offerings response returns a valid list"
                        )

        for diskoffering1 in listdiskofferings:
            if diskoffering1.name=="Small":
                diskofferingvailable=diskofferingvailable+1
            elif diskoffering1.name=="Medium":
                diskofferingvailable=diskofferingvailable+1
            elif diskoffering1.name=="Large":
                diskofferingvailable=diskofferingvailable+1
            elif diskoffering1.name=="Custom":
                diskofferingvailable=diskofferingvailable+1

        if diskofferingvailable<4:
            self.fail("All the default disk offerings are not listed")
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:26,代码来源:test_interop_xd_ccp.py


示例7: setUpClass

    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
        ]
开发者ID:K0zka,项目名称:cloudstack,代码行数:60,代码来源:test_volumes.py


示例8: setUpClass

    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
开发者ID:mariocar,项目名称:cloudstack,代码行数:29,代码来源:test_snapshots.py


示例9: setUpClass

    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
开发者ID:vaddanak,项目名称:challenges,代码行数:29,代码来源:test_project_limits.py


示例10: setUpClass

    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
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:32,代码来源:test_deploy_vm_iso.py


示例11: setUpClass

    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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:59,代码来源:testpath_multiple_snapshot.py


示例12: setUpClass

    def setUpClass(cls):
        testClient = super(TestSnapshotRootDisk, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.services = testClient.getParsedTestDataConfig()

        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
        cls.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
开发者ID:PCextreme,项目名称:cloudstack,代码行数:57,代码来源:test_snapshots.py


示例13: setUpClass

    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
        )
开发者ID:miguelaferreira,项目名称:cosmic-core,代码行数:57,代码来源:test_volumes.py


示例14: setUpClass

    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]
开发者ID:Accelerite,项目名称:cloudstack,代码行数:41,代码来源:test_snapshots_improvement.py


示例15: setUpClass

    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
开发者ID:Accelerite,项目名称:cloudstack,代码行数:53,代码来源:test_escalations_instances.py


示例16: setUpClass

    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]
开发者ID:MissionCriticalCloudOldRepos,项目名称:cosmic-core,代码行数:52,代码来源:test_simultaneous_volume_attach.py


示例17: 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.virtualMachine = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
                            projectid=self.project.id,
                            diskofferingid=self.disk_offering.id,
                            serviceofferingid=self.service_offering.id)

        try:
            projects = Project.list(self.apiclient, id=self.project.id, listall=True)
        except Exception as e:
            self.fail("failed to get projects list: %s" % e)

        self.assertEqual(validateList(projects)[0], PASS,
            "projects list validation failed")
        self.initialResourceCount = int(projects[0].primarystoragetotal)

        projectLimit = self.initialResourceCount + 3

        self.debug("Setting up account and domain hierarchy")
        response = self.updatePrimaryStorageLimits(projectLimit=projectLimit)
        self.assertEqual(response[0], PASS, response[1])

        self.services["volume"]["size"] = self.services["disk_offering"]["disksize"] = 2

        try:
            disk_offering = DiskOffering.create(self.apiclient,
                                    services=self.services["disk_offering"])
            self.cleanup.append(disk_offering)
            Volume.create(self.apiclient,
                                   self.services["volume"],
                                   zoneid=self.zone.id,
                                   projectid=self.project.id,
                                   diskofferingid=disk_offering.id)
        except Exception as e:
            self.fail("Exception occured: %s" % e)

        with self.assertRaises(Exception):
            Volume.create(self.apiclient,
                                   self.services["volume"],
                                   zoneid=self.zone.id,
                                   projectid=self.project.id,
                                   diskofferingid=disk_offering.id)
        return
开发者ID:K0zka,项目名称:cloudstack,代码行数:51,代码来源:test_ps_max_limits.py


示例18: setUpClass

    def setUpClass(cls):
        testClient = super(TestStorageSnapshotsLimits, 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.template = get_template(cls.apiclient, cls.zone.id, cls.testdata["ostype"])

        cls._cleanup = []
        cls.snapshotSupported = True

        if cls.hypervisor.lower() in ["hyperv", "lxc"]:
            cls.snapshotSupported = False
            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)

            cls.disk_offering = DiskOffering.create(cls.apiclient, cls.testdata["disk_offering"])

            cls._cleanup.append(cls.disk_offering)

            cls.vm = VirtualMachine.create(
                cls.userapiclient,
                cls.testdata["small"],
                templateid=cls.template.id,
                accountid=cls.account.name,
                domainid=cls.account.domainid,
                serviceofferingid=cls.service_offering.id,
                zoneid=cls.zone.id,
            )

        except Exception as e:
            cls.tearDownClass()
            raise e
        return
开发者ID:ikarin,项目名称:cloudstack,代码行数:50,代码来源:testpath_snapshot_limits.py


示例19: setUp

 def setUp(self):
     self.apiclient = self.testClient.getApiClient()
     self.dbclient = self.testClient.getDbConnection()
     self.cleanup = []
     try:
         response = self.setupAccounts()
         if response[0] == FAIL:
             self.skipTest("Failure while setting up accounts: %s" % response[1])
         self.services["disk_offering"]["disksize"] = 2
         self.disk_offering = DiskOffering.create(self.apiclient, self.services["disk_offering"])
         self.cleanup.append(self.disk_offering)
     except Exception as e:
         self.tearDown()
         self.skipTest("Failure in setup: %s" % e)
     return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:15,代码来源:test_ps_max_limits.py


示例20: setUpClass

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.Domain类代码示例发布时间:2022-05-27
下一篇:
Python base.Configurations类代码示例发布时间: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