提交 115c3dc6 编写于 作者: L Lucas Meneghel Rodrigues

Merge pull request #870 from clebergnu/vm_name_resolution_fix

avocado/core/virt.py: avoid crashing when trying to detect VM IP address
......@@ -280,7 +280,15 @@ class VM(object):
"""
desc = etree.fromstring(self.domain.XMLDesc(0))
mac_path = "devices/interface[@type='network']/mac"
mac = desc.find(mac_path).attrib["address"].lower().strip()
node = desc.find(mac_path)
if node is None:
return None
mac = node.get("address")
if mac is None:
return None
mac = mac.lower().strip()
output = subprocess.Popen(["arp", "-n"],
stdout=subprocess.PIPE).communicate()[0]
lines = [line.split() for line in output.split("\n")[1:]]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册