diff --git a/vmtp/network.py b/vmtp/network.py index 2d929df..d7a1036 100644 --- a/vmtp/network.py +++ b/vmtp/network.py @@ -14,6 +14,7 @@ # import time +import ipaddress from .log import LOG # Module containing a helper class for operating on OpenStack networks @@ -166,6 +167,11 @@ class Network(object): LOG.info('Found existing internal network: %s', network_name) return network + ipv4_dns = [x for x in dns_nameservers + if type(ipaddress.ip_address(u'%s' % x)).__name__ == 'IPv4Address'] + ipv6_dns = [x for x in dns_nameservers + if type(ipaddress.ip_address(u'%s' % x)).__name__ == 'IPv6Address'] + body = { 'network': { 'name': network_name, @@ -180,7 +186,7 @@ class Network(object): 'network_id': network['id'], 'enable_dhcp': True, 'ip_version': 4, - 'dns_nameservers': dns_nameservers + 'dns_nameservers': ipv4_dns } } if not enable_dhcp: @@ -199,7 +205,8 @@ class Network(object): 'enable_dhcp': True, 'ip_version': 6, 'ipv6_ra_mode': ipv6_mode, - 'ipv6_address_mode': ipv6_mode + 'ipv6_address_mode': ipv6_mode, + 'dns_nameservers': ipv6_dns } } if not enable_dhcp: