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

Python base.Resources类代码示例

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

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



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

示例1: setupAccounts

    def setupAccounts(self, account_limit=2, domain_limit=2, project_limit=2):

        self.debug("Creating a domain under: %s" % self.domain.name)
        self.child_domain = Domain.create(self.apiclient,
            services=self.testdata["domain"],
            parentdomainid=self.domain.id)

        self.debug("domain crated with domain id %s" % self.child_domain.id)

        self.child_do_admin = Account.create(self.apiclient,
            self.testdata["account"],
            admin=True,
            domainid=self.child_domain.id)

        self.debug("domain admin created for domain id %s" %
                   self.child_do_admin.domainid)

        # Create project as a domain admin
        self.project = Project.create(self.apiclient,
            self.testdata["project"],
            account=self.child_do_admin.name,
            domainid=self.child_do_admin.domainid)
        # Cleanup created project at end of test
        self.cleanup.append(self.project)

        # Cleanup accounts created
        self.cleanup.append(self.child_do_admin)
        self.cleanup.append(self.child_domain)

        self.debug("Updating the CPU resource count for domain: %s" %
                   self.child_domain.name)
        # Update resource limits for account 1
        responses = Resources.updateLimit(self.apiclient,
            resourcetype=8,
            max=account_limit,
            account=self.child_do_admin.name,
            domainid=self.child_do_admin.domainid)

        self.debug("CPU Resource count for child domain admin account is now: %s" %
                   responses.max)

        self.debug("Updating the CPU limit for project")
        responses = Resources.updateLimit(self.apiclient,
            resourcetype=8,
            max=project_limit,
            projectid=self.project.id)

        self.debug("CPU Resource count for project is now")
        self.debug(responses.max)

        self.debug("Updating the CPU limit for domain only")
        responses = Resources.updateLimit(self.apiclient,
            resourcetype=8,
            max=domain_limit,
            domainid=self.child_domain.id)

        self.debug("CPU Resource count for domain %s with id %s is now %s" %
                   (responses.domain, responses.domainid, responses.max))

        return
开发者ID:PCextreme,项目名称:cloudstack,代码行数:60,代码来源:test_cpu_max_limits.py


示例2: setupAccounts

    def setupAccounts(self):

        self.debug("Creating a sub-domain under: %s" % self.domain.name)

        self.child_domain = Domain.create(
            self.apiclient, services=self.services["domain"], parentdomainid=self.domain.id
        )
        self.child_do_admin = Account.create(
            self.apiclient, self.services["account"], admin=True, domainid=self.child_domain.id
        )
        # Cleanup the resources created at end of test
        self.cleanup.append(self.child_do_admin)
        self.cleanup.append(self.child_domain)

        Resources.updateLimit(
            self.apiclient,
            resourcetype=8,
            max=16,
            account=self.child_do_admin.name,
            domainid=self.child_do_admin.domainid,
        )

        self.domain = Domain.create(self.apiclient, services=self.services["domain"], parentdomainid=self.domain.id)

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

        # Cleanup the resources created at end of test
        self.cleanup.append(self.admin)
        self.cleanup.append(self.domain)

        Resources.updateLimit(
            self.apiclient, resourcetype=8, max=16, account=self.admin.name, domainid=self.admin.domainid
        )
        return
开发者ID:tianshangjun,项目名称:cloudstack,代码行数:34,代码来源:test_cpu_domain_limits.py


