Update some examples to use openstackclient

The DNS ordering and OVN DHCP documents were out-of-date
and using the old neutronclient, updated.

Noticed while fixing an openstackclient bug related to
dns_nameservers ordering.

TrivialFix

Related-bug: #2053201
Change-Id: Iab15750a4adc8dc78d839f0a1b952f9d87bdab8a
This commit is contained in:
Brian Haley 2024-02-14 17:31:13 -05:00
parent 2d74a93d68
commit 352de7c42c
3 changed files with 74 additions and 51 deletions

View File

@ -34,57 +34,81 @@ Get Subnet Details Info
----------------------- -----------------------
:: ::
changzhi@stack:~/devstack$ neutron subnet-list $ openstack subnet list
+--------------------------------------+------+-------------+--------------------------------------------+ +--------------------------------------+---------+--------------------------------------+-------------+
| id | name | cidr | allocation_pools | | ID | Name | Network | Subnet |
+--------------------------------------+------+-------------+--------------------------------------------+ +--------------------------------------+---------+--------------------------------------+-------------+
| 1a2d261b-b233-3ab9-902e-88576a82afa6 | | 10.0.0.0/24 | {"start": "10.0.0.2", "end": "10.0.0.254"} | | 1a2d261b-b233-3ab9-902e-88576a82afa6 | private | a404518c-800d-2353-9193-57dbb42ac5ee | 10.0.0.0/24 |
+--------------------------------------+------+-------------+--------------------------------------------+ +--------------------------------------+---------+--------------------------------------+-------------+
changzhi@stack:~/devstack$ neutron subnet-show 1a2d261b-b233-3ab9-902e-88576a82afa6 $ openstack subnet show 1a2d261b-b233-3ab9-902e-88576a82afa6
+------------------+--------------------------------------------+ +----------------------+--------------------------------------+
| Field | Value | | Field | Value |
+------------------+--------------------------------------------+ +----------------------+--------------------------------------+
| allocation_pools | {"start": "10.0.0.2", "end": "10.0.0.254"} | | allocation_pools | 10.0.0.2-10.0.0.254 |
| cidr | 10.0.0.0/24 | | cidr | 10.0.0.0/24 |
| dns_nameservers | 1.1.1.1 | | created_at | 2024-02-13T21:42:34Z |
| | 2.2.2.2 | | description | |
| | 3.3.3.3 | | dns_nameservers | 8.8.4.4, 8.8.8.8 |
| enable_dhcp | True | | dns_publish_fixed_ip | None |
| gateway_ip | 10.0.0.1 | | enable_dhcp | True |
| host_routes | | | gateway_ip | 10.0.0.1 |
| id | 1a2d26fb-b733-4ab3-992e-88554a87afa6 | | host_routes | |
| ip_version | 4 | | id | 1a2d26fb-b733-4ab3-992e-88554a87afa6 |
| name | | | ip_version | 4 |
| network_id | a404518c-800d-2353-9193-57dbb42ac5ee | | ipv6_address_mode | None |
| tenant_id | 3868290ab10f417390acbb754160dbb2 | | ipv6_ra_mode | None |
+------------------+--------------------------------------------+ | name | private |
| network_id | a404518c-800d-2353-9193-57dbb42ac5ee |
| project_id | 3868290ab10f417390acbb754160dbb2 |
| revision_number | 0 |
| segment_id | None |
| service_types | |
| subnetpool_id | |
| tags | |
| updated_at | 2024-02-13T21:42:34Z |
+----------------------+--------------------------------------+
Update Subnet DNS Nameservers Update Subnet DNS Nameservers
----------------------------- -----------------------------
.. note::
``--no-dns-nameserver`` must be passed to clear the current list,
otherwise a conflict will be raised if there are duplicates.
:: ::
neutron subnet-update 1a2d261b-b233-3ab9-902e-88576a82afa6 \ $ openstack subnet set --no-dns-nameserver --dns-nameserver 8.8.8.8 \
--dns_nameservers list=true 3.3.3.3 2.2.2.2 1.1.1.1 --dns-nameserver 8.8.4.4 1a2d261b-b233-3ab9-902e-88576a82afa6
changzhi@stack:~/devstack$ neutron subnet-show 1a2d261b-b233-3ab9-902e-88576a82afa6 $ openstack subnet show 1a2d261b-b233-3ab9-902e-88576a82afa6
+------------------+--------------------------------------------+ +----------------------+--------------------------------------+
| Field | Value | | Field | Value |
+------------------+--------------------------------------------+ +----------------------+--------------------------------------+
| allocation_pools | {"start": "10.0.0.2", "end": "10.0.0.254"} | | allocation_pools | 10.0.0.2-10.0.0.254 |
| cidr | 10.0.0.0/24 | | cidr | 10.0.0.0/24 |
| dns_nameservers | 3.3.3.3 | | created_at | 2024-02-13T21:42:34Z |
| | 2.2.2.2 | | description | |
| | 1.1.1.1 | | dns_nameservers | 8.8.8.8, 8.8.4.4 |
| enable_dhcp | True | | dns_publish_fixed_ip | None |
| gateway_ip | 10.0.0.1 | | enable_dhcp | True |
| host_routes | | | gateway_ip | 10.0.0.1 |
| id | 1a2d26fb-b733-4ab3-992e-88554a87afa6 | | host_routes | |
| ip_version | 4 | | id | 1a2d26fb-b733-4ab3-992e-88554a87afa6 |
| name | | | ip_version | 4 |
| network_id | a404518c-800d-2353-9193-57dbb42ac5ee | | ipv6_address_mode | None |
| tenant_id | 3868290ab10f417390acbb754160dbb2 | | ipv6_ra_mode | None |
+------------------+--------------------------------------------+ | name | private |
| network_id | a404518c-800d-2353-9193-57dbb42ac5ee |
| project_id | 3868290ab10f417390acbb754160dbb2 |
| revision_number | 1 |
| segment_id | None |
| service_types | |
| subnetpool_id | |
| tags | |
| updated_at | 2024-02-13T21:42:34Z |
+----------------------+--------------------------------------+
As shown in above output, the order of the DNS nameservers has been updated. As shown in above output, the order of the DNS nameservers has been updated.
New virtual machines deployed to this subnet will receive the DNS nameservers New virtual machines deployed to this subnet will receive the DNS nameservers

