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


Python Host.cancelMaintenance方法代码示例

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


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

示例1: test_02_cancel_maintenance

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import cancelMaintenance [as 别名]
    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,代码行数:50,代码来源:test_vpc_host_maintenance.py

示例2: tearDownClass

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import cancelMaintenance [as 别名]
 def tearDownClass(cls):
     try:
         # Cleanup resources used
         cleanup_resources(cls.api_client, cls._cleanup)
         for host in cls.hosts:
             Host.cancelMaintenance(
                 cls.api_client,
                 id=host.id
             )
             hosts_states = Host.list(
                 cls.api_client,
                 id=host.id,
                 listall=True
             )
             if hosts_states[0].resourcestate != 'Enabled':
                 raise Exception(
                     "Failed to cancel maintenance mode on %s" %
                     (host.name))
     except Exception as e:
         raise Exception("Warning: Exception during cleanup : %s" % e)
     return
开发者ID:K0zka,项目名称:cloudstack,代码行数:23,代码来源:test_vpc_on_host_maintenance.py

示例3: test_02_cancel_maintenance

# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import cancelMaintenance [as 别名]
    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.

        try:
            timeout = self.services["timeout"]
            while True:
                list_host_response = Host.list(self.apiclient, id=self.vpcvr.hostid, resourcestate="Maintenance")

                if list_host_response is not None:
                    break
                elif timeout == 0:
                    raise Exception("Failed to list the Host in Maintenance State")

                time.sleep(self.services["sleep"])
                timeout = timeout - 1

            self.debug("Verified that the Host is in Maintenance State")

        except:
            self.fail("Failed to find the Host in maintenance state")

        self.debug("Cancel host maintenence on which the VPCVR is running")
        try:
            Host.cancelMaintenance(self.apiclient, id=self.vpcvr.hostid)

            timeout = self.services["timeout"]
            while True:
                list_host_response = Host.list(self.apiclient, id=self.vpcvr.hostid, state="Up")

                if list_host_response is not None:
                    break
                elif timeout == 0:
                    raise Exception("Failed to list the Host in Up State after Canceling Maintenance Mode")

                time.sleep(self.services["sleep"])
                timeout = timeout - 1

            self.debug("Verified that the Host is in Up State after Canceling Maintenance Mode")

        except Exception as e:
            self.fail("Failed to cancel 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:mariocar,项目名称:cloudstack,代码行数:69,代码来源:test_vpc_host_maintenance.py


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