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


Python DiskOffering.create方法代码示例

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


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

示例1: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        cloudstackTestClient = super(TestResizeVolume,
                                     cls).getClsTestClient()
        cls.api_client = cloudstackTestClient.getApiClient()
        cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
        # Fill services from the external config file
        cls.services = cloudstackTestClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(
            cls.api_client,
            cloudstackTestClient.getZoneForTests())
        cls.services["mode"] = cls.zone.networktype
        cls._cleanup = []
        cls.unsupportedStorageType = False
        if cls.hypervisor.lower() == 'lxc':
            if not find_storage_pool_type(cls.api_client, storagetype='rbd'):
                cls.unsupportedStorageType = True
                return
        cls.resourcetypemapping = {RESOURCE_PRIMARY_STORAGE: 10,
                                   RESOURCE_SECONDARY_STORAGE: 11}

        cls.template = get_template(
            cls.api_client,
            cls.zone.id,
            cls.services["ostype"]
        )

        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = cls.template.id
        cls.services["volume"]["zoneid"] = cls.zone.id

        try:
            cls.hypervisor = str(get_hypervisor_type(cls.api_client)).lower()

            # Creating service offering with normal config
            cls.service_offering = ServiceOffering.create(
                cls.api_client,
                cls.services["service_offering"])
            cls._cleanup.append(cls.service_offering)

            cls.services["disk_offering"]["disksize"] = 5
            cls.disk_offering_5_GB = DiskOffering.create(
                cls.api_client,
                cls.services["disk_offering"]
            )
            cls._cleanup.append(cls.disk_offering_5_GB)

            cls.services["disk_offering"]["disksize"] = 20
            cls.disk_offering_20_GB = DiskOffering.create(
                cls.api_client,
                cls.services["disk_offering"]
            )
            cls._cleanup.append(cls.disk_offering_20_GB)
        except Exception as e:
            cls.tearDownClass()
            raise unittest.SkipTest(
                "Failure while creating disk offering: %s" %
                e)
        return
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:62,代码来源:test_ps_resize_volume.py

示例2: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        testClient = super(TestVolumes, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.services = testClient.getParsedTestDataConfig()
        cls._cleanup = []
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
        cls.services["mode"] = cls.zone.networktype
        cls.hypervisor = testClient.getHypervisorInfo()
        cls.invalidStoragePoolType = False
        cls.disk_offering = DiskOffering.create(cls.apiclient, cls.services["disk_offering"])
        cls.resized_disk_offering = DiskOffering.create(cls.apiclient, cls.services["resized_disk_offering"])
        cls.custom_resized_disk_offering = DiskOffering.create(
            cls.apiclient, cls.services["resized_disk_offering"], custom=True
        )

        template = get_template(cls.apiclient, cls.zone.id, cls.services["ostype"])
        if template == FAILED:
            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]

        cls.services["domainid"] = cls.domain.id
        cls.services["zoneid"] = cls.zone.id
        cls.services["template"] = template.id
        cls.services["diskofferingid"] = cls.disk_offering.id
        cls.services["resizeddiskofferingid"] = cls.resized_disk_offering.id
        cls.services["customresizeddiskofferingid"] = cls.custom_resized_disk_offering.id

        # Create VMs, VMs etc
        cls.account = Account.create(cls.apiclient, cls.services["account"], domainid=cls.domain.id)
        cls.service_offering = ServiceOffering.create(cls.apiclient, cls.services["service_offerings"]["tiny"])
        cls.virtual_machine = VirtualMachine.create(
            cls.apiclient,
            cls.services,
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            mode=cls.services["mode"],
        )
        pools = StoragePool.list(cls.apiclient)
        # cls.assertEqual(
        #         validateList(pools)[0],
        #         PASS,
        #         "storage pool list validation failed")

        cls.volume = Volume.create(cls.apiclient, cls.services, account=cls.account.name, domainid=cls.account.domainid)
        cls._cleanup = [
            cls.resized_disk_offering,
            cls.custom_resized_disk_offering,
            cls.service_offering,
            cls.disk_offering,
            cls.volume,
            cls.account,
        ]
开发者ID:MissionCriticalCloudOldRepos,项目名称:cosmic-core,代码行数:56,代码来源:test_volumes.py