示例3: setupAccounts

    def setupAccounts(self):

        self.debug("Creating a domain under: %s" % self.domain.name)
        self.parent_domain = Domain.create(
            self.apiclient, services=self.services["domain"], parentdomainid=self.domain.id
        )
        self.parentd_admin = Account.create(
            self.apiclient, self.services["account"], admin=True, domainid=self.domain.id
        )

        self.debug("Updating the Memory resource count for domain: %s" % self.domain.name)
        Resources.updateLimit(
            self.apiclient,
            resourcetype=9,
            max=4096,
            account=self.parentd_admin.name,
            domainid=self.parentd_admin.domainid,
        )
        self.debug("Creating a sub-domain under: %s" % self.parent_domain.name)
        self.cdomain_1 = Domain.create(
            self.apiclient, services=self.services["domain"], parentdomainid=self.parent_domain.id
        )

        self.debug("Creating a sub-domain under: %s" % self.parent_domain.name)
        self.cdomain_2 = Domain.create(
            self.apiclient, services=self.services["domain"], parentdomainid=self.parent_domain.id
        )

        self.cadmin_1 = Account.create(self.apiclient, self.services["account"], admin=True, domainid=self.cdomain_1.id)

        self.debug("Updating the Memory resource count for domain: %s" % self.cdomain_1.name)
        Resources.updateLimit(self.apiclient, resourcetype=9, max=2048, domainid=self.cadmin_1.domainid)

        self.debug("Updating the Memory resource count for account: %s" % self.cadmin_1.name)
        Resources.updateLimit(
            self.apiclient, resourcetype=9, max=2048, account=self.cadmin_1.name, domainid=self.cadmin_1.domainid
        )

        self.cadmin_2 = Account.create(self.apiclient, self.services["account"], admin=True, domainid=self.cdomain_2.id)

        self.debug("Updating the Memory resource count for domain: %s" % self.cdomain_2.name)
        Resources.updateLimit(self.apiclient, resourcetype=9, max=2048, domainid=self.cadmin_2.domainid)

        self.debug("Updating the Memory resource count for domain: %s" % self.cadmin_2.name)
        Resources.updateLimit(
            self.apiclient, resourcetype=9, max=2048, account=self.cadmin_2.name, domainid=self.cadmin_2.domainid
        )

        # Cleanup the resources created at end of test
        self.cleanup.append(self.cadmin_1)
        self.cleanup.append(self.cadmin_2)
        self.cleanup.append(self.cdomain_1)
        self.cleanup.append(self.cdomain_2)
        self.cleanup.append(self.parentd_admin)
        self.cleanup.append(self.parent_domain)

        users = {self.parent_domain: self.parentd_admin, self.cdomain_1: self.cadmin_1, self.cdomain_2: self.cadmin_2}
        return users
开发者ID:tianshangjun,项目名称:cloudstack,代码行数:58,代码来源:test_mm_domain_limits.py


示例4: test_10_max_account_limit

    def test_10_max_account_limit(self):
        """ Positive test for stopped VM test path - T12

        # 1.  Create an account in root domain and set the VM limit
        #     to max 2 VMs
        # 2.  Deploy two VMs in the account with startvm parameter
        #     as false
        # 3.  Deployment of both VMs should be successful
        # 4.  Try to deploy 3rd VM with startvm False, deployment should fail
        """

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

        Resources.updateLimit(self.apiclient, resourcetype=0, max=2, account=account.name, domainid=account.domainid)

        VirtualMachine.create(
            self.apiclient,
            self.testdata["small"],
            templateid=self.defaultTemplateId,
            accountid=account.name,
            domainid=account.domainid,
            serviceofferingid=self.service_offering.id,
            zoneid=self.zone.id,
            startvm=False,
            mode=self.zone.networktype,
        )

        VirtualMachine.create(
            self.apiclient,
            self.testdata["small"],
            templateid=self.defaultTemplateId,
            accountid=account.name,
            domainid=account.domainid,
            serviceofferingid=self.service_offering.id,
            zoneid=self.zone.id,
            startvm=False,
            mode=self.zone.networktype,
        )

        with self.assertRaises(Exception):
            VirtualMachine.create(
                self.apiclient,
                self.testdata["small"],
                templateid=self.defaultTemplateId,
                accountid=account.name,
                domainid=account.domainid,
                serviceofferingid=self.service_offering.id,
                zoneid=self.zone.id,
                startvm=False,
                mode=self.zone.networktype,
            )
        return
开发者ID:Cormoran96,项目名称:cloudstack,代码行数:54,代码来源:testpath_stopped_vm.py


