From e1a0775425b29dc8031eefc0098ff2df535d54a0 Mon Sep 17 00:00:00 2001 From: Vladyslav Drok Date: Tue, 15 May 2018 18:07:39 +0300 Subject: [PATCH] Allow having placement inventories with reserved value equal to total Currently, we delete ironic node resource provider inventory from placement to indicate that the node is not available for deployment during the cleaning process or when in maintenance. This is not actually required as we can reserve all the inventory, which describes more accurately what is going on, and introduces issues like https://bugs.launchpad.net/nova/+bug/1771577. APIImpact blueprint: allow-reserved-equal-total-inventory Change-Id: I0aec5e9f0a26430a9b104159c62ba1d07944ce9f --- .../allow-reserved-equal-total-inventory.rst | 194 ++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 specs/rocky/approved/allow-reserved-equal-total-inventory.rst diff --git a/specs/rocky/approved/allow-reserved-equal-total-inventory.rst b/specs/rocky/approved/allow-reserved-equal-total-inventory.rst new file mode 100644 index 000000000..45335db99 --- /dev/null +++ b/specs/rocky/approved/allow-reserved-equal-total-inventory.rst @@ -0,0 +1,194 @@ +.. + This work is licensed under a Creative Commons Attribution 3.0 Unported + License. + + http://creativecommons.org/licenses/by/3.0/legalcode + +===================================================================== +Allow having placement inventories with reserved value equal to total +===================================================================== + +https://blueprints.launchpad.net/nova/+spec/allow-reserved-equal-total-inventory + +Currently, we delete ironic node resource provider inventory from placement +to indicate that the node is not available for deployment during the cleaning +process or when in maintenance. This causes placement to report the incorrect +inventory and capacity information, as the node is actually still present, and +its inventory remains the same. Reserving all the inventory describes more +accurately what is going on. Also doing the resource reservation will allow +us to fix bugs like [1] properly, as it is possible to set reservation for +inventory before deleting the allocation, even if inventory gets exceeded +because of that. But placement API does not allow to set reserved value to be +equal to total in the inventory record. + + +Problem description +=================== + +Placement API does not allow to set reserved value to be equal to total in the +inventory record. This makes ironic virt driver to delete inventory records +from placement e.g. during node cleaning instead of reserving them. + +Deleting resource provider inventory should mean that it is actually gone. +For purposes of indicating that resources are temporarily unavailable +placement provides the ``reserved`` field in the inventory object. This will +enable placement to report the correct inventory and capacity information. +It will also enable us to fix ironic virt driver issue [1]. + +Use Cases +--------- + +1. Reserve ironic node inventory during node cleaning or maintenance. + +2. Reserve FPGA inventory during its programming by cyborg. + + +Proposed change +=============== + +Add a new microversion to placement API that will allow to set reserved value +of the inventory record to be equal to total value. It will become the +placement behaviour for all subsequent microversion. + +This new microversion will be used by nova scheduler report client when +doing the inventory update calls. This will enable virt drivers in nova +to decide whether they need to report all the inventory resources as reserved +in the ``get_inventory()`` call. + +Alternatives +------------ + +None + +Data model impact +----------------- + +None + +REST API impact +--------------- + +``POST /resource_providers//inventories``, +``PUT /resource_providers//inventories`` and +``PUT /resource_providers//inventories/`` API endpoints will return +response code ``200`` instead of ``400`` when called with +new microversion and body containing inventory records that have reserved +value equal to total. + +Example request: + +path -- ``PUT /resource_providers/UUID/inventories`` + +headers -- ``Content-type: application/json``, + ``Openstack-API-Version: placement 1.NEW_MV`` + +body:: + + { + "inventories": { + "CUSTOM_GOLD": { + "total": 1, + "reserved": 1 + } + }, + "resource_provider_generation": 5 + } + +Example response: + +``200 OK`` + +Security impact +--------------- + +None + +Notifications impact +-------------------- + +None + +Other end user impact +--------------------- + +None + +Performance Impact +------------------ + +None + +Other deployer impact +--------------------- + +None + +Developer impact +---------------- + +Virt drivers now are able to set the ``reserved`` key in the +``get_inventory()`` returned dictionary to a total inventory value when needed. + +Upgrade impact +-------------- + +None + + +Implementation +============== + +Assignee(s) +----------- + +Primary assignee: + vdrok + +Work Items +---------- + +* change to placement API adding the logic and new microversion + +* change scheduler report client to use the new microversion during inventory + update calls + +* change ironic virt driver to report resources as reserved during cleaning + and maintenance + + +Dependencies +============ + +None + + +Testing +======= + +Unit and functional testing will be added. + + +Documentation Impact +==================== + +API reference will be updated. + + +References +========== + +[0] https://etherpad.openstack.org/p/nova-ptg-Rocky + +[1] https://bugs.launchpad.net/nova/+bug/1771577 + + +History +======= + +.. list-table:: Revisions + :header-rows: 1 + + * - Release Name + - Description + * - Rocky + - Introduced