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


Python base.Host类代码示例

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


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

示例1: test_03_reconnect_host

    def test_03_reconnect_host(self):
        """ Test reconnect Host which has VPC elements
        """

        # Steps:
        # 1.Reconnect one of the host on which VPC Virtual Router is present.
        # Validate the following
        # 1. Host should successfully reconnect.
        # 2. Network connectivity to all the VMs on the host should not be
        #    effected due to reconnection.

        self.debug("Reconnecting the host where VPC VR is running")
        try:
            Host.reconnect(self.apiclient, id=self.vpcvr.hostid)
        except Exception as e:
            self.fail("Failed to reconnect to host: %s" % e)

        self.debug("Check the status of router after migration")
        routers = Router.list(
                              self.apiclient,
                              id=self.vpcvr.id,
                              listall=True
                              )
        self.assertEqual(
                         isinstance(routers, list),
                         True,
                         "List routers shall return the valid response"
                         )
        self.assertEqual(
                         routers[0].state,
                         "Running",
                         "Router state should be running"
                         )
        #  TODO: Check for the network connectivity
        return
开发者ID:Skotha,项目名称:cloudstack,代码行数:35,代码来源:test_vpc_host_maintenance.py

示例2: setUpClass

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

示例3: tearDown

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

示例4: tearDown

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

示例5: test_validateState_succeeds_at_retry_limit

    def test_validateState_succeeds_at_retry_limit(self):
        retries = 3
        timeout = 3
        api_client = MockApiClient(retries, 'initial state', 'final state')
        host = Host({'id': 'host_id'})
        state = host.validateState(api_client, ['final state', 'final state'], timeout=timeout, interval=1)

        self.assertEqual(state, [PASS, None])
        self.assertEqual(retries, api_client.retry_counter)
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:9,代码来源:test_base.py

示例6: tearDownClass

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

示例7: test_03_reconnect_host

    def test_03_reconnect_host(self):
        """ Test reconnect Host which has VPC elements
        """

        # Steps:
        # 1.Reconnect one of the host on which VPC Virtual Router is present.
        # Validate the following
        # 1. Host should successfully reconnect.
        # 2. Network connectivity to all the VMs on the host should not be
        #    effected due to reconnection.

        try:
            timeout = self.services["timeout"]        
            while True:
                list_host_response = Host.list(
                    self.apiclient,
                    id=self.vpcvr.hostid,
                    resourcestate="Enabled")
                
                if list_host_response is not None:
                    break
                elif timeout == 0:
                    raise Exception("Failed to list the Host in Up State")

                time.sleep(self.services["sleep"])
                timeout = timeout - 1
            
            self.debug("Verified that the Host is in Up State")
            
        except:
            self.fail("Failed to find the Host in Up State")

        self.debug("Reconnecting the host where VPC VR is running")
        try:
            Host.reconnect(self.apiclient, id=self.vpcvr.hostid)
        except Exception as e:
            self.fail("Failed to reconnect to host: %s" % e)

        self.debug("Check the status of router after migration")
        routers = Router.list(
                              self.apiclient,
                              id=self.vpcvr.id,
                              listall=True
                              )
        self.assertEqual(
                         isinstance(routers, list),
                         True,
                         "List routers shall return the valid response"
                         )
        self.assertEqual(
                         routers[0].state,
                         "Running",
                         "Router state should be running"
                         )
        #  TODO: Check for the network connectivity
        return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:56,代码来源:test_vpc_host_maintenance.py

示例8: test_validateState_fails_after_retry_limit

    def test_validateState_fails_after_retry_limit(self):
        retries = 3
        timeout = 2
        api_client = MockApiClient(retries, 'initial state', 'final state')
        host = Host({'id': 'host_id'})
        state = host.validateState(api_client, ['final state', 'final state'], timeout=timeout, interval=1)

        self.assertEqual(state,
                         [FAIL, "Host state not transited to %s, operation timed out" % ['final state', 'final state']])
        self.assertEqual(retries, api_client.retry_counter)
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:10,代码来源:test_base.py

示例9: tearDownClass

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

