quantum port-update handles fixed-ips paramter incorrectly

Bug #1165171 reported by Sandhya Dasu
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-neutronclient
Fix Released
Low
Elena Ezhova

Bug Description

stack@stack-eclipse-82:/opt/stack/quantum$ quantum port-list
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| 08185995-0e95-4f88-83ba-8aabba7e83d5 | | fa:16:3e:5b:60:40 | {"subnet_id": "276dadc6-50ff-4d5b-aa31-953ddca64245", "ip_address": "10.0.0.2"} |
| 54dd7e9d-0b68-425a-9b99-b34ded620ecf | | fa:16:3e:b0:b0:b5 | {"subnet_id": "c4f17078-5fc3-4741-8690-e3deb30ac1b3", "ip_address": "172.24.4.226"} |
| a7f4f421-d8b9-427e-8248-f512790a9f7b | | fa:16:3e:b0:c7:0e | {"subnet_id": "276dadc6-50ff-4d5b-aa31-953ddca64245", "ip_address": "10.0.0.1"} |
| a8d0fcbf-92f6-4b9b-8720-d3e5e432bd7e | | fa:16:3e:8b:a7:e6 | {"subnet_id": "276dadc6-50ff-4d5b-aa31-953ddca64245", "ip_address": "10.0.0.3"} |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
stack@stack-eclipse-82:/opt/stack/quantum$ quantum port-update a8d0fcbf-92f6-4b9b-8720-d3e5e432bd7e --fixed-ips type=dict {ip_address=10.0.0.20,subnet_id=276dadc6-50ff-4d5b-aa31-953ddca64245}
Updated port: a8d0fcbf-92f6-4b9b-8720-d3e5e432bd7e
stack@stack-eclipse-82:/opt/stack/quantum$ quantum port-list
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| 08185995-0e95-4f88-83ba-8aabba7e83d5 | | fa:16:3e:5b:60:40 | {"subnet_id": "276dadc6-50ff-4d5b-aa31-953ddca64245", "ip_address": "10.0.0.2"} |
| 54dd7e9d-0b68-425a-9b99-b34ded620ecf | | fa:16:3e:b0:b0:b5 | {"subnet_id": "c4f17078-5fc3-4741-8690-e3deb30ac1b3", "ip_address": "172.24.4.226"} |
| a7f4f421-d8b9-427e-8248-f512790a9f7b | | fa:16:3e:b0:c7:0e | {"subnet_id": "276dadc6-50ff-4d5b-aa31-953ddca64245", "ip_address": "10.0.0.1"} |
| a8d0fcbf-92f6-4b9b-8720-d3e5e432bd7e | | fa:16:3e:8b:a7:e6 | {"subnet_id": "276dadc6-50ff-4d5b-aa31-953ddca64245", "ip_address": "10.0.0.20"} |
| | | | {"subnet_id": "276dadc6-50ff-4d5b-aa31-953ddca64245", "ip_address": "10.0.0.21"} |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
stack@stack-eclipse-82:/opt/stack/quantum$ stack@stack-eclipse-82:/opt/stack/quantum$ quantum port-update a8d0fcbf-92f6-4b9b-8720-d3e5e432bd7e --fixed-ips type=dict {ip_address=10.0.0.10,ip_address=10.0.0.12}
Updated port: a8d0fcbf-92f6-4b9b-8720-d3e5e432bd7e
stack@stack-eclipse-82:/opt/stack/quantum$ quantum port-list
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| id | name | mac_address | fixed_ips |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
| 08185995-0e95-4f88-83ba-8aabba7e83d5 | | fa:16:3e:5b:60:40 | {"subnet_id": "276dadc6-50ff-4d5b-aa31-953ddca64245", "ip_address": "10.0.0.2"} |
| 54dd7e9d-0b68-425a-9b99-b34ded620ecf | | fa:16:3e:b0:b0:b5 | {"subnet_id": "c4f17078-5fc3-4741-8690-e3deb30ac1b3", "ip_address": "172.24.4.226"} |
| a7f4f421-d8b9-427e-8248-f512790a9f7b | | fa:16:3e:b0:c7:0e | {"subnet_id": "276dadc6-50ff-4d5b-aa31-953ddca64245", "ip_address": "10.0.0.1"} |
| a8d0fcbf-92f6-4b9b-8720-d3e5e432bd7e | | fa:16:3e:8b:a7:e6 | {"subnet_id": "276dadc6-50ff-4d5b-aa31-953ddca64245", "ip_address": "10.0.0.10"} |
| | | | {"subnet_id": "276dadc6-50ff-4d5b-aa31-953ddca64245", "ip_address": "10.0.0.12"} |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------------+
stack@stack-eclipse-82:/opt/stack/quantum$ quantum port-update a8d0fcbf-92f6-4b9b-8720-d3e5e432bd7e --fixed-ips type=dict {ip_address=10.0.0.20}
Invalid input for fixed_ips. Reason: Invalid data format for fixed IP: '{u'{ip_address': u'10.0.0.20}'}'.
stack@stack-eclipse-82:/opt/stack/quantum$

