diff --git a/virtManager/interface.py b/virtManager/interface.py index 3af59743..2fe61b2a 100644 --- a/virtManager/interface.py +++ b/virtManager/interface.py @@ -117,24 +117,35 @@ class vmmInterface(vmmLibvirtObject): return [x[0] for x in self.get_slaves()] def _get_ip(self, iptype): - obj = self.get_xmlobj() - found = None - for protocol in obj.protocols: + # Get list of IP addresses from active XML and protocol configuration + # from inactive XML to figure out whether the IP address is static or + # from DHCP server. + activeObj = self.get_xmlobj() + inactiveObj = self.get_xmlobj(inactive=True) + + activeProto = None + inactiveProto = None + for protocol in activeObj.protocols: if protocol.family == iptype: - found = protocol + activeProto = protocol break - if not found: + for protocol in inactiveObj.protocols: + if protocol.family == iptype: + inactiveProto = protocol + break + + if not activeProto and not inactiveProto: return None, [] ret = [] - for ip in found.ips: + for ip in activeProto.ips: ipstr = ip.address if not ipstr: continue if ip.prefix: ipstr += "/%s" % ip.prefix ret.append(ipstr) - return found, ret + return inactiveProto or activeProto, ret def get_ipv4(self): proto, ips = self._get_ip("ipv4")