Merge "Add support for "--dns-domain" argument"

This commit is contained in:
Zuul 2018-02-24 10:59:41 +00:00 committed by Gerrit Code Review
commit 1b5cab40b5
5 changed files with 36 additions and 2 deletions

View File

@ -28,6 +28,7 @@ Create new port
[--enable | --disable]
[--mac-address <mac-address>]
[--security-group <security-group> | --no-security-group]
[--dns-domain <dns-domain>]
[--dns-name <dns-name>]
[--allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]]
[--qos-policy <qos-policy>]
@ -99,9 +100,14 @@ Create new port
Associate no security groups with this port
.. option:: --dns-domain <dns-name>
Set DNS domain for this port
(requires dns_domain for ports extension)
.. option:: --dns-name <dns-name>
Set DNS name to this port
Set DNS name for this port
(requires DNS integration extension)
.. option:: --allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]
@ -264,6 +270,7 @@ Set port properties
[--security-group <security-group>]
[--no-security-group]
[--enable-port-security | --disable-port-security]
[--dns-domain <dns-domain>]
[--dns-name <dns-name>]
[--allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]]
[--no-allowed-address]
@ -354,9 +361,14 @@ Set port properties
Disable port security for this port
.. option:: --dns-domain <dns-domain>
Set DNS domain for this port
(requires dns_domain for ports extension)
.. option:: --dns-name <dns-name>
Set DNS name to this port
Set DNS name for this port
(requires DNS integration extension)
.. option:: --allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]

View File

@ -127,6 +127,8 @@ def _get_attrs(client_manager, parsed_args):
if parsed_args.mac_address is not None:
attrs['mac_address'] = parsed_args.mac_address
if parsed_args.dns_domain is not None:
attrs['dns_domain'] = parsed_args.dns_domain
if parsed_args.dns_name is not None:
attrs['dns_name'] = parsed_args.dns_name
# It is possible that name is not updated during 'port set'
@ -268,6 +270,12 @@ def _add_updatable_args(parser):
metavar='<host-id>',
help=argparse.SUPPRESS,
)
parser.add_argument(
'--dns-domain',
metavar='dns-domain',
help=_("Set DNS domain to this port "
"(requires dns_domain extension for ports)")
)
parser.add_argument(
'--dns-name',
metavar='dns-name',

View File

@ -565,6 +565,7 @@ class FakePort(object):
'device_id': 'device-id-' + uuid.uuid4().hex,
'device_owner': 'compute:nova',
'dns_assignment': [{}],
'dns_domain': 'dns-domain-' + uuid.uuid4().hex,
'dns_name': 'dns-name-' + uuid.uuid4().hex,
'extra_dhcp_opts': [{}],
'fixed_ips': [{'ip_address': '10.0.0.3',

View File

@ -50,6 +50,7 @@ class TestPort(network_fakes.TestNetworkV2):
'device_id',
'device_owner',
'dns_assignment',
'dns_domain',
'dns_name',
'extra_dhcp_opts',
'fixed_ips',
@ -78,6 +79,7 @@ class TestPort(network_fakes.TestNetworkV2):
fake_port.device_id,
fake_port.device_owner,
utils.format_list_of_dicts(fake_port.dns_assignment),
fake_port.dns_domain,
fake_port.dns_name,
utils.format_list_of_dicts(fake_port.extra_dhcp_opts),
utils.format_list_of_dicts(fake_port.fixed_ips),
@ -152,6 +154,7 @@ class TestCreatePort(TestPort):
'--binding-profile', 'foo=bar',
'--binding-profile', 'foo2=bar2',
'--network', self._port.network_id,
'--dns-domain', 'example.org',
'--dns-name', '8.8.8.8',
'test-port',
@ -169,6 +172,7 @@ class TestCreatePort(TestPort):
('vnic_type', 'macvtap'),
('binding_profile', {'foo': 'bar', 'foo2': 'bar2'}),
('network', self._port.network_id),
('dns_domain', 'example.org'),
('dns_name', '8.8.8.8'),
('name', 'test-port'),
]
@ -187,6 +191,7 @@ class TestCreatePort(TestPort):
'binding:vnic_type': 'macvtap',
'binding:profile': {'foo': 'bar', 'foo2': 'bar2'},
'network_id': self._port.network_id,
'dns_domain': 'example.org',
'dns_name': '8.8.8.8',
'name': 'test-port',
})

View File

@ -0,0 +1,8 @@
---
features:
- |
Add ``--dns-domain`` option to ``port create`` and ``port set`` commands.
Requires the ``dns_domain for ports`` extension to be enabled. See the
`Neutron DNS integration <https://docs.openstack.org/neutron/latest/admin/config-dns-int.html>`_
documentation for information how to use this.
[Bug `1714878 <https://bugs.launchpad.net/python-openstackclient/+bug/1714878>`_]