示例5: updateResourceLimits

    def updateResourceLimits(self, accountLimit=None, domainLimit=None):
        """Update primary storage limits of the parent domain and its
        child domains"""

        try:
            if domainLimit:
                #Update resource limit for domain
                Resources.updateLimit(self.apiclient, resourcetype=10,
                              max=domainLimit,
                              domainid=self.parent_domain.id)
            if accountLimit:
                #Update resource limit for domain
                Resources.updateLimit(self.apiclient, resourcetype=10,
                              max=accountLimit, account=self.parentd_admin.name,
                              domainid=self.parent_domain.id)
        except Exception as e:
            return [FAIL, e]
        return [PASS, None]
开发者ID:Skotha,项目名称:cloudstack,代码行数:18,代码来源:test_ps_resize_volume.py


示例6: update_resource_count

def update_resource_count(apiclient, domainid, accountid=None, projectid=None, rtype=None):
    """updates the resource count
        0     - VM
        1     - Public IP
        2     - Volume
        3     - Snapshot
        4     - Template
        5     - Projects
        6     - Network
        7     - VPC
        8     - CPUs
        9     - RAM
        10    - Primary (shared) storage (Volumes)
        11    - Secondary storage (Snapshots, Templates & ISOs)
    """

    Resources.updateCount(
        apiclient,
        domainid=domainid,
        account=accountid if accountid else None,
        projectid=projectid if projectid else None,
        resourcetype=rtype if rtype else None,
    )
    return
开发者ID:rafaelthedevops,项目名称:cloudstack,代码行数:24,代码来源:common.py


示例7: isDomainResourceCountEqualToExpectedCount

def isDomainResourceCountEqualToExpectedCount(apiclient, domainid, expectedcount, resourcetype):
    """Get the resource count of specific domain and match
    it with the expected count
    Return list [isExceptionOccured, reasonForException, isResourceCountEqual]"""
    isResourceCountEqual = False
    isExceptionOccured = False
    reasonForException = None
    try:
        response = Resources.updateCount(apiclient, domainid=domainid, resourcetype=resourcetype)
    except Exception as e:
        reasonForException = "Failed while updating resource count: %s" % e
        isExceptionOccured = True
        return [isExceptionOccured, reasonForException, isResourceCountEqual]

    resourcecount = response[0].resourcecount / (1024 ** 3)
    if resourcecount == expectedcount:
        isResourceCountEqual = True
    return [isExceptionOccured, reasonForException, isResourceCountEqual]
开发者ID:rafaelthedevops,项目名称:cloudstack,代码行数:18,代码来源:common.py


示例8: updateDomainResourceLimits

    def updateDomainResourceLimits(self, parentdomainlimit, subdomainlimit):
        """Update primary storage limits of the parent domain and its
        child domains"""

        try:
            # Update resource limit for domain
            Resources.updateLimit(
                self.apiclient, resourcetype=10, max=parentdomainlimit, domainid=self.parent_domain.id
            )

            # Update Resource limit for sub-domains
            Resources.updateLimit(self.apiclient, resourcetype=10, max=subdomainlimit, domainid=self.cadmin_1.domainid)

            Resources.updateLimit(self.apiclient, resourcetype=10, max=subdomainlimit, domainid=self.cadmin_2.domainid)
        except Exception as e:
            return [FAIL, e]
        return [PASS, None]
开发者ID:rafaelthedevops,项目名称:cloudstack,代码行数:17,代码来源:test_ps_domain_limits.py


示例9: updateSecondaryStorageLimits

    def updateSecondaryStorageLimits(self, accountLimit=None, domainLimit=None, projectLimit=None):

        try:
            # Update resource limits for account
            if accountLimit:
                Resources.updateLimit(self.apiclient, resourcetype=11,
                                max=accountLimit, account=self.child_do_admin.name,
                                domainid=self.child_do_admin.domainid)

            if projectLimit:
                Resources.updateLimit(self.apiclient, resourcetype=11,
                                              max=projectLimit, projectid=self.project.id)

            if domainLimit:
                Resources.updateLimit(self.apiclient, resourcetype=11,
                                              max=domainLimit, domainid=self.child_domain.id)
        except Exception as e:
            return [FAIL, e]
        return [PASS, None]
