mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
host: Show running interface IP address
This commit is contained in:
parent
9e312c7a67
commit
8b8974970a
@ -550,10 +550,6 @@ class vmmConnection(gobject.GObject):
|
|||||||
if virtinst.support.check_interface_support(iface,
|
if virtinst.support.check_interface_support(iface,
|
||||||
virtinst.support.SUPPORT_INTERFACE_XML_INACTIVE):
|
virtinst.support.SUPPORT_INTERFACE_XML_INACTIVE):
|
||||||
inact = libvirt.VIR_INTERFACE_XML_INACTIVE
|
inact = libvirt.VIR_INTERFACE_XML_INACTIVE
|
||||||
|
|
||||||
# XXX: We intentionally use 'inactive' XML even for active
|
|
||||||
# interfaces, since active XML doesn't show much info
|
|
||||||
act = inact
|
|
||||||
else:
|
else:
|
||||||
logging.debug("Interface XML inactive flag not supported.")
|
logging.debug("Interface XML inactive flag not supported.")
|
||||||
|
|
||||||
|
@ -51,8 +51,17 @@ class vmmInterface(vmmLibvirtObject):
|
|||||||
def _define(self, xml):
|
def _define(self, xml):
|
||||||
return self.get_connection().define_interface(xml)
|
return self.get_connection().define_interface(xml)
|
||||||
|
|
||||||
def xpath(self, path):
|
def xpath(self, *args, **kwargs):
|
||||||
return virtinst.util.get_xml_path(self.get_xml(), path)
|
# Must use this function for ALL XML parsing
|
||||||
|
ret = virtinst.util.get_xml_path(self.get_xml(), *args, **kwargs)
|
||||||
|
if ret:
|
||||||
|
return ret
|
||||||
|
if not self.is_active():
|
||||||
|
return ret
|
||||||
|
|
||||||
|
# The running config did not have the info requested
|
||||||
|
return virtinst.util.get_xml_path(self.get_xml(inactive=True),
|
||||||
|
*args, **kwargs)
|
||||||
|
|
||||||
def set_active(self, state):
|
def set_active(self, state):
|
||||||
self.active = state
|
self.active = state
|
||||||
@ -83,7 +92,7 @@ class vmmInterface(vmmLibvirtObject):
|
|||||||
return typ == "bridge"
|
return typ == "bridge"
|
||||||
|
|
||||||
def get_type(self):
|
def get_type(self):
|
||||||
return virtinst.util.get_xml_path(self.get_xml(), "/interface/@type")
|
return self.xpath("/interface/@type")
|
||||||
|
|
||||||
def get_pretty_type(self):
|
def get_pretty_type(self):
|
||||||
itype = self.get_type()
|
itype = self.get_type()
|
||||||
@ -132,7 +141,7 @@ class vmmInterface(vmmLibvirtObject):
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
ret = virtinst.util.get_xml_path(self.get_xml(), func=node_func)
|
ret = self.xpath(func=node_func)
|
||||||
|
|
||||||
if not ret:
|
if not ret:
|
||||||
return []
|
return []
|
||||||
@ -184,7 +193,7 @@ class vmmInterface(vmmLibvirtObject):
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
ret = virtinst.util.get_xml_path(self.get_xml(), func=addr_func)
|
ret = self.xpath(func=addr_func)
|
||||||
|
|
||||||
return [dhcp, autoconf, ret]
|
return [dhcp, autoconf, ret]
|
||||||
|
|
||||||
@ -199,7 +208,7 @@ class vmmInterface(vmmLibvirtObject):
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
ret = virtinst.util.get_xml_path(self.get_xml(), func=protocol)
|
ret = self.xpath(func=protocol)
|
||||||
if ret:
|
if ret:
|
||||||
ret = " %s\n" % ret
|
ret = " %s\n" % ret
|
||||||
return ret
|
return ret
|
||||||
|
Loading…
Reference in New Issue
Block a user