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


Python Host.update方法代码示例

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


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

示例1: setUpClass

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
    def setUpClass(cls):
        cls.testClient = super(TestHostsForMigration, 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.template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])

        clusterWithSufficientHosts = None
        clusters = Cluster.list(cls.api_client, zoneid=cls.zone.id)
        for cluster in clusters:
            cls.hosts = Host.list(cls.api_client, clusterid=cluster.id, type="Routing")
            if len(cls.hosts) >= 2:
                clusterWithSufficientHosts = cluster
                break

        if clusterWithSufficientHosts is None:
            raise unittest.SkipTest("No Cluster with 2 hosts found")

        Host.update(cls.api_client, id=cls.hosts[1].id, hosttags="PREMIUM")

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

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

        cls._cleanup = [cls.service_offering_with_tag]
        return
开发者ID:tianshangjun,项目名称:cloudstack,代码行数:35,代码来源:find_hosts_for_migration.py

示例2: tearDown

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
    def tearDown(self):
        try:
            for host in self.hosts:
                Host.update(self.apiclient, id=host.id, hosttags="")

            cleanup_resources(self.apiclient, self.cleanup)
        except Exception as e:
            self.debug("Warning! Exception in tearDown: %s" % e)
开发者ID:aali-dincloud,项目名称:cloudstack,代码行数:10,代码来源:test_vm_ha.py

示例3: tearDown

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
    def tearDown(self):
        try:
            for host in self.hosts:
                Host.update(self.apiclient, id=host.id, hosttags="")

            cleanup_resources(self.apiclient, self.cleanup)
        except Exception as e:
            raise Exception("Warning: Exception during cleanup : %s" % e)
开发者ID:Accelerite,项目名称:cloudstack,代码行数:10,代码来源:test_vm_ha.py

示例4: tearDownClass

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
 def tearDownClass(cls):
     try:
         # Remove the host from HA
         Host.update(cls.api_client, id=cls.hosts[2].id, hosttags="")
         #Cleanup resources used
         cleanup_resources(cls.api_client, cls._cleanup)
     except Exception as e:
         raise Exception("Warning: Exception during cleanup : %s" % e)
     return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:11,代码来源:test_host_high_availability.py

示例5: tearDownClass

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
 def tearDownClass(cls):
     try:
         # Delete the host tags
         Host.update(cls.api_client, id=cls.hosts[0].id, hosttags="")
         Host.update(cls.api_client, id=cls.hosts[1].id, hosttags="")
         cls.account.delete(cls.api_client)
         wait_for_cleanup(cls.api_client, ["account.cleanup.interval"])
         # Cleanup resources used
         cleanup_resources(cls.api_client, cls._cleanup)
         cls.vpc_off.delete(cls.api_client)
     except Exception as e:
         raise Exception("Warning: Exception during cleanup : %s" % e)
     return
开发者ID:mariocar,项目名称:cloudstack,代码行数:15,代码来源:test_vpc_host_maintenance.py

示例6: update_host

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
def update_host(self, state, host_id):
    """
    Function to Enable/Disable Host
    """
    host_status = Host.update(
                                  self.apiclient,
                                  id=host_id,
                                  allocationstate=state
                                 )
    return host_status.resourcestate
开发者ID:alena1108,项目名称:cloudstack,代码行数:12,代码来源:test_escalations_hosts.py

