本文整理汇总了Python中marvin.lib.base.Host.reconnect方法的典型用法代码示例。如果您正苦于以下问题:Python Host.reconnect方法的具体用法?Python Host.reconnect怎么用?Python Host.reconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.lib.base.Host
的用法示例。
在下文中一共展示了Host.reconnect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_03_reconnect_host
# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import reconnect [as 别名]
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
示例2: test_03_reconnect_host
# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import reconnect [as 别名]
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