Bug 1988438 - Misalignment with extra-dhcp-options between neutronclient & openstackclient
Summary: Misalignment with extra-dhcp-options between neutronclient & openstackclient
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-openstackclient
Version: 16.2 (Train)
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: z5
: 16.2 (Train on RHEL 8.4)
Assignee: Rodolfo Alonso
QA Contact: Nobody
URL:
Whiteboard:
Depends On:
Blocks: 1801271 2184310 2184311
TreeView+ depends on / blocked
 
Reported: 2021-07-30 14:30 UTC by Eduardo Olivares
Modified: 2023-11-08 18:58 UTC (History)
7 users (show)

Fixed In Version: python-openstackclient-4.0.2-2.20230404115110.54bf2c0.el8ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2184310 (view as bug list)
Environment:
Last Closed: 2023-11-07 18:14:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack Storyboard 2009095 0 None None None 2023-04-04 08:12:16 UTC
Red Hat Issue Tracker OSP-6665 0 None None None 2021-11-15 13:03:38 UTC

Description Eduardo Olivares 2021-07-30 14:30:22 UTC
Copied from https://bugs.launchpad.net/neutron/+bug/1938575
-----------------------------------------------------------

The SetPort class from the openstack client does not support --extra-dhcp-option [1]
(overcloud) $ openstack port set --extra-dhcp-option name=mtu,value=1700,ip-version=4 port-test-202
usage: openstack port set [-h] [--description <description>]
                          [--device <device-id>] [--mac-address <mac-address>]
                          [--device-owner <device-owner>]
                          [--vnic-type <vnic-type>] [--host <host-id>]
                          [--dns-domain dns-domain] [--dns-name <dns-name>]
                          [--enable | --disable] [--name <name>]
                          [--fixed-ip subnet=<subnet>,ip-address=<ip-address>]
                          [--no-fixed-ip]
                          [--binding-profile <binding-profile>]
                          [--no-binding-profile] [--qos-policy <qos-policy>]
                          [--security-group <security-group>]
                          [--no-security-group]
                          [--enable-port-security | --disable-port-security]
                          [--allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]]
                          [--no-allowed-address]
                          [--data-plane-status <status>] [--tag <tag>]
                          [--no-tag]
                          <port>
openstack port set: error: unrecognized arguments: --extra-dhcp-option port-test-202



The UpdatePort class from the neutron client supports --extra-dhcp-opt [2]
This is aligned with the neutron API [3]
(overcloud) $ neutron port-update port-test-202 --extra-dhcp-opt opt_name=mtu,opt_value=1750,ip_version=4
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Updated port: port-test-202
(overcloud) $ neutron port-show port-test-202 | grep mtu
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
| | {"opt_name": "mtu", "opt_value": "1750", "ip_version": 4} |



[1] https://opendev.org/openstack/python-openstackclient/src/commit/ed87f7949ef1ef580ed71b9820e16823c0466472/openstackclient/network/v2/port.py#L703
[2] https://github.com/openstack/python-neutronclient/blob/2f047b15957308e84dcb72baee3415b8bf5a470a/neutronclient/neutron/v2_0/port.py#L305
[3] https://docs.openstack.org/api-ref/network/v2/?expanded=update-port-detail#update-port

Comment 7 Vadim Khitrin 2023-10-02 13:22:13 UTC
Verified on `RHOS-16.2-RHEL-8-20230926.n.1`.

RPM:
rpm -qa | grep openstackclient
python3-openstackclient-4.0.2-2.20230404115110.54bf2c0.el8ost.noarch


```
openstack --os-cloud overcloud port set
usage: openstack port set [-h] [--description <description>]
                          [--device <device-id>] [--mac-address <mac-address>]
                          [--device-owner <device-owner>]
                          [--vnic-type <vnic-type>] [--host <host-id>]
                          [--dns-domain dns-domain] [--dns-name <dns-name>]
                          [--enable | --disable] [--name <name>]
                          [--fixed-ip subnet=<subnet>,ip-address=<ip-address>]
                          [--no-fixed-ip]
                          [--binding-profile <binding-profile>]
                          [--no-binding-profile] [--qos-policy <qos-policy>]
                          [--security-group <security-group>]
                          [--no-security-group]
                          [--enable-port-security | --disable-port-security]
                          [--allowed-address ip-address=<ip-address>[,mac-address=<mac-address>]]
                          [--no-allowed-address]
                          [--extra-dhcp-option name=<name>[,value=<value>,ip-version={4,6}]]
                          [--data-plane-status <status>] [--tag <tag>]
                          [--no-tag]
                          <port>
```

Comment 8 Vadim Khitrin 2023-10-02 13:36:07 UTC
Forgot to mention that it also works:
```
overcloud) [stack@undercloud-0 tempest]$ openstack port set --extra-dhcp-option name=domain-name,value=fistro.com port
(overcloud) [stack@undercloud-0 tempest]$ openstack port show port -c extra_dhcp_opts
+-----------------+----------------------------------------------------------------+
| Field           | Value                                                          |
+-----------------+----------------------------------------------------------------+
| extra_dhcp_opts | ip_version='4', opt_name='domain-name', opt_value='fistro.com' |
+-----------------+----------------------------------------------------------------+
```


Note You need to log in before you can comment on or make changes to this bug.