Add dns_publish_fixed_ip attribute to subnets

With the subnet_dns_publish_fixed_ip extension Neutron has added a new
attribute to subnets, allowing to select whether DNS records should be
published for fixed IPs from that subnet. Add support for this when
creating and updating subnets.

[0] https://bugs.launchpad.net/neutron/+bug/1784879
[1] https://review.opendev.org/662405
[2] https://review.opendev.org/662409

Depends-On: https://review.opendev.org/679833
Change-Id: Ia804e878acfd1f05e1f00c2ac9202c1d260827f4
This commit is contained in:
Jens Harbott 2019-09-03 17:36:56 +00:00 committed by Jens Harbott (frickler)
parent 7549d260aa
commit b4e9b225b4

View File

@ -229,6 +229,10 @@ def _get_attrs(client_manager, parsed_args, is_create=True):
attrs['enable_dhcp'] = True
if parsed_args.no_dhcp:
attrs['enable_dhcp'] = False
if parsed_args.dns_publish_fixed_ip:
attrs['dns_publish_fixed_ip'] = True
if parsed_args.no_dns_publish_fixed_ip:
attrs['dns_publish_fixed_ip'] = False
if ('dns_nameservers' in parsed_args and
parsed_args.dns_nameservers is not None):
attrs['dns_nameservers'] = parsed_args.dns_nameservers
@ -302,6 +306,17 @@ class CreateSubnet(command.ShowOne):
action='store_true',
help=_("Disable DHCP")
)
dns_publish_fixed_ip_group = parser.add_mutually_exclusive_group()
dns_publish_fixed_ip_group.add_argument(
'--dns-publish-fixed-ip',
action='store_true',
help=_("Enable publishing fixed IPs in DNS")
)
dns_publish_fixed_ip_group.add_argument(
'--no-dns-publish-fixed-ip',
action='store_true',
help=_("Disable publishing fixed IPs in DNS (default)")
)
parser.add_argument(
'--gateway',
metavar='<gateway>',
@ -557,6 +572,17 @@ class SetSubnet(command.Command):
action='store_true',
help=_("Disable DHCP")
)
dns_publish_fixed_ip_group = parser.add_mutually_exclusive_group()
dns_publish_fixed_ip_group.add_argument(
'--dns-publish-fixed-ip',
action='store_true',
help=_("Enable publishing fixed IPs in DNS")
)
dns_publish_fixed_ip_group.add_argument(
'--no-dns-publish-fixed-ip',
action='store_true',
help=_("Disable publishing fixed IPs in DNS")
)
parser.add_argument(
'--gateway',
metavar='<gateway>',