From 2c12395ef313a4d380034a9e65b0f6af027ac022 Mon Sep 17 00:00:00 2001 From: Hironori Shiina Date: Wed, 6 Dec 2017 13:11:49 +0900 Subject: [PATCH] Expose supported power states This SPEC proposes adding a new API to expose supported power states of nodes. This API would be helpful to see if a power action is supported by a node because it depends on whether a power interface supports power actions such as soft power off and soft reboot. Change-Id: If4a3994376cd26a38ef4717bc215cd74df3591a8 Partial-Bug: 1734827 --- .../expose-supported-power-states.rst | 229 ++++++++++++++++++ .../expose-supported-power-states.rst | 1 + 2 files changed, 230 insertions(+) create mode 100644 specs/approved/expose-supported-power-states.rst create mode 120000 specs/not-implemented/expose-supported-power-states.rst diff --git a/specs/approved/expose-supported-power-states.rst b/specs/approved/expose-supported-power-states.rst new file mode 100644 index 00000000..e4790ea9 --- /dev/null +++ b/specs/approved/expose-supported-power-states.rst @@ -0,0 +1,229 @@ +.. + This work is licensed under a Creative Commons Attribution 3.0 Unported + License. + + http://creativecommons.org/licenses/by/3.0/legalcode + +============================= +Expose supported power states +============================= + +https://bugs.launchpad.net/ironic/+bug/1734827 + +This SPEC proposes adding a new API to expose supported power states of nodes. +This API would be helpful to see if a power action is supported by a node +because it depends on whether a power interface supports power actions such as +soft power off and soft reboot. + +Problem description +=================== + +Ironic supports soft shutdown and soft reboot since Ocata. However, not all +power interfaces support these new power actions. A new API would be necessary +to see if a power action is supported by a node. This proposed API is similar +to the one for getting a node's supported boot devices, which is described +`here `_. + +Proposed change +=============== + +The new APIs will be introduced to get the current power status and the +supported power states of nodes. See the 'REST API impact' section and for the +details: + + - GET /v1/nodes/{node_ident}/states/power + - GET /v1/nodes/{node_ident}/states/power/supported + +The new CLI will be also added for the new APIs. See the 'Client (CLI) impact' +section and for the details: + + - ``openstack baremetal node power show [--supported] `` + +Alternatives +------------ + +There is another option to only add a new API to get supported power states. +There are also a few other options to support the API by the CLI: + + - Add a new option to display the supported power states to + ``openstack baremetal node show``. + - Add a new subcommand to show the supported power states like: + ``openstack baremetal node supported power show``. + +However, the current design is better for consistency with the existing APIs +and the `CLI +`_ +for the boot devices. + +Data model impact +----------------- + +None + +State Machine Impact +-------------------- + +None + +REST API impact +--------------- + +We will introduce the two APIs. They will be available starting with a new Bare +Metal API version. + +* Get the current power state of a node: + + GET /v1/nodes/{node_ident}/states/power + + The response is like:: + + { + "power_state": "power on" + } + +* Get the supported power states of a node: + + GET /v1/nodes/{node_ident}/states/power/supported + + The response contains supported power states of the node: For example:: + + { + "supported_power_states": [ + "power on", + "power off", + "rebooting", + "soft rebooting", + "soft power off" + ] + } + +Client (CLI) impact +------------------- + +The ``openstack baremetal`` CLI will support the new API. + +"ironic" CLI +~~~~~~~~~~~~ + +None + +A new feature is no longer added to the "ironic" CLI. + +"openstack baremetal" CLI +~~~~~~~~~~~~~~~~~~~~~~~~~ + +A new subcommnad will be added:: + + openstack baremetal node power show [--supported] + +Without the ``--supported`` option, this command displays the power state of +the specified node. When the ``--supported`` option is specified, this command +displays the supported power states. + +RPC API impact +-------------- + +A new RPC API, ``get_supported_power_states`` will be added. This returns a +list of the supported power states of the specified node synchronously. + +Driver API impact +----------------- + +None + +The driver API ``get_suuported_power_states`` was already defined in the +base power interface. If a power interface doesn't override the method, the +default list which contains power on, power off, and reboot is returned. + +Nova driver impact +------------------ + +None + +The new API is available to see if a requested power action is supported or +not. Though it might be helpful for the Nova driver, no change is planned +currently. + +Ramdisk impact +-------------- + +None + +Security impact +--------------- + +None + +Other end user impact +--------------------- + +None + +Scalability impact +------------------ + +None + +Performance Impact +------------------ + +None + +Other deployer impact +--------------------- + +None + +Developer impact +---------------- + +None + + +Implementation +============== + +Assignee(s) +----------- + +Primary assignee: + shiina-hironori (irc:hshiina) + +Other contributors: + None + +Work Items +---------- + +* Add the new RPC API. +* Add the new Baremetal APIs. +* Add the OSC baremetal subcommand. +* Add a new API test to tempest. +* Add the new APIs to the API reference. + +Dependencies +============ + +None + + +Testing +======= + +An API test will be added to Tempest. + +Upgrades and Backwards Compatibility +==================================== + +None + +Documentation Impact +==================== + +The new APIs will be added to the Baremetal API Reference. + +References +========== + +This change was originally mentioned in reviewing a SPEC to support soft +shutdown.: https://review.openstack.org/#/c/186700/ diff --git a/specs/not-implemented/expose-supported-power-states.rst b/specs/not-implemented/expose-supported-power-states.rst new file mode 120000 index 00000000..ea1ff240 --- /dev/null +++ b/specs/not-implemented/expose-supported-power-states.rst @@ -0,0 +1 @@ +../approved/expose-supported-power-states.rst \ No newline at end of file