Look for private interface lease
Vagrant-hostmanager should point to the private NIC address instead of bridge. TrivialFix Change-Id: I9ee6b76cd604cfa8b96ce9962581334f483acf70
This commit is contained in:
parent
83265d37c3
commit
245373fbd4
|
@ -36,7 +36,7 @@ import xml.etree.ElementTree as etree
|
|||
import libvirt
|
||||
|
||||
|
||||
class NoBridgeInterfaceException(Exception):
|
||||
class NoPrivateInterfaceException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -77,17 +77,16 @@ def get_mac_address(conn, domain_name):
|
|||
domain_xml = domain.XMLDesc()
|
||||
domain_tree = etree.fromstring(domain_xml)
|
||||
devices = domain_tree.find('devices')
|
||||
interfaces = devices.iterfind('interface')
|
||||
interfaces = devices.findall('interface')
|
||||
|
||||
for interface in interfaces:
|
||||
interface_type = interface.get('type')
|
||||
if interface_type != 'bridge':
|
||||
continue
|
||||
mac_element = interface.find('mac')
|
||||
mac_address = mac_element.get('address')
|
||||
return mac_address
|
||||
try:
|
||||
interface = interfaces[1]
|
||||
except KeyError:
|
||||
raise NoPrivateInterfaceException()
|
||||
|
||||
raise NoBridgeInterfaceException()
|
||||
mac_element = interface.find('mac')
|
||||
mac_address = mac_element.get('address')
|
||||
return mac_address
|
||||
|
||||
|
||||
@libvirt_conn
|
||||
|
|
Loading…
Reference in New Issue