示例7: test_01_enable_maintenance_with_vpc_nw

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
    def test_01_enable_maintenance_with_vpc_nw(self):
        """ Test enable Maintenance Mode on Hosts which have VPC elements
        """

        # Validate the following
        # 1. Create a VPC with cidr - 10.1.1.1/16
        # 2. Add network1(10.1.1.1/24) and network2(10.1.2.1/24) to this VPC.
        # 3. Deploy vm1 and vm2 in network1 and vm3 and vm4 in network2. Make
        #    sure vm1 and vm3 are deployed on one host in the cluster while
        #    vm2 and vm4 are deployed on the other host in the cluster. This
        #    can be done using host's tags & service offerings with host tags
        # Steps:
        # 1.Enable Maintenance on one of host on which VPCVR is present
        # Validations:
        # 1. Successfully push the host into maintenance mode.
        # 2. VMs present on the above host should successfully migrate to the
        #    other host present in the cluster

        Host.update(self.apiclient, id=self.hosts[0].id, hosttags="hosttag1,hosttag2")
        Host.update(self.apiclient, id=self.hosts[1].id, hosttags="hosttag1,hosttag2")

        self.validate_vm_deployment()
        self.debug("Stop the host on which the VPC virtual router is running")
        try:
            Host.enableMaintenance(self.apiclient, id=self.vpcvr.hostid)
        except Exception as e:
            self.fail("Failed to enable maintenance mode on host: %s" % e)

        self.debug("Check if all instances belonging to the account are up again?")
        routers = Router.list(self.apiclient, account=self.account.name, domainid=self.account.domainid, listall=True)
        self.assertEqual(isinstance(routers, list), True, "List routers shall return a valid VPCVR for account")

        router = routers[0]

        try:

            timeout = self.services["timeout"]
            self.debug("Timeout Value %d : " % timeout)
            while True:
                list_router_response = Router.list(self.apiclient, id=router.id, state="Running")

                if list_router_response is not None:
                    break
                elif timeout == 0:
                    raise Exception("Router state should be running after migration")

                time.sleep(self.services["sleep"])
                timeout = timeout - 1
                self.debug("Waiting for %d seconds - %d tries left" % (self.services["sleep"], timeout))

            self.debug("Verified that the Router is in Running State")

        except Exception as e:
            self.fail("Failed to find the Router in Running state %s " % e)

        vms = VirtualMachine.list(
            self.apiclient, account=self.account.name, domainid=self.account.domainid, listall=True
        )
        self.assertEqual(isinstance(vms, list), True, "VM response should return instances running for account")
        for vm in vms:
            self.assertEqual(vm.state, "Running", "Vm state should be running after migration")
        return
开发者ID:mariocar,项目名称:cloudstack,代码行数:64,代码来源:test_vpc_host_maintenance.py

