Bug 1728607

Summary: "ironic node-list --fields resource_class" returns 'No API version was specified and the requested operation was not supported by the client's negotiated API version 1.9. Supported version range is: 1.1 to 1.22'
Product: Red Hat OpenStack Reporter: Thom Carlin <tcarlin>
Component: python-ironicclientAssignee: RHOS Maint <rhos-maint>
Status: CLOSED NOTABUG QA Contact: mlammon
Severity: medium Docs Contact:
Priority: unspecified    
Version: 10.0 (Newton)CC: apevec, bfournie, imelofer, lhh, mburns
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-23 14:12:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1715822    

Description Thom Carlin 2019-07-10 08:56:51 UTC
Description of problem:

"ironic node-list --fields resource_class" returns 'No API version was specified and the requested operation was not
supported by the client's negotiated API version 1.9.  Supported
version range is: 1.1 to 1.22'

Version-Release number of selected component (if applicable):

10-z

How reproducible:

100%

Steps to Reproduce:
1. install undercloud
2. ironic node-list --fields help
3. ironic node-list --fields resource_class

Actual results:

2. usage: ironic node-list [--limit <limit>] [--marker <node>]
                        [--sort-key <field>] [--sort-dir <direction>]
                        [--maintenance <boolean>] [--associated <boolean>]
                        [--provision-state <provision-state>]
                        [--driver <driver>] [--detail]
                        [--fields <field> [<field> ...]]
                        [--resource-class <resource class>]
ironic node-list: error: Invalid field(s) requested: help. Valid fields are: chassis_uuid, created_at, clean_step, console_enabled, driver, driver_info, driver_internal_info, extra, instance_info, instance_uuid, last_error, maintenance, maintenance_reason, power_state, properties, provision_state, provision_updated_at, raid_config, reservation, resource_class, target_power_state, target_provision_state, target_raid_config, updated_at, inspection_finished_at, inspection_started_at, uuid, name, network_interface.

3. No API version was specified and the requested operation was not
supported by the client's negotiated API version 1.9.  Supported
version range is: 1.1 to 1.22

Expected results:

2. Ibid
3. List of nodes' resource_class

Additional info:

Comment 1 Thom Carlin 2019-07-10 09:00:24 UTC
Same error returned for "ironic node-list --fields network_interface"

Comment 2 Thom Carlin 2019-07-10 09:09:32 UTC
Same error returned for "ironic node-port-list --fields local_link_connection" and "ironic node-port-list --fields pxe_enabled"

Comment 3 Iury Gregory Melo Ferreira 2019-07-12 15:24:16 UTC
Hi Thom,

Since you are trying to run ironic-client you will need to set IRONIC_API_VERSION enviroment variable to the correct value otherwise you won't get the information.
According to [1] the version would be 1.21

You can try the following command:
$ export IRONIC_API_VERSION="1.21"
$ ironic node-list --fields resource_class


[1] https://docs.openstack.org/ironic/rocky/contributor/webapi-version-history.html#id18

Comment 4 Thom Carlin 2019-07-12 16:27:12 UTC
That workaround was successful following https://bugzilla.redhat.com/show_bug.cgi?id=1728607#c3 with additional notes:
$ cat /etc/rhosp-release
Red Hat OpenStack Platform release 10.0.12 (Newton)

which gives us the codename (Newton)

Searching https://docs.openstack.org/ironic/rocky/contributor/webapi-version-history.html for the codename gives us the API version (1.22 is latest Newton)

Adding this on the command line:

IRONIC_API_VERSION="1.22" ironic node-list --fields resource_class

which returns the expected result.

My question back is how reasonable an RFE would it be to add this logic directly into the client?

Comment 5 Bob Fournier 2019-07-23 14:12:18 UTC
Its not really clear what would be expected for an RFE and also not likely to get backported to OSP-10.  Going forward (OSP-13+) its recommended to use the "openstack baremetal" CLI as the "ironic" CLI is deprecated.