[Bug 2130459] Re: neutronclient uses the wrong key when listing port bindings
Utkarsh Gupta
2130459 at bugs.launchpad.net
Mon Jan 19 11:32:55 UTC 2026
Ubuntu 25.04 (Plucky Puffin) has reached end of life, so this bug will
not be fixed for that specific release.
** Changed in: python-neutronclient (Ubuntu Plucky)
Status: New => Won't Fix
--
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to python-neutronclient in Ubuntu.
https://bugs.launchpad.net/bugs/2130459
Title:
neutronclient uses the wrong key when listing port bindings
Status in Ubuntu Cloud Archive:
New
Status in Ubuntu Cloud Archive antelope series:
New
Status in Ubuntu Cloud Archive bobcat series:
New
Status in Ubuntu Cloud Archive caracal series:
New
Status in Ubuntu Cloud Archive dalmatian series:
New
Status in Ubuntu Cloud Archive epoxy series:
New
Status in Ubuntu Cloud Archive flamingo series:
New
Status in Ubuntu Cloud Archive gazpacho series:
New
Status in Ubuntu Cloud Archive ussuri series:
New
Status in Ubuntu Cloud Archive yoga series:
New
Status in Ubuntu Cloud Archive zed series:
New
Status in python-neutronclient:
Fix Released
Status in python-neutronclient package in Ubuntu:
New
Status in python-neutronclient source package in Bionic:
New
Status in python-neutronclient source package in Focal:
New
Status in python-neutronclient source package in Jammy:
New
Status in python-neutronclient source package in Noble:
New
Status in python-neutronclient source package in Plucky:
Won't Fix
Status in python-neutronclient source package in Questing:
New
Status in python-neutronclient source package in Resolute:
New
Bug description:
-----------
Description
-----------
When listing the port bindings, neutronclient uses the "port_bindings"
key to access the API response from Neutron [1]. However, as stated on
Neutron's v2 API reference page [2], the client should use "bindings":
```
{
"bindings" : [
{
"host" : "jammy",
...
}
]
}
```
------------------
Reproduction Steps
------------------
Write a simple function in Nova to reproduce this:
```
def test_function(self, context, instance):
client = get_client(context, admin=True)
bindings = None
for vif in instance.get_network_info():
try:
bindings = client.list_port_bindings(
vif['id']
)
except Exception as e:
LOG.exception("Encountered errors when listing bindings")
if bindings is not None:
LOG.info("list port bindings ok, %s", bindings)
```
And we got the following error:
```
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron [None req-44d656db-4880-4976-8faa-a00ba70f67ed 5d22d29167e540c1b3b26b8e66cce21d 9ff8c74250054cf6be30d94c19a7a0d6 - - default default] Encountered errors when listing bindings: KeyError: 'port_bindings'
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron Traceback (most recent call last):
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron File "/usr/lib/python3/dist-packages/nova/network/neutron.py", line 3115, in test_function
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron bindings = client.list_port_bindings(
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron File "/usr/lib/python3/dist-packages/nova/network/neutron.py", line 197, in wrapper
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron ret = obj(*args, **kwargs)
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron File "/usr/lib/python3/dist-packages/neutronclient/v2_0/client.py", line 851, in list_port_bindings
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron return self.list('port_bindings', self.port_bindings_path % port_id,
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron File "/usr/lib/python3/dist-packages/nova/network/neutron.py", line 197, in wrapper
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron ret = obj(*args, **kwargs)
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron File "/usr/lib/python3/dist-packages/neutronclient/v2_0/client.py", line 374, in list
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron res.extend(r[collection])
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron KeyError: 'port_bindings'
2025-10-31 20:12:16.782 3057724 ERROR nova.network.neutron
```
Changing "port_bindings" -> "bindings" in neutronclient's
`list_port_bindings` function and re-run the function:
```
2025-10-31 20:16:44.081 3058851 INFO nova.network.neutron [None req-25ee330d-0d81-4ee0-bf6b-5a15208351dc 5d22d29167e540c1b3b26b8e66cce21d 9ff8c74250054cf6be30d94c19a7a0d6 - - default default] list port bindings ok, {'bindings': [{'host': 'example-host', 'vif_type': ...}]}
```
-----------
Environment
-----------
OpenStack: Caracal (2024.1)
nova: 29.2.0
neutronclient: 11.2.0
----------
References
----------
[1]: https://github.com/openstack/python-neutronclient/blob/master/neutronclient/v2_0/client.py#L853
[2]: https://docs.openstack.org/api-ref/network/v2/index.html#show-port-binding-of-a-port
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-archive/+bug/2130459/+subscriptions
More information about the Ubuntu-openstack-bugs
mailing list