示例8: setUpClass

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
    def setUpClass(cls):
        cls.testClient = super(TestVMLifeCycleHostmaintenance, 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.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

        clusterWithSufficientHosts = None
        clusters = Cluster.list(cls.api_client, zoneid=cls.zone.id)
        for cluster in clusters:
            cls.hosts = Host.list(cls.api_client, clusterid=cluster.id)
            if len(cls.hosts) >= 2:
                clusterWithSufficientHosts = cluster

        if clusterWithSufficientHosts is None:
            raise unittest.SkipTest("No Cluster with 2 hosts found")

        Host.update(cls.api_client, id=cls.hosts[0].id, hosttags="hosttag1")
        Host.update(cls.api_client, id=cls.hosts[1].id, hosttags="hosttag2")

        cls.service_offering_1 = ServiceOffering.create(cls.api_client, cls.services["service_offering_1"])
        cls.service_offering_2 = ServiceOffering.create(cls.api_client, cls.services["service_offering_2"])
        cls.vpc_off = VpcOffering.create(cls.api_client, cls.services["vpc_offering"])
        cls.vpc_off.update(cls.api_client, state="Enabled")

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

        cls.vpc_off = VpcOffering.create(cls.api_client, cls.services["vpc_offering"])

        cls.vpc_off.update(cls.api_client, state="Enabled")

        cls.services["vpc"]["cidr"] = "10.1.1.1/16"
        cls.vpc = VPC.create(
            cls.api_client,
            cls.services["vpc"],
            vpcofferingid=cls.vpc_off.id,
            zoneid=cls.zone.id,
            account=cls.account.name,
            domainid=cls.account.domainid,
        )

        cls.nw_off = NetworkOffering.create(cls.api_client, cls.services["network_offering"], conservemode=False)
        # Enable Network offering
        cls.nw_off.update(cls.api_client, state="Enabled")

        # Creating network using the network offering created
        cls.network_1 = Network.create(
            cls.api_client,
            cls.services["network"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            networkofferingid=cls.nw_off.id,
            zoneid=cls.zone.id,
            gateway="10.1.1.1",
            vpcid=cls.vpc.id,
        )
        cls.nw_off_no_lb = NetworkOffering.create(
            cls.api_client, cls.services["network_offering_no_lb"], conservemode=False
        )
        # Enable Network offering
        cls.nw_off_no_lb.update(cls.api_client, state="Enabled")

        # Creating network using the network offering created
        cls.network_2 = Network.create(
            cls.api_client,
            cls.services["network"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            networkofferingid=cls.nw_off_no_lb.id,
            zoneid=cls.zone.id,
            gateway="10.1.2.1",
            vpcid=cls.vpc.id,
        )
        # Spawn an instance in that network
        cls.vm_1 = VirtualMachine.create(
            cls.api_client,
            cls.services["virtual_machine"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering_1.id,
            networkids=[str(cls.network_1.id)],
        )
        # Spawn an instance in that network
        cls.vm_2 = VirtualMachine.create(
            cls.api_client,
            cls.services["virtual_machine"],
            accountid=cls.account.name,
            domainid=cls.account.domainid,
            serviceofferingid=cls.service_offering_1.id,
            networkids=[str(cls.network_1.id)],
        )
        cls.vm_3 = VirtualMachine.create(
            cls.api_client,
            cls.services["virtual_machine"],
            accountid=cls.account.name,
#.........这里部分代码省略.........
开发者ID:mariocar,项目名称:cloudstack,代码行数:103,代码来源:test_vpc_host_maintenance.py

示例9: setUp

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
    def setUp(self):
        self.testdata = self.testClient.getParsedTestDataConfig()
        self.apiclient = self.testClient.getApiClient()

        # Get Zone, Domain and Default Built-in template
        self.domain = get_domain(self.apiclient)
        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())

        self.testdata["mode"] = self.zone.networktype
        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])

        self.hosts = []
        suitablecluster = None
        clusters = Cluster.list(self.apiclient)
        self.assertTrue(isinstance(clusters, list) and len(clusters) > 0, msg = "No clusters found")
        for cluster in clusters:
            self.hosts = Host.list(self.apiclient, clusterid=cluster.id, type='Routing')
            if isinstance(self.hosts, list) and len(self.hosts) >= 2:
                suitablecluster = cluster
                break
        self.assertEqual(validateList(self.hosts)[0], PASS, "hosts list validation failed")
        if len(self.hosts) < 2:
            self.skipTest("Atleast 2 hosts required in cluster for VM HA test")
        #update host tags
        for host in self.hosts:
            Host.update(self.apiclient, id=host.id, hosttags=self.testdata["service_offerings"]["hasmall"]["hosttags"])

        #create a user account
        self.account = Account.create(
            self.apiclient,
            self.testdata["account"],
            domainid=self.domain.id
        )
        #create a service offering
        self.service_offering = ServiceOffering.create(
            self.apiclient,
            self.testdata["service_offerings"]["hasmall"]
        )
        #deploy ha vm
        self.virtual_machine = VirtualMachine.create(
            self.apiclient,
            self.testdata["virtual_machine"],
            accountid=self.account.name,
            zoneid=self.zone.id,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id,
            templateid=self.template.id
        )
        list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
        self.debug(
            "Verify listVirtualMachines response for virtual machine: %s"\
            % self.virtual_machine.id
        )
        self.assertTrue(isinstance(list_vms, list) and len(list_vms) == 1, msg = "List VM response was empty")
        self.virtual_machine = list_vms[0]

        self.mock_checkhealth = SimulatorMock.create(
            apiclient=self.apiclient,
            command="CheckHealthCommand",
            zoneid=suitablecluster.zoneid,
            podid=suitablecluster.podid,
            clusterid=suitablecluster.id,
            hostid=self.virtual_machine.hostid,
            value="result:fail")
        self.mock_ping = SimulatorMock.create(
            apiclient=self.apiclient,
            command="PingCommand",
            zoneid=suitablecluster.zoneid,
            podid=suitablecluster.podid,
            clusterid=suitablecluster.id,
            hostid=self.virtual_machine.hostid,
            value="result:fail")
        self.mock_checkvirtualmachine = SimulatorMock.create(
            apiclient=self.apiclient,
            command="CheckVirtualMachineCommand",
            zoneid=suitablecluster.zoneid,
            podid=suitablecluster.podid,
            clusterid=suitablecluster.id,
            hostid=self.virtual_machine.hostid,
            value="result:fail")
        self.mock_pingtest = SimulatorMock.create(
            apiclient=self.apiclient,
            command="PingTestCommand",
            zoneid=suitablecluster.zoneid,
            podid=suitablecluster.podid,
            value="result:fail")
        self.mock_checkonhost_list = []
        for host in self.hosts:
            if host.id != self.virtual_machine.hostid:
                self.mock_checkonhost_list.append(SimulatorMock.create(
                    apiclient=self.apiclient,
                    command="CheckOnHostCommand",
                    zoneid=suitablecluster.zoneid,
                    podid=suitablecluster.podid,
                    clusterid=suitablecluster.id,
                    hostid=host.id,
                    value="result:fail"))
        #build cleanup list
        self.cleanup = [
            self.service_offering,
#.........这里部分代码省略.........
开发者ID:aali-dincloud,项目名称:cloudstack,代码行数:103,代码来源:test_vm_ha.py

示例10: setUpClass

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
    def setUpClass(cls):
        cls.testClient = super(TestHostHighAvailability, 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.template = get_template(
            cls.api_client,
            cls.zone.id,
            cls.services["ostype"]
        )
        cls.hypervisor = cls.testClient.getHypervisorInfo()
        if cls.hypervisor.lower() in ['lxc']:
            raise unittest.SkipTest("Template creation from root volume is not supported in LXC")


        clusterWithSufficientHosts = None
        clusters = Cluster.list(cls.api_client, zoneid=cls.zone.id)
        for cluster in clusters:
            cls.hosts = Host.list(cls.api_client, clusterid=cluster.id, type="Routing")
            if len(cls.hosts) >= 3:
                clusterWithSufficientHosts = cluster
                break

        if clusterWithSufficientHosts is None:
            raise unittest.SkipTest("No Cluster with 3 hosts found")

        configs = Configurations.list(
                                      cls.api_client,
                                      name='ha.tag'
                                      )

        assert isinstance(configs, list), "Config list not\
                retrieved for ha.tag"

        if configs[0].value != "ha":
            raise unittest.SkipTest("Please set the global config\
                    value for ha.tag as 'ha'")

        Host.update(cls.api_client, id=cls.hosts[2].id, hosttags="ha")

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

        cls.service_offering_with_ha = ServiceOffering.create(
            cls.api_client,
            cls.services["service_offering_with_ha"],
            offerha=True
        )

        cls.service_offering_without_ha = ServiceOffering.create(
            cls.api_client,
            cls.services["service_offering_without_ha"],
            offerha=False
        )

        cls._cleanup = [
            cls.service_offering_with_ha,
            cls.service_offering_without_ha,
        ]
        return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:66,代码来源:test_host_high_availability.py

示例11: setUp

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
    def setUp(self):
        self.testdata = self.testClient.getParsedTestDataConfig()
        self.apiclient = self.testClient.getApiClient()

        # Get Zone, Domain and Default Built-in template
        self.domain = get_domain(self.apiclient)
        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())

        self.testdata["mode"] = self.zone.networktype
        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])

        hosts = Host.list(self.apiclient, type="Routing")
        self.assertTrue(isinstance(hosts, list) and len(hosts) > 0, msg="No hosts found")
        self.host = hosts[0]
        # update host tags
        Host.update(
            self.apiclient, id=self.host.id, hosttags=self.testdata["service_offerings"]["taggedsmall"]["hosttags"]
        )

        # create a user account
        self.account = Account.create(self.apiclient, self.testdata["account"], domainid=self.domain.id)
        # create a service offering
        self.service_offering = ServiceOffering.create(
            self.apiclient, self.testdata["service_offerings"]["taggedsmall"]
        )
        # deploy vms
        self.vm1 = VirtualMachine.create(
            self.apiclient,
            self.testdata["small"],
            accountid=self.account.name,
            zoneid=self.zone.id,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id,
            templateid=self.template.id,
        )
        self.vm2 = VirtualMachine.create(
            self.apiclient,
            self.testdata["small"],
            accountid=self.account.name,
            zoneid=self.zone.id,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id,
            templateid=self.template.id,
        )
        self.vm3 = VirtualMachine.create(
            self.apiclient,
            self.testdata["small"],
            accountid=self.account.name,
            zoneid=self.zone.id,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id,
            templateid=self.template.id,
        )
        list_vms = VirtualMachine.list(self.apiclient, ids=[self.vm1.id, self.vm2.id, self.vm3.id], listAll=True)
        self.assertTrue(isinstance(list_vms, list) and len(list_vms) == 3, msg="List VM response is empty")
        clusters = Cluster.list(self.apiclient, id=self.host.clusterid)
        self.assertTrue(isinstance(clusters, list) and len(clusters) > 0, msg="Cluster not found")

        json_response = '{"com.cloud.agent.api.PingRoutingWithNwGroupsCommand":{"newGroupStates":{},"newStates":{},"_hostVmStateReport":{"%s":{"state":"PowerOn","host":"%s"},"%s":{"state":"PowerOff","host":"%s"}},"_gatewayAccessible":true,"_vnetAccessible":true,"hostType":"Routing","hostId":0,"contextMap":{},"wait":0}}'
        json_response = json_response % (self.vm1.instancename, self.host.name, self.vm2.instancename, self.host.name)

        # create a mock to simulate vm1 as power-on, vm2 as power-off and vm3 as missing
        self.mock_ping = SimulatorMock.create(
            apiclient=self.apiclient,
            command="PingRoutingWithNwGroupsCommand",
            zoneid=self.zone.id,
            podid=clusters[0].podid,
            clusterid=clusters[0].id,
            hostid=self.host.id,
            value="",
            jsonresponse=json_response,
            method="POST",
        )

        # build cleanup list
        self.cleanup = [self.service_offering, self.account, self.mock_ping]
开发者ID:tianshangjun,项目名称:cloudstack,代码行数:78,代码来源:test_vm_sync.py

示例12: test_check_hypervisor_max_limit_effect

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import update [as 别名]
    def test_check_hypervisor_max_limit_effect(self):
        """ Test hypervisor max limits effect

        # 1. Read exsiting count of VM's on the host including SSVM and VR
                and modify maxguestcount accordingly
        # 2. Deploy a VM
        # 2. Try to deploy another vm
        # 3. Verify that second VM
                deployment fails (2 SSVMs 1 VR VM and 1 deployed VM)
        """

        hostList = Host.list(
            self.apiclient,
            zoneid=self.zone.id,
            type="Routing")
        event_validation_result = validateList(hostList)
        self.assertEqual(
            event_validation_result[0],
            PASS,
            "host list validation failed due to %s" %
            event_validation_result[2])

        self.host = Host(hostList[0])
        Host.update(self.apiclient, id=self.host.id, hosttags="host1")

        # Step 1
        # List VM's , SSVM's and VR on selected host
        listVm = list_virtual_machines(self.apiclient,
                                       hostid=self.host.id)

        listssvm = list_ssvms(self.apiclient,
                              hostid=self.host.id)

        listvr = list_routers(self.apiclient,
                              hostid=self.host.id)

        newValue = 1
        if listVm is not None:
            newValue = len(listVm) + newValue

        if listssvm is not None:
            newValue = len(listssvm) + newValue

        if listvr is not None:
            newValue = len(listvr) + newValue

        qresultset = self.dbclient.execute(
            "select hypervisor_version from host where uuid='%s'" %
            self.host.id)

        event_validation_result = validateList(qresultset)
        self.assertEqual(
            event_validation_result[0],
            PASS,
            "event list validation failed due to %s" %
            event_validation_result[2])

        cmdList = listHypervisorCapabilities.listHypervisorCapabilitiesCmd()
        cmdList.hypervisor = self.hypervisor
        config = self.apiclient.listHypervisorCapabilities(cmdList)

        for host in config:
            if host.hypervisorversion == qresultset[0][0]:
                self.hostCapId = host.id
                self.originalLimit = host.maxguestslimit
                break
        else:
            self.skipTest("No hypervisor capabilities found for %s \
                    with version %s" % (self.hypervisor, qresultset[0][0]))

        cmdUpdate = updateHypervisorCapabilities.\
            updateHypervisorCapabilitiesCmd()
        cmdUpdate.id = self.hostCapId
        cmdUpdate.maxguestslimit = newValue
        self.apiclient.updateHypervisorCapabilities(cmdUpdate)

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

        self.cleanup.append(vm)
        # Step 3
        with self.assertRaises(Exception):
            VirtualMachine.create(
                self.userapiclient,
                self.testdata["small"],
                templateid=self.template.id,
                accountid=self.account.name,
                domainid=self.account.domainid,
                serviceofferingid=self.service_offering.id,
                zoneid=self.zone.id,
            )
开发者ID:Accelerite,项目名称:cloudstack,代码行数:101,代码来源:test_hypervisor_limit.py


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