openstack server add fixed ip --fixed-ip does not set correct ip address

Bug #1998927 reported by Mohamed El Gindi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
Confirmed
Undecided
Unassigned

Bug Description

Description
===========
When trying to create attach a fixed ip (be it a provider IP) to an instance directly, I see different behaviour when using `nova interface-attach` and `openstack server add fixed ip`. The former assigns the ip successfully whereas the latter assigns a different ip in the same network

Steps to reproduce
==================
1. Create VM
2. Attach interface with `nova --debug interface-attach --net-id <netid> --fixed-ip <ip> <serverid>`
3. Remove interface with `openstack server remove network <serverid> <netid>`
4. Attach interface with openstack --debug server add fixed ip <serverid> --fixed-ip-address <ip> <netid>`

Expected result
===============
Both 2) and 4) should lead to the requested IP be attached

Actual result
=============
Only 2) assigns requested ip. 4) assigns a different ip in the same network.

Environment
===========
1. Exact version of OpenStack you are running? Yoga (nova 25.0.1)

2. Which hypervisor did you use? Libvirt 8.0.0 + KVM 4.2.1
   What's the version of that?

2. Which storage type did you use? Ceph

3. Which networking type did you use? Neutron with OVN

Logs & Configs
==============

Please see attached file for debug logs

Revision history for this message
Mohamed El Gindi (gindi) wrote :
Revision history for this message
Elod Illes (elod-illes) wrote :

Thanks for the bug report and the reproduction steps. I was able to reproduce the problem, the fixed ip command assigns random IP even if we ask an IP explicitly:

$ openstack server add fixed ip a2a32647-7b42-44a0-96f1-0f6a929a87c7 --fixed-ip-address 10.0.4.95 35634223-1e9d-4c90-a47c-723e6e8773ca
+-------------+--------------------------------------------------------------------------+
| Field | Value |
+-------------+--------------------------------------------------------------------------+
| Port ID | 3dfe6ea1-0da2-4635-8523-79e1fa989c25 |
| Server ID | a2a32647-7b42-44a0-96f1-0f6a929a87c7 |
| Network ID | 35634223-1e9d-4c90-a47c-723e6e8773ca |
| MAC Address | fa:16:3e:56:87:24 |
| Port State | ACTIVE |
| Fixed IPs | ip_address='10.0.4.63', subnet_id='c4b60a49-37d0-4b48-83a8-4fbcf18c2b47' |
| Tag | None |
+-------------+--------------------------------------------------------------------------+

(we asked for IP 10.0.4.95 and got 10.0.4.63)

Changed in nova:
status: New → Confirmed
Revision history for this message
Elod Illes (elod-illes) wrote :

Meanwhile, I realized that the bug is actually not a nova bug but it seems to be more of an openstacksdk bug [1]. So I would like to ask you to open the same bug report towards openstacksdk in their issue tracking page: https://storyboard.openstack.org/#!/project/openstack/openstacksdk

[1] based on the attached debug log (thanks for that!) the difference is that when the user-agent is openstacksdk, then the api req doesn't contain the requested fixed ip, compared to the case when the user-agent is python-novaclient:

REQ: curl -g -i --cacert "/home/mogindi/dsv_chained.crt"
-X POST https://nova.api.dk-cph01.hcp.dsv.com:8774/v2.1/servers/fc4b82de-7954-46a9-ba29-331734cd3448/os-interface
-H "Accept: application/json"
-H "Content-Type: application/json"
-H "OpenStack-API-Version: compute 2.90"
-H "User-Agent: python-novaclient"
-H "X-Auth-Token: {SHA256}9e9b9b15673e1572c432c8b6d2ea487116e6a663275b17b72c3658a54a1fe39e"
-H "X-OpenStack-Nova-API-Version: 2.90"
-d '{"interfaceAttachment": {"net_id": "60dc763d-a54f-41bc-b2d9-b1aede4e311c", "fixed_ips": [{"ip_address": "172.21.44.52"}]}}'

vs

REQ: curl -g -i --cacert "/home/mogindi/dsv_chained.crt"
-X POST https://nova.api.dk-cph01.hcp.dsv.com:8774/v2.1/servers/fc4b82de-7954-46a9-ba29-331734cd3448/os-interface
-H "Content-Type: application/json"
-H "OpenStack-API-Version: compute 2.70"
-H "User-Agent: openstacksdk/0.61.0 keystoneauth1/4.6.0 python-requests/2.27.1 CPython/3.8.10"
-H "X-Auth-Token: {SHA256}e72b969bcb0f4b4dd39242bc970cdefdf33a0387e0db98bbf411da53287de692"
-H "X-OpenStack-Nova-API-Version: 2.70"
-d '{"interfaceAttachment": {"net_id": "60dc763d-a54f-41bc-b2d9-b1aede4e311c"}}'

Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :
affects: nova → python-openstackclient
Revision history for this message
Elod Illes (elod-illes) wrote :

Thanks Jens, yes, indeed your fix [1] solves the problem.

[1] https://review.opendev.org/c/openstack/python-openstackclient/+/866811

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-openstackclient 6.1.0

This issue was fixed in the openstack/python-openstackclient 6.1.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.