Sandhya Dasu (sadasu)
Changed in python-quantumclient:
assignee: nobody → Sandhya Dasu (sadasu)
Revision history for this message
Sandhya Dasu (sadasu) wrote :

There seem to be 2 issues here:

1. The parameters passed in for --fixed_ips are always split and each parameter results in a seperate update to the port. So, if ip_address and its subnet are passed in the --fixed_ips dict, port is updated once with the ip_address and once again with the subnet. Hence the port ends up with 2 ip_addresses instead on 1. The ip_adress and subnet have to be part of the same update request. So, there should be a way to differentiate the 2 cases : 1. when ip_address and subnet should be part of the same update. 2. when ip_adress and subnet should form seperate updates.

2. 2 IP addresses can be passed in as a parameters to --fixed_ips, but passing in a single IP returns an error. There is an inconsistency in the deserialization of one parameter vs multiple parameters. When 1 parameter is passed in, it gets deserialized to a dict but with 2 or greater parameters, it gets desrialized to a list of dicts. Arguement checking in Quantum server accepts only a paremeter of type list of dicts.

Trying to find a solution that solves both seemingly unrelated issues. Will update with the proposal. In the meantime, hoping that this bugs moves out of being "undecided".

Revision history for this message
Salvatore Orlando (salvatore-orlando) wrote :

Hi Sandhya, we have just been talking about this, and for one of the issues you mentioned, that is updating a single ip, you need to specify also list=true on the command:

quantum -v port-update 1a77b6a5-39db-4ced-b8e1-d6e11fa93552 -- --fixed_ips type=dict list=true ip_address=10.0.0.4

This will generate the following request body, that is what quantum expects:

{"port": {"fixed_ips": [{"ip_address": "10.0.0.4"}]}}

Revision history for this message
Sandhya Dasu (sadasu) wrote :

Thanks for the comment. If you think the 1st issue reported in this bug is correct can you please confirm it?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-neutronclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/138992

Changed in python-neutronclient:
assignee: Sandhya Dasu (sadasu) → Elena Ezhova (eezhova)
status: New → In Progress
Kyle Mestery (mestery)
Changed in python-neutronclient:
milestone: none → 2.3.11
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-neutronclient (master)

Reviewed: https://review.openstack.org/138992
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=51d2a230e62ef10a3675d67bc36583f434e6300f
Submitter: Jenkins
Branch: master

commit 51d2a230e62ef10a3675d67bc36583f434e6300f
Author: Elena Ezhova <email address hidden>
Date: Thu Dec 4 11:32:20 2014 +0300

    Add parser options for port-update and port-create

    Added parser options for port parameters that can be updated
    thus making the help reference for port-update more verbose.

    This patch also allows subnet_id and ip_address parameters
    of the --fixed-ip argument to be passed in one update request.
    Added a unit test for this.

    Also added a missing device_owner argument to both port-update
    and port-create commands.

    Change-Id: Id78a1400b282b34ee7b30437390be954a2c34f88
    Closes-Bug: #1165171
    Closes-Bug: #1208427
    Closes-Bug: #1399681

Changed in python-neutronclient:
status: In Progress → Fix Committed
Kyle Mestery (mestery)
Changed in python-neutronclient:
status: Fix Committed → Fix Released
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.