本文整理汇总了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
示例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
示例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