Fix error while refreshing ip if the virtual nic doesn't have any ip

Signed-off-by: Lin Ma <lma@suse.com>
This commit is contained in:
Lin Ma 2018-09-06 15:46:27 +08:00 committed by Cole Robinson
parent b99731397b
commit be8dfc25f7
1 changed files with 2 additions and 0 deletions

View File

@ -1197,6 +1197,8 @@ class vmmDomain(vmmLibvirtObject):
for addrs in info.values(): for addrs in info.values():
if addrs["hwaddr"] != iface.macaddr: if addrs["hwaddr"] != iface.macaddr:
continue continue
if not addrs["addrs"]:
continue
for addr in addrs["addrs"]: for addr in addrs["addrs"]:
if addr["type"] == 0: if addr["type"] == 0:
ipv4 = addr["addr"] ipv4 = addr["addr"]