View File

@ -36,12 +36,12 @@ are overridden. In order to map the port DHCP_Options row with the port,
the OVN ML2 driver stores both the subnet id and port id in the 'external_ids' the OVN ML2 driver stores both the subnet id and port id in the 'external_ids'
column. column.
If admin wants to disable native OVN DHCPv4 for any particular port, then the If an admin wants to disable native OVN DHCPv4 for any particular port, then
admin needs to define the 'dhcp_disabled' with the value 'true' in the extra the admin needs to define the 'dhcp_disabled' with the value 'true' in the
DHCP options. extra DHCP options.
Ex. neutron port-update <PORT_ID> \ Ex. openstack port set \
--extra-dhcp-opt ip_version=4, opt_name=dhcp_disabled, opt_value=false --extra-dhcp-option name='dhcp_disabled',value=true,ip-version=4 <PORT_ID>
DHCPv6 DHCPv6

View File

@ -102,8 +102,7 @@ Let's add a DHCP option to a Neutron port:
.. code-block:: bash .. code-block:: bash
$ neutron port-update --extra-dhcp-opt opt_name='server-ip-address',opt_value='10.0.0.1' b4c3f265-369e-4bf5-8789-7caa9a1efb9c $ openstack port set --extra-dhcp-option name='server-ip-address',value='10.0.0.1' b4c3f265-369e-4bf5-8789-7caa9a1efb9c
Updated port: b4c3f265-369e-4bf5-8789-7caa9a1efb9c
.. end .. end