开发者ID:Skotha,项目名称:cloudstack,代码行数:19,代码来源:test_ss_max_limits.py


示例10: test_04_deploy_multiple_vm

    def test_04_deploy_multiple_vm(self):
        """Test Deploy multiple VM with 2 GB memory & verify the usage"""
	    #keep the configuration value - max.account.memory = 8192 (maximum 4 instances per account with 2 GB RAM)

        # Validate the following
        # 1. Create compute offering with 2 GB RAM
        # 2. Deploy multiple VMs with this service offering in child domains of root domain
        # 3. List Resource count for the root admin Memory usage
        # 4. Memory usage should list properly

        self.debug("Creating service offering with 2 GB RAM")
        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()
        users = {self.child_domain_1: self.child_do_admin_1,
                 self.child_domain_2: self.child_do_admin_2
                 }
        for domain, admin in users.items():
            self.account = admin
            self.domain = domain

            memory_account_gc = Resources.list(self.apiclient,
                                resourcetype = 9, #Memory
                                account = self.account.name,
                                domainid = self.domain.id
                                )

            if memory_account_gc[0].max != 8192:
                self.skipTest("This test case requires configuration value max.account.memory to be 8192")

	        api_client = self.testClient.getUserApiClient(
                             UserName=self.account.name,
                             DomainName=self.account.domain)

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

            self.debug("Deploying instance - memory capacity is fully utilized")
            with self.assertRaises(Exception):
                self.createInstance(service_off=self.service_offering, api_client=api_client)

            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].memorytotal

            expected_resource_count = int(self.services["service_offering"]["memory"]) * 4 #Total 4 vms

            self.assertEqual(resource_count, expected_resource_count,
                         "Initial resource count should with the expected resource count")

            self.debug("Destroying instance: %s" % vm_1.name)
            try:
                vm_1.delete(self.apiclient)
            except Exception as e:
                self.fail("Failed to delete instance: %s" % e)

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

            expected_resource_count -= int(self.services["service_offering"]["memory"])

            self.assertEqual(resource_count_after_delete, expected_resource_count,
                         "Resource count should match with the expected resource count")

            host = findSuitableHostForMigration(self.apiclient, vm_2.id)
            if host is None:
                self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
            self.debug("Migrating instance: %s to host: %s" % (vm_2.name,
                                                               host.name))
            try:
                vm_2.migrate(self.apiclient, host.id)
            except Exception as e:
                self.fail("Failed to migrate instance: %s" % e)

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

            self.debug(resource_count_after_migrate)
            self.assertEqual(resource_count_after_delete, resource_count_after_migrate,
#.........这里部分代码省略.........
开发者ID:MANIKANDANVEN,项目名称:cloudstack,代码行数:101,代码来源:test_memory_limits.py


示例11: test_01_storage_snapshots_limits


#.........这里部分代码省略.........
            secStorageAfterSnapshotCreated,
            "Secondary storage Total after Snapshot\
                        should be incremented by size of snapshot.")

        # Step 3
        snapshot.delete(self.apiclient)

        snapshots_list = Snapshot.list(self.userapiclient,
                                       id=snapshot.id)

        status = validateList(snapshots_list)
        self.assertEqual(status[0], FAIL, "Snapshots Not Deleted.")

        # Step 4
        qryresult_after_snapshot_deleted = self.dbclient.execute(
            " select id, account_name, secondaryStorageTotal\
                        from account_view where account_name = '%s';" %
            self.account.name)

        status = validateList(qryresult_after_snapshot_deleted)
        self.assertEqual(
            status[0],
            PASS,
            "Check sql query to return SecondaryStorageTotal of account")

        secStorageAfterSnapshotDeleted = qryresult_after_snapshot_deleted[0][2]

        secStorageDecreased = secStorageAfterSnapshotCreated - \
            snapshot_size

        self.assertEqual(
            secStorageDecreased,
            secStorageAfterSnapshotDeleted,
            "Secondary storage Total after Snapshot\
                        should be incremented by size of snapshot.")

        # Step 5
        # Set Snapshot Limit for account
        Resources.updateLimit(self.apiclient, resourcetype=3,
                              max=1, account=self.account.name,
                              domainid=self.account.domainid)

        # Step 6
        snapshot = Snapshot.create(
            self.userapiclient,
            root_volume.id)

        snapshots_list = Snapshot.list(self.userapiclient,
                                       id=snapshot.id)

        status = validateList(snapshots_list)
        self.assertEqual(status[0], PASS, "Snapshots List Validation Failed")

        # Verify Snapshot state
        self.assertEqual(
            snapshots_list[0].state.lower() in [
                BACKED_UP,
            ],
            True,
            "Snapshot state is not as expected. It is %s" %
            snapshots_list[0].state
        )

        # Step 7
        with self.assertRaises(Exception):
            Snapshot.create(
                self.userapiclient,
                self.data_volume.id)

        # Step 8
        snapshot.delete(self.userapiclient)

        snapshots_list = Snapshot.list(self.userapiclient,
                                       id=snapshot.id)

        status = validateList(snapshots_list)
        self.assertEqual(status[0], FAIL, "Snapshots Not Deleted.")

        # Step 9
        snapshot = Snapshot.create(
            self.userapiclient,
            root_volume.id)

        snapshots_list = Snapshot.list(self.userapiclient,
                                       id=snapshot.id)

        status = validateList(snapshots_list)
        self.assertEqual(status[0], PASS, "Snapshots List Validation Failed")

        # Verify Snapshot state
        self.assertEqual(
            snapshots_list[0].state.lower() in [
                BACKED_UP,
            ],
            True,
            "Snapshot state is not as expected. It is %s" %
            snapshots_list[0].state
        )

        return
