Fix QEMU guest agent IP address retrieval

This commit is contained in:
John 2020-07-16 14:00:20 -04:00
parent 89a076ddc1
commit 01dd5bc270
1 changed files with 11 additions and 0 deletions

View File

@ -216,6 +216,17 @@ class ProxmoxAPI(object):
return ip_address
except socket.error:
pass
elif type(networks) is list:
for network in networks:
for ip_address in network['ip-addresses']:
try:
# IP address validation
if socket.inet_aton(ip_address['ip-address']):
# Ignore localhost
if ip_address['ip-address'] != '127.0.0.1':
return ip_address['ip-address']
except socket.error:
pass
return None
def openvz_ip_address(self, node, vm):