[Bug 2130459] Re: neutronclient uses the wrong key when listing port bindings
Timo Aaltonen
2130459 at bugs.launchpad.net
Thu Feb 19 14:51:18 UTC 2026
Hello Zhan, or anyone else affected,
Accepted python-neutronclient into questing-proposed. The package will
build now and be available at
https://launchpad.net/ubuntu/+source/python-
neutronclient/1:11.6.0-0ubuntu1.1 in a few hours, and then in the
-proposed repository.
Please help us by testing this new package. See
https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how
to enable and use -proposed. Your feedback will aid us getting this
update out to other Ubuntu users.
If this package fixes the bug for you, please add a comment to this bug,
mentioning the version of the package you tested, what testing has been
performed on the package and change the tag from verification-needed-
questing to verification-done-questing. If it does not fix the bug for
you, please add a comment stating that, and change the tag to
verification-failed-questing. In either case, without details of your
testing we will not be able to proceed.
Further information regarding the verification process can be found at
https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in
advance for helping!
N.B. The updated package will be released to -updates after the bug(s)
fixed by this package have been verified and the package has been in
-proposed for a minimum of 7 days.
** Changed in: python-neutronclient (Ubuntu Questing)
Status: In Progress => Fix Committed
** Tags added: verification-needed verification-needed-questing
** Changed in: python-neutronclient (Ubuntu Noble)
Status: In Progress => Fix Committed
** Tags added: verification-needed-noble
--
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to Ubuntu Cloud Archive.
https://bugs.launchpad.net/bugs/2130459
Title:
neutronclient uses the wrong key when listing port bindings
Status in Ubuntu Cloud Archive:
In Progress
Status in Ubuntu Cloud Archive antelope series:
Won't Fix
Status in Ubuntu Cloud Archive bobcat series:
Won't Fix
Status in Ubuntu Cloud Archive caracal series:
In Progress
Status in Ubuntu Cloud Archive dalmatian series:
In Progress
Status in Ubuntu Cloud Archive epoxy series:
In Progress
Status in Ubuntu Cloud Archive flamingo series:
In Progress
Status in Ubuntu Cloud Archive gazpacho series:
Fix Released
Status in Ubuntu Cloud Archive ussuri series:
Won't Fix
Status in Ubuntu Cloud Archive yoga series:
In Progress
Status in Ubuntu Cloud Archive zed series:
Won't Fix
Status in python-neutronclient:
Fix Released
Status in python-neutronclient package in Ubuntu:
Fix Released
Status in python-neutronclient source package in Bionic:
Won't Fix
Status in python-neutronclient source package in Focal:
Won't Fix
Status in python-neutronclient source package in Jammy:
Fix Committed
Status in python-neutronclient source package in Noble:
Fix Committed
Status in python-neutronclient source package in Plucky:
Won't Fix
Status in python-neutronclient source package in Questing:
Fix Committed
Status in python-neutronclient source package in Resolute:
Fix Released
Bug description:
[ Impact ]
A bug in python-neutronclient causes a KeyError when attempting to list
port bindings via the client. Specifically, calling the list_port_bindings
method triggers a KeyError: 'port_bindings'. This occurs because the client
expects the Neutron API response to contain the "port_bindings" key.
This affects any service or tool that calls this method, and as such can
cause functional failures in Openstack deployments. Upstream has fixed this
by adjusting the parsing of the API response to use the correct key "bindings"
instead of "port_bindings". The attached debdiffs apply this same fix to
affected Ubuntu and Ubuntu Cloud Archive series.
[ Test Plan ]
Deploy an OpenStack environment on the target series.
1. Ensure you have administrative access to the deployed cloud and source
credentials.
2. Create a test network and a port to run the query against.
```sh
openstack network create test-net
openstack subnet create --network test-net --subnet-range
10.10.99.0/24 test-subnet
PORT_ID=$(openstack port create --network test-net test-port -c id -f value)
```
3. Verify the failure exists using the following python script. It attempts
to call the problematic API method.
Create a file named reproduce.py with the following contents:
```py
import os
import sys
from keystoneauth1 import identity, session
from neutronclient.v2_0 import client
# Authenticate using environment variables
auth = identity.v3.Password(
auth_url=os.environ['OS_AUTH_URL'],
username=os.environ['OS_USERNAME'],
password=os.environ['OS_PASSWORD'],
project_name=os.environ['OS_PROJECT_NAME'],
user_domain_name=os.environ.get('OS_USER_DOMAIN_NAME', 'Default'),
project_domain_name=os.environ.get('OS_PROJECT_DOMAIN_NAME', 'Default')
)
sess = session.Session(auth=auth)
neutron = client.Client(session=sess)
# Get the port ID
port_id = sys.argv[1]
print(f"Attempting list_port_bindings for {port_id}...")
try:
bindings = neutron.list_port_bindings(port_id)
print("SUCCESS: Bindings retrieved:", bindings)
except Exception as e:
print(f"FAILURE: error: {e}")
sys.exit(1)
```
Run this script with the newly created port:
```sh
python3 reproduce.py $PORT_ID
```
The expected result before applying the fix is that the script will
fail with FAILURE: error: KeyError: 'port_bindings'.
The expected result after applying the fix is that the script will
run successfully.
[ Where problems could occur ]
API response mismatch: The patch changes the key lookup from "port_bindings"
to "bindings". If there are non-standard Neutron API implementations that
only "port_bindings" and not the expected structure, this fix could theoretically
prevent usage of this method that was previously working.
[ Other Info ]
This backports the merged upstream fix which corrects the JSON key.
The description / message from the original commit message is provided
below:
v2_0: Use 'bindings' when listing port bindings
This commit fixes a bug in v2_0 client's "list_port_bindings"
function, where it uses "port_bindings" to access Neutron's
response, instead of "bindings" [0].
[0]: https://docs.openstack.org/api-ref/network/v2/index.html#show-
port-binding-of-a-port
Closes-Bug: #2130459
Change-Id: I32ef753ec212b55f698e3844e043f68b22992ead
Signed-off-by: Zhan Zhang <zzhang953 at bloomberg.net>
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