示例10: test_02_cancel_maintenance

    def test_02_cancel_maintenance(self):
        """ Test cancel Maintenance Mode on the above Hosts + Migrate VMs Back
        """

        # Steps
        # 1. Cancel Maintenance Mode on the host.
        # 2. Migrate the VMs back onto the host on which Maintenance mode is
        #    cancelled.
        # Validate the following
        # 1. Successfully cancel the Maintenance mode on the host.
        # 2. Migrate the VMs back successfully onto the host.
        # 3. Check that the network connectivity exists with the migrated VMs.

        self.debug("Cancel host maintenence on which the VPCVR is running")
        try:
            Host.cancelMaintenance(self.apiclient, id=self.vpcvr.hostid)
        except Exception as e:
            self.fail("Failed to enable maintenance mode on host: %s" % e)

        self.debug(
            "Migrating the instances back to the host: %s" %
                                                        self.vpcvr.hostid)
        try:
            cmd = migrateSystemVm.migrateSystemVmCmd()
            cmd.hostid = self.vpcvr.hostid
            cmd.virtualmachineid = self.vpcvr.id
            self.apiclient.migrateSystemVm(cmd)
        except Exception as e:
            self.fail("Failed to migrate VPCVR back: %s" % e)

        self.debug("Check the status of router after migration")
        routers = Router.list(
                              self.apiclient,
                              id=self.vpcvr.id,
                              listall=True
                              )
        self.assertEqual(
                         isinstance(routers, list),
                         True,
                         "List routers shall return the valid response"
                         )
        self.assertEqual(
                         routers[0].state,
                         "Running",
                         "Router state should be running"
                         )
        #  TODO: Check for the network connectivity
        return
开发者ID:Skotha,项目名称:cloudstack,代码行数:48,代码来源:test_vpc_host_maintenance.py

示例11: test_04_hosts

    def test_04_hosts(self):
        """Check the status of hosts"""

        # Validate the following
        # 1. List hosts with type=Routing
        # 2. Check state is "Up" or not

        hosts = Host.list(
                          self.apiclient,
                          zoneid=self.zone.id,
                          type='Routing',
              listall=True
                          )
        self.assertEqual(
                         isinstance(hosts, list),
                         True,
                         "Check if listHosts returns a valid response"
                         )
        for host in hosts:
            self.assertEqual(
                             host.state,
                             'Up',
                             "Host should be in Up state and running"
                             )
        return
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:25,代码来源:test_allocation_states.py

示例12: test_02_migrate_vm

    def test_02_migrate_vm(self):
        """Test migrate VM in project

        # Validate the following
        # 1. Create VM with custom disk offering in a project and check
        #    initial primary storage count
        # 2. List the hosts suitable for migrating the VM
        # 3. Migrate the VM and verify that primary storage count of project remains same"""

        try:
            hosts = Host.list(self.apiclient,virtualmachineid=self.vm.id,
                              listall=True)
            self.assertEqual(validateList(hosts)[0], PASS, "hosts list validation failed")
            host = hosts[0]
            self.vm.migrate(self.apiclient, host.id)
        except Exception as e:
            self.fail("Exception occured" % e)

        expectedCount = self.initialResourceCount
        response = matchResourceCount(
                        self.apiclient, expectedCount,
                        RESOURCE_PRIMARY_STORAGE,
                        projectid=self.project.id)
        self.assertEqual(response[0], PASS, response[1])
        return
开发者ID:aali-dincloud,项目名称:cloudstack,代码行数:25,代码来源:test_ps_project_limits.py

示例13: setUpClass

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

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

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

        cls.account = Account.create(
            cls.apiclient,
            cls.services["account"],
            domainid=cls.domain.id
        )
        cls.hosts = Host.list(cls.apiclient, type='Routing')
        cls.clusters = Cluster.list(cls.apiclient)
        cls.cleanup = [
            cls.account
        ]
开发者ID:Accelerite,项目名称:cloudstack,代码行数:31,代码来源:test_deploy_vms_with_varied_deploymentplanners.py

示例14: test_06_secondary_storage

    def test_06_secondary_storage(self):
        """Check the status of secondary storage"""

        # Validate the following
        # 1. List secondary storage
        # 2. Check state is "Up" or not

        if self.hypervisor.lower() == 'simulator':
            self.skipTest("Hypervisor is simulator skipping")

        sec_storages = Host.list(
                          self.apiclient,
                          zoneid=self.zone.id,
                          type='SecondaryStorageVM',
                          listall=True
                          )

        if sec_storages is None:
            self.skipTest("SSVM is not provisioned yet, skipping")

        self.assertEqual(
                         isinstance(sec_storages, list),
                         True,
                         "Check if listHosts returns a valid response"
                         )
        for sec_storage in sec_storages:
            self.assertEqual(
                             sec_storage.state,
                             'Up',
                             "Secondary storage should be in Up state"
                             )
        return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:32,代码来源:test_allocation_states.py

示例15: test_06_secondary_storage

    def test_06_secondary_storage(self):
        """Check the status of secondary storage"""

        # Validate the following
        # 1. List secondary storage
        # 2. Check state is "Up" or not

        sec_storages = Host.list(
                          self.apiclient,
                          zoneid=self.zone.id,
                          type='SecondaryStorageVM',
              listall=True
                          )
        self.assertEqual(
                         isinstance(sec_storages, list),
                         True,
                         "Check if listHosts returns a valid response"
                         )
        for sec_storage in sec_storages:
            self.assertEqual(
                             sec_storage.state,
                             'Up',
                             "Secondary storage should be in Up state"
                             )
        return
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:25,代码来源:test_allocation_states.py


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