示例3: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):

        cls.testClient = super(TestDeployVMFromISO, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.testdata = cls.testClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())

        cls.template = get_template(
            cls.api_client,
            cls.zone.id,
            cls.testdata["ostype"]
        )

        # Create service, disk offerings  etc
        cls.service_offering = ServiceOffering.create(
            cls.api_client,
            cls.testdata["service_offering"]
        )

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

        cls._cleanup = [
            cls.service_offering,
            cls.disk_offering
        ]
        return
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:34,代码来源:test_deploy_vm_iso.py

示例4: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        testClient = super(TestAttachDataDiskOnCWPS, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.testdata = testClient.getParsedTestDataConfig()
        cls.hypervisor = cls.testClient.getHypervisorInfo()

        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
        cls._cleanup = []
        cls.template = get_template(
            cls.apiclient,
            cls.zone.id,
            cls.testdata["ostype"])
        cls.skiptest = False

        try:
            cls.pools = StoragePool.list(
                cls.apiclient,
                zoneid=cls.zone.id,
                scope="CLUSTER")
        except Exception as e:
            cls.skiptest = True
            return
        try:

            # Create an account
            cls.account = Account.create(
                cls.apiclient,
                cls.testdata["account"],
                domainid=cls.domain.id
            )
            cls._cleanup.append(cls.account)

            # Create user api client of the account
            cls.userapiclient = testClient.getUserApiClient(
                UserName=cls.account.name,
                DomainName=cls.account.domain
            )
            # Create Service offering
            cls.service_offering = ServiceOffering.create(
                cls.apiclient,
                cls.testdata["service_offering"],
            )
            cls._cleanup.append(cls.service_offering)

            # Create Disk offering
            cls.disk_offering = DiskOffering.create(
                cls.apiclient,
                cls.testdata["disk_offering"],
                custom=True,
                tags=CLUSTERTAG1,
            )

            cls._cleanup.append(cls.disk_offering)

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

示例5: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
 def setUpClass(cls):
     cloudstacktestclient = super(TestPrimaryResourceLimitsVolume, cls).getClsTestClient()
     cls.api_client = cloudstacktestclient.getApiClient()
     cls.hypervisor = cloudstacktestclient.getHypervisorInfo()
     # Fill services from the external config file
     cls.services = cloudstacktestclient.getParsedTestDataConfig()
     # Get Zone, Domain and templates
     cls.domain = get_domain(cls.api_client)
     cls.zone = get_zone(cls.api_client, cloudstacktestclient.getZoneForTests())
     cls.services["mode"] = cls.zone.networktype
     cls._cleanup = []
     cls.unsupportedStorageType = False
     cls.template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
     cls.services["virtual_machine"]["zoneid"] = cls.zone.id
     cls.services["virtual_machine"]["template"] = cls.template.id
     cls.services["volume"]["zoneid"] = cls.zone.id
     try:
         cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
         cls.services["disk_offering"]["disksize"] = 2
         cls.disk_offering = DiskOffering.create(cls.api_client, cls.services["disk_offering"])
         cls._cleanup.append(cls.service_offering)
         cls._cleanup.append(cls.disk_offering)
     except Exception as e:
         cls.tearDownClass()
         raise unittest.SkipTest("Exception in setUpClass: %s" % e)
     return
开发者ID:tianshangjun,项目名称:cloudstack,代码行数:28,代码来源:test_ps_resource_limits_volume.py

示例6: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        cls.testClient = super(TestDeployVmWithCustomDisk, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()
        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.services["mode"] = cls.zone.networktype
        cls._cleanup = []
        cls.unsupportedStorageType = False
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        if cls.hypervisor.lower() == "lxc":
            if not find_storage_pool_type(cls.api_client, storagetype="rbd"):
                cls.unsupportedStorageType = True
                return
        cls.disk_offering = DiskOffering.create(cls.api_client, cls.services["disk_offering"], custom=True)
        cls._cleanup.append(cls.disk_offering)
        template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
        cls.services["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = template.id

        # Create VMs, NAT Rules etc
        cls.account = Account.create(cls.api_client, cls.services["account"], domainid=cls.domain.id)
        cls._cleanup.append(cls.account)

        cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
        cls._cleanup.append(cls.service_offering)
开发者ID:bheuvel,项目名称:cloudstack,代码行数:30,代码来源:test_volumes.py

示例7: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        cls.testClient = super(TestVolumes, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.services['mode'] = cls.zone.networktype
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        if cls.hypervisor.lower() == 'lxc':
            if not find_storage_pool_type(cls.api_client, storagetype='rbd'):
                raise unittest.SkipTest("RBD storage type is required for data volumes for LXC")
        cls.disk_offering = DiskOffering.create(
            cls.api_client,
            cls.services["disk_offering"]
        )
        template = get_template(
            cls.api_client,
            cls.zone.id,
            cls.services["ostype"]
        )
        cls.services["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = template.id
        cls.services["virtual_machine"][
            "diskofferingid"] = cls.disk_offering.id

        # Create VMs, VMs etc
        cls.account = Account.create(
            cls.api_client,
            cls.services["account"],
            domainid=cls.domain.id
        )

        cls.service_offering = ServiceOffering.create(
            cls.api_client,
            cls.services["service_offering"]
        )
        cls.virtual_machine = VirtualMachine.create(
            cls.api_client,
            cls.services["virtual_machine"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
        )

        cls.volume = Volume.create(
            cls.api_client,
            cls.services["volume"],
            zoneid=cls.zone.id,
            account=cls.account.name,
            domainid=cls.account.domainid,
            diskofferingid=cls.disk_offering.id
        )
        cls._cleanup = [
            cls.service_offering,
            cls.disk_offering,
            cls.account
        ]
开发者ID:K0zka,项目名称:cloudstack,代码行数:62,代码来源:test_volumes.py

示例8: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        cls.testClient = super(TestSnapshots, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.services["mode"] = cls.zone.networktype
        cls.disk_offering = DiskOffering.create(cls.api_client, cls.services["disk_offering"])
        cls.template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])

        cls.services["domainid"] = cls.domain.id
        cls.services["volume"]["zoneid"] = cls.services["server_with_disk"]["zoneid"] = cls.zone.id
        cls.services["server_with_disk"]["diskoffering"] = cls.disk_offering.id

        cls.services["server_without_disk"]["zoneid"] = cls.zone.id

        cls.services["templates"]["ostypeid"] = cls.template.ostypeid
        cls.services["zoneid"] = cls.zone.id
        cls.services["diskoffering"] = cls.disk_offering.id

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

        # Get Hypervisor Type
        cls.hypervisor = (get_hypervisor_type(cls.api_client)).lower()

        cls._cleanup = [cls.service_offering, cls.disk_offering]
        return
开发者ID:mariocar,项目名称:cloudstack,代码行数:31,代码来源:test_snapshots.py

示例9: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        cls.testClient = super(TestResourceLimitsProject, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        cls.services = Services().services
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.services["mode"] = cls.zone.networktype

        cls.template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
        cls.services["server"]["zoneid"] = cls.zone.id

        # Create Domains, Account etc
        cls.domain = Domain.create(cls.api_client, cls.services["domain"])

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

        cls.userapiclient = cls.testClient.getUserApiClient(UserName=cls.account.name, DomainName=cls.account.domain)

        # Create project as a domain admin
        cls.project = Project.create(
            cls.api_client, cls.services["project"], account=cls.account.name, domainid=cls.account.domainid
        )
        cls.services["account"] = cls.account.name

        # Create Service offering and disk offerings etc
        cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
        cls.disk_offering = DiskOffering.create(cls.api_client, cls.services["disk_offering"])
        cls._cleanup = [cls.project, cls.service_offering, cls.disk_offering, cls.account, cls.domain]
        return
开发者ID:vaddanak,项目名称:challenges,代码行数:31,代码来源:test_project_limits.py

示例10: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        testClient = super(TestMultipleVolumeSnapshots, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.testdata = testClient.getParsedTestDataConfig()

        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        cls.template = get_template(
            cls.apiclient,
            cls.zone.id,
            cls.testdata["ostype"])

        cls._cleanup = []

        cls.skiptest = False

        clus_list = list_clusters(cls.apiclient)

        if cls.hypervisor.lower() not in ['vmware'] or len(clus_list) < 2:
            cls.skiptest = True
            return

        try:
            # Create an account
            cls.account = Account.create(
                cls.apiclient,
                cls.testdata["account"],
                domainid=cls.domain.id
            )

            # Create user api client of the account
            cls.userapiclient = testClient.getUserApiClient(
                UserName=cls.account.name,
                DomainName=cls.account.domain
            )
            # Create Service offering
            cls.service_offering_zwps = ServiceOffering.create(
                cls.apiclient,
                cls.testdata["service_offering"],
                tags=ZONETAG1
            )

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

            cls._cleanup = [
                cls.account,
                cls.service_offering_zwps,
                cls.disk_offering_zwps,
            ]
        except Exception as e:
            cls.tearDownClass()
            raise e
        return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:61,代码来源:testpath_multiple_snapshot.py

示例11: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        testClient = super(TestSnapshotRootDisk, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.services = testClient.getParsedTestDataConfig()

        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
        cls.pod = get_pod(cls.apiclient, cls.zone.id)
        cls.services['mode'] = cls.zone.networktype

        cls.hypervisorNotSupported = False
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ['hyperv', 'lxc'] or 'kvm-centos6' in cls.testClient.getZoneForTests():
            cls.hypervisorNotSupported = True

        cls._cleanup = []
        if not cls.hypervisorNotSupported:
            cls.template = get_test_template(cls.apiclient, cls.zone.id, cls.hypervisor)
            if cls.template == FAILED:
                assert False, "get_test_template() failed to return template"

            cls.services["domainid"] = cls.domain.id
            cls.services["small"]["zoneid"] = cls.zone.id
            cls.services["templates"]["ostypeid"] = cls.template.ostypeid
            cls.services["zoneid"] = cls.zone.id

            # Create VMs, NAT Rules etc
            cls.account = Account.create(
                cls.apiclient,
                cls.services["account"],
                domainid=cls.domain.id
            )
            cls.service_offering = ServiceOffering.create(
                cls.apiclient,
                cls.services["service_offerings"]["tiny"]
            )
            cls.disk_offering = DiskOffering.create(
                cls.apiclient,
                cls.services["disk_offering"]
            )
            cls.virtual_machine = cls.virtual_machine_with_disk = \
                VirtualMachine.create(
                    cls.apiclient,
                    cls.services["small"],
                    templateid=cls.template.id,
                    accountid=cls.account.name,
                    domainid=cls.account.domainid,
                    zoneid=cls.zone.id,
                    serviceofferingid=cls.service_offering.id,
                    mode=cls.services["mode"]
                )

            cls._cleanup.append(cls.service_offering)
            cls._cleanup.append(cls.account)
            cls._cleanup.append(cls.disk_offering)
        return
开发者ID:PCextreme,项目名称:cloudstack,代码行数:59,代码来源:test_snapshots.py

示例12: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        cls.testClient = super(TestVolumes, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.services['mode'] = cls.zone.networktype
        cls._cleanup = []
        cls.unsupportedStorageType = False
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        cls.disk_offering = DiskOffering.create(
            cls.api_client,
            cls.services["disk_offering"]
        )
        cls._cleanup.append(cls.disk_offering)
        template = get_template(
            cls.api_client,
            cls.zone.id,
            cls.services["ostype"]
        )
        cls.services["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = template.id
        cls.services["virtual_machine"][
            "diskofferingid"] = cls.disk_offering.id

        # Create VMs, VMs etc
        cls.account = Account.create(
            cls.api_client,
            cls.services["account"],
            domainid=cls.domain.id
        )
        cls._cleanup.append(cls.account)

        cls.service_offering = ServiceOffering.create(
            cls.api_client,
            cls.services["service_offering"]
        )
        cls._cleanup.append(cls.service_offering)
        cls.virtual_machine = VirtualMachine.create(
            cls.api_client,
            cls.services["virtual_machine"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
        )

        cls.volume = Volume.create(
            cls.api_client,
            cls.services["volume"],
            zoneid=cls.zone.id,
            account=cls.account.name,
            domainid=cls.account.domainid,
            diskofferingid=cls.disk_offering.id
        )
开发者ID:miguelaferreira,项目名称:cosmic-core,代码行数:59,代码来源:test_volumes.py

示例13: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        cls.testClient = super(TestSnapshotOnRootVolume, cls).getClsTestClient()
        cls.api_client = cls.testClient.getApiClient()
        cls._cleanup = []

        cls.services = Services().services
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.api_client)
        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
        cls.unsupportedHypervisor = False
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ['hyperv', 'lxc']:
            cls.unsupportedHypervisor = True
            return
        cls.template = get_template(
                                    cls.api_client,
                                    cls.zone.id,
                                    cls.services["ostype"])
        cls.account = Account.create(cls.api_client,
                                     cls.services["account"],
                                     domainid=cls.domain.id)
        cls.service_offering = ServiceOffering.create(
                                            cls.api_client,
                                            cls.services["service_offering"])
        cls.disk_offering = DiskOffering.create(
                                    cls.api_client,
                                    cls.services["disk_offering"],
                                    domainid=cls.domain.id)
        cls.service_offering2 = ServiceOffering.create(
                                            cls.api_client,
                                            cls.services["service_offering2"])
        cls.disk_offering2 = DiskOffering.create(
                                    cls.api_client,
                                    cls.services["disk_offering2"],
                                    domainid=cls.domain.id)

        cls._cleanup = [cls.account,
                        cls.service_offering,
                        cls.disk_offering,
                        cls.service_offering2,
                        cls.disk_offering2]
开发者ID:Accelerite,项目名称:cloudstack,代码行数:43,代码来源:test_snapshots_improvement.py

示例14: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        try:
            cls._cleanup = []
            cls.testClient = super(TestInstance, cls).getClsTestClient()
            cls.api_client = cls.testClient.getApiClient()
            cls.services = cls.testClient.getParsedTestDataConfig()
            # Get Domain, Zone, Template
            cls.domain = get_domain(cls.api_client)
            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
            cls.template = get_template(
                cls.api_client,
                cls.zone.id,
                cls.services["ostype"]
            )
            if cls.zone.localstorageenabled:
                cls.storagetype = 'local'
                cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
                cls.services["disk_offering"]["storagetype"] = 'local'
            else:
                cls.storagetype = 'shared'
                cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
                cls.services["disk_offering"]["storagetype"] = 'shared'

            cls.services['mode'] = cls.zone.networktype
            cls.services["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
            cls.services["virtual_machine"]["zoneid"] = cls.zone.id
            cls.services["virtual_machine"]["template"] = cls.template.id
            cls.services["custom_volume"]["zoneid"] = cls.zone.id
            # Creating Disk offering, Service Offering and Account
            cls.disk_offering = DiskOffering.create(
                cls.api_client,
                cls.services["disk_offering"]
            )
            cls.service_offering = ServiceOffering.create(
                cls.api_client,
                cls.services["service_offerings"]["small"]
            )
            cls.account = Account.create(
                cls.api_client,
                cls.services["account"],
                domainid=cls.domain.id
            )
            # Getting authentication for user in newly created Account
            cls.user = cls.account.user[0]
            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
            cls._cleanup.append(cls.disk_offering)
            cls._cleanup.append(cls.service_offering)
            cls._cleanup.append(cls.account)
            cls.mgtSvrDetails = cls.config.__dict__["mgtSvr"][0].__dict__
        except Exception as e:
            cls.tearDownClass()
            raise Exception("Warning: Exception in setup : %s" % e)
        return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:55,代码来源:test_escalations_instances.py

示例15: setUpClass

# 需要导入模块: from marvin.lib.base import DiskOffering [as 别名]
# 或者: from marvin.lib.base.DiskOffering import create [as 别名]
    def setUpClass(cls):
        testClient = super(TestMultipleVolumeAttach, cls).getClsTestClient()
        cls.apiclient = testClient.getApiClient()
        cls.services = testClient.getParsedTestDataConfig()
        cls._cleanup = []
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
        cls.services["mode"] = cls.zone.networktype
        cls.hypervisor = testClient.getHypervisorInfo()
        cls.invalidStoragePoolType = False

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

        template = get_template(cls.apiclient, cls.zone.id, cls.services["ostype"])
        if template == FAILED:
            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]

        cls.services["domainid"] = cls.domain.id
        cls.services["zoneid"] = cls.zone.id
        cls.services["template"] = template.id
        cls.services["diskofferingid"] = cls.disk_offering.id

        # Create VMs, VMs etc
        cls.account = Account.create(cls.apiclient, cls.services["account"], domainid=cls.domain.id)
        cls.service_offering = ServiceOffering.create(cls.apiclient, cls.services["service_offering"])
        cls.virtual_machine = VirtualMachine.create(
            cls.apiclient,
            cls.services,
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering.id,
            mode=cls.services["mode"],
        )

        # Create volumes (data disks)
        cls.volume1 = Volume.create(
            cls.apiclient, cls.services, account=cls.account.name, domainid=cls.account.domainid
        )

        cls.volume2 = Volume.create(
            cls.apiclient, cls.services, account=cls.account.name, domainid=cls.account.domainid
        )

        cls.volume3 = Volume.create(
            cls.apiclient, cls.services, account=cls.account.name, domainid=cls.account.domainid
        )

        cls.volume4 = Volume.create(
            cls.apiclient, cls.services, account=cls.account.name, domainid=cls.account.domainid
        )
        cls._cleanup = [cls.service_offering, cls.disk_offering, cls.account]
开发者ID:MissionCriticalCloudOldRepos,项目名称:cosmic-core,代码行数:54,代码来源:test_simultaneous_volume_attach.py


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