[RFE] Enhance /drivers/properties API to have machine readable detail view

Bug #1655633 reported by Sam Betts
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
In Progress
Wishlist
Unassigned

Bug Description

Currently the /drivers/properties API outputs property information in a json like

{
   property_name1: <description>
   property_name2: <description>
}

Often the description includes information such as whether the property is required or optional or if it depends on another properties value. This information in its current form is useful for users using the CLI to call this API, however it isn't so useful for cases when a machine might call this API, for example when trying to build a GUI form for enrolling a node of a particular type. The only option right now is to parse the description string with a REGEX, but with no defined standard this might not always work.

This RFE is proposing to enhance the /drivers/<driver_name>/properties API to respond with a json in a more machine readable format for example:

{
    property_name1: { description: <description>,
                     required: <true|false>,
                     depends-on: [<another property name>]
    },
    property_name2: { description: <description>,
                     required: <true|false>
    }
}

There are two possibilities for preventing API breakage here, either have the new view protected by microversions or only displaying this view if you provide a ?detail=True query. Which of these is TBD.

Additionally, to accommodate for standardising in the API, a more standardised way to define driver properties in the driver modules would be provided, using a similar (or the same) interface as the oslo.cfg opts definitions that allows a driver developer to define a property as an object with fields like required=True and also to type the options like str option or bool option in oslo.cfg. This will allow the Ironic code for parsing, returning and validating properties for drivers to be simpler, more consistent and common across multiple drivers, avoiding the duplication of property parsing we see today in many drivers.

Tags: needs-spec rfe
tags: added: needs-spec
Sam Betts (sambetts)
description: updated
Dmitry Tantsur (divius)
Changed in ironic:
status: New → Confirmed
Changed in ironic:
assignee: nobody → Madhuri Kumari (madhuri-rai07)
Revision history for this message
Ruby Loo (rloo) wrote :

Note that it isn't possible to always have required=True/False because some of them depend on other things. See eg: https://github.com/openstack/ironic/blob/31d889a7c45c63664969c89878e88652697b7949/ironic/drivers/modules/ipmitool.py#L80-L92

We (or I) did go down that road and was going to put in some field with required, but at the time, it wasn't clear how we wanted to handle the 'depends' case.

Here's the spec for the existing command. If nothing else, it will be of historical interest :) : http://specs.openstack.org/openstack/ironic-specs/specs/juno-implemented/get-required-driver-info.html
-

Revision history for this message
Peter Piela (ppiela) wrote :

This would be very helpful in development of the Ironic UI. Today, we use patterns in the language used to describe properties to build metadata that is used to control the structure and operation of input forms.

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

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

Changed in ironic:
assignee: Madhuri Kumari (madhuri-rai07) → Ruby Loo (rloo)
status: Confirmed → In Progress
Ruby Loo (rloo)
Changed in ironic:
assignee: Ruby Loo (rloo) → nobody
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.