开发者ID:franklouwers,项目名称:cloudstack,代码行数:101,代码来源:testpath_snapshot_limits.py


示例12: test_02_negative_path


#.........这里部分代码省略.........
            self.volume.id)
        self.debug(
            "volume id %s got created successfully" %
            list_data_volume[0].id)
        # try  Attach volume to vm2
        try:
            self.virtual_machine_2.attach_volume(self.userapiclient,
                                                 self.volume
                                                 )
            self.fail("Volume got attached to a destroyed vm ")
        except Exception:
            self.debug("Volume cant not be attached to a destroyed vm ")

        # 11.Upload the volume  by providing the URL of the downloaded
        # volume, but specify a wrong format (not supported by the hypervisor)
        if "OVA" in self.extract_volume.url.upper():
            self.testdata["configurableData"]["upload_volume"]["format"] = "VHD"
        else:
            self.testdata["configurableData"]["upload_volume"]["format"] = "OVA"
        try:
            self.upload_response = Volume.upload(
                self.userapiclient,
                zoneid=self.zone.id,
                url=self.extract_volume.url,
                services=self.testdata["configurableData"]["upload_volume"])
            self.fail("Volume got uploaded with invalid format")
        except Exception as e:
            self.debug("upload volume failed due %s" % e)
        # 12. Upload the same volume from T4 by providing a wrong URL
        self.testdata["configurableData"]["upload_volume"]["format"] = "VHD"
        if "OVA" in self.extract_volume.url.upper():
            self.testdata["configurableData"]["upload_volume"]["format"] = "OVA"
        if "QCOW2" in self.extract_volume.url.upper():
            self.testdata["configurableData"]["upload_volume"]["format"] = "QCOW2"
        u1 = self.extract_volume.url.split('.')
        u1[-2] = "wrong"
        wrong_url = ".".join(u1)
        try:
            self.upload_response = Volume.upload(
                self.userapiclient,
                zoneid=self.zone.id,
                url=wrong_url,
                services=self.testdata["configurableData"]["upload_volume"])
            self.upload_response.wait_for_upload(self.userapiclient
                                                 )
            self.fail("volume got uploaded with wrong url")
        except Exception as e:
            self.debug("upload volume failed due to %s" % e)
        # 13.Upload volume, provide wrong checksum
        try:
            self.upload_response = Volume.upload(
                self.userapiclient,
                zoneid=self.zone.id,
                url=self.extract_volume.url,
                services=self.testdata["configurableData"]["upload_volume"],
                checksome="123456")
            self.upload_response.wait_for_upload(self.userapiclient
                                                 )
            self.fail("volume got uploaded with wrong checksome")
        except Exception as e:
            self.debug("upload volume failed due to %s" % e)

        # 14.Upload a volume when maximum limit for the account is reached
        account_update = Resources.updateLimit(self.apiclient,
                                               resourcetype=2,
                                               account=self.account.name,
                                               domainid=self.account.domainid,
                                               max=1
                                               )
        list_resource = Resources.list(self.apiclient,
                                       account=self.account.name,
                                       domainid=self.account.domainid,
                                       resourcetype=2
                                       )
        self.assertEqual(
            validateList(list_resource)[0],
            PASS,
            "Check List resource response for volume %s" %
            self.account.name)
        self.assertEqual(
            str(
                list_resource[0].max),
            '1',
            "check list List resource response for account id:  %s" %
            self.account.name)
        self.debug(
            "Max resources got updated successfully for account %s" %
            self.account.name)
        try:
            self.upload_response = Volume.upload(
                self.userapiclient,
                zoneid=self.zone.id,
                url=self.extract_volume.url,
                services=self.testdata["configurableData"]["upload_volume"])
            self.upload_response.wait_for_upload(self.userapiclient
                                                 )
            self.fail("volume got uploaded after account reached max limit for\
                      volumes ")
        except Exception as e:
            self.debug("upload volume failed due to %s" % e)
