ironic client can not set portgroup mode as integer

Bug #1745099 reported by Kaifeng Wang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-ironicclient
Fix Released
Undecided
Kaifeng Wang

Bug Description

According to [1], bonding mode can be represented as a string or number, e.g. active-backup or 1.

When using ironic cli to create a new port group, the mode parameter accepts a string or number:

# openstack --os-baremetal-api-version 1.26 baremetal port group create --node a308bca6-e6a3-4349-b8ea-695e17672898 --name pg0 --mode 1 --property miimon=100

And after the port group is created, If we set mode to another mode number, ironic cli reports an error:

# openstack --os-baremetal-api-version 1.26 baremetal port group set c42f9bf8-3b5d-4673-b6c1-832c10e4fecf --mode 1
Invalid input for field/attribute mode. Value: '1'. Wrong type. Expected '<type 'unicode'>', got '<type 'int'>' (HTTP 400)

This behaviour is not consistent nor conforms to [1].

The issue is caused by split_and_deserialize, which utilized json to convert values, the should be string value is changed to int after json.loads.

[1] https://www.kernel.org/doc/Documentation/networking/bonding.txt

Kaifeng Wang (kaifeng)
affects: ironic → python-ironicclient
Changed in python-ironicclient:
assignee: nobody → Kaifeng Wang (kaifeng)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-ironicclient (master)

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

Changed in python-ironicclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-ironicclient (master)

Reviewed: https://review.openstack.org/537283
Committed: https://git.openstack.org/cgit/openstack/python-ironicclient/commit/?id=677a4d82358ac453744716952f6227bd6534f352
Submitter: Zuul
Branch: master

commit 677a4d82358ac453744716952f6227bd6534f352
Author: Kaifeng Wang <email address hidden>
Date: Wed Jan 24 15:10:15 2018 +0800

    Can not set portgroup mode as a number

    When creating portgroup, mode accepts a string or a number, e.g.:
    active-backup or 1.

    While setting new mode for an existing portgroup will raise an error, if
    the mode is passed as a number:

        # openstack --os-baremetal-api-version 1.26 baremetal port group \
        set c42f9bf8-3b5d-4673-b6c1-832c10e4fecf --mode 1
        Invalid input for field/attribute mode. Value: '1'. Wrong type. Expected
        '<type 'unicode'>', got '<type 'int'>' (HTTP 400)

    This patch add quotes to mode string to avoid unwanted conversion.

    Change-Id: I1bfe6d203c5420f06c8d7ead487250da1847e103
    Closes-Bug: #1745099

Changed in python-ironicclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-ironicclient (master)

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

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

Reviewed: https://review.openstack.org/538008
Committed: https://git.openstack.org/cgit/openstack/python-ironicclient/commit/?id=80ab8a682a6b3ac667c0c98e4f44c70a93cd9a56
Submitter: Zuul
Branch: master

commit 80ab8a682a6b3ac667c0c98e4f44c70a93cd9a56
Author: Ruby Loo <email address hidden>
Date: Thu Jan 25 14:17:12 2018 -0500

    Add release note for fix to bug 1745099

    This adds a release note about the fix to bug 1745099.
    This is a follow up to 677a4d82358ac453744716952f6227bd6534f352.

    Change-Id: I452c7ee23ebd4af72f62e10c43d539b8cea62a94
    Partial-Bug: #1745099

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

This issue was fixed in the openstack/python-ironicclient 2.2.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.