开发者ID:K0zka,项目名称:cloudstack,代码行数:101,代码来源:testpath_volumelifecycle.py


示例13: test_01_updateResourceCount

    def test_01_updateResourceCount(self):
        """Test update resource count for an account using a custom service offering to deploy a VM.
        """
        
        # This test will execute the following steps to assure resource count update is working properly
        # 1. Create an account.
        # 2. Start 2 VMs; one with normal service offering and other with a custom service offering
        # 3. Call the update resource count method and check the CPU and memory values.
        #    The two VMs will add up to 3 CPUs and 1024Mb of RAM.
        # 4. If the return of updateResourceCount method matches with the expected one, the test passes; otherwise, it fails.
        # 5. Remove everything created by deleting the account
        
        vm_1 = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_custom.id,
            customcpunumber = 1,
            customcpuspeed = 1000,
            custommemory = 512
        )
        
        self.debug("Deployed VM 1 in account: %s, ID: %s" % (
            self.account.name,
            vm_1.id
        ))
        
        vm_2 = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_normal.id
        )
        self.debug("Deployed VM 2 in account: %s, ID: %s" % (
            self.account.name,
            vm_2.id
        ))

        resourceCountCpu = Resources.updateCount(
            self.apiclient,
            resourcetype=8,
            account=self.account.name,
            domainid=self.account.domainid
        ) 
            
        self.debug("ResourceCount for CPU: %s" % (
            resourceCountCpu[0].resourcecount
        ))
        self.assertEqual(
            resourceCountCpu[0].resourcecount,
            3,
            "The number of CPU cores does not seem to be right."
        )
        resourceCountMemory = Resources.updateCount(
            self.apiclient,
            resourcetype=9,
            account=self.account.name,
            domainid=self.account.domainid
        ) 
            
        self.debug("ResourceCount for memory: %s" % (
            resourceCountMemory[0].resourcecount
        ))
        self.assertEqual(
            resourceCountMemory[0].resourcecount,
            1024,
            "The memory amount does not seem to be right."
        )
        return
开发者ID:PCextreme,项目名称:cloudstack,代码行数:71,代码来源:test_updateResourceCount.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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