Add api to support change device vgpu_type

implement blueprint update-vgpu-type

Change-Id: I7c37f523b4228185ac0cb6acd906fa248ef88033
This commit is contained in:
songwenping 2023-06-08 11:15:48 +08:00
parent 7fe220ac79
commit 3cd247ece4
1 changed files with 147 additions and 0 deletions

View File

@ -0,0 +1,147 @@
..
This work is licensed under a Creative Commons Attribution 3.0 Unported
License.
http://creativecommons.org/licenses/by/3.0/legalcode
=====================
Support attribute API
=====================
This spec adds a new API to update the device vgpu_type.
Problem description
===================
So far, we manage vgpu_type by configuring gpu_devices[1]_ and need configure
the vgpu_type for every GPU. When we change the vgpu_type, we have to restart
the cyborg-agent service. Which is complex and uneasy to change as more
and more GPUs are required nowadays.
In addition, when we change the vgpu_type configuration if the GPU has been
allocated to VM, the GPU report task will raise exception.
Use Cases
---------
1.An admin or operator wants to change the vgpu_type convenient.
2.An admin or operator cannot change the vgpu_type if the GPU is using.
Proposed change
===============
For the case 1, we can provider an API to change the vgpu_type for the single
GPU, and call the cyborg-agent the period task to report the new info, making
the vgpu_type effective immediately.
For the case 2, we can check the GPU usage state before change its vgpu_type,
if the GPU is using, we forbidden to change the vgpu_type.
Alternatives
------------
None
Data model impact
-----------------
* Add new column `vgpu_type` for the devices table. The column is StringField
type and store the vgpu_type info like `{'vgpu_type': 'nvidia-180'}`.
REST API impact
---------------
URL: ``/v2/devices/{uuid}``
METHOD: ``PATCH``
Update vgpu_type for the device.
Request body::
{
"vgpu_type": "nvidia-181"
}
Normal response code (200) and body::
* 204 (No content)
* No response body
Error response code and body:
* 401 (Unauthorized): Unauthorized
* 403 (Forbidden): RBAC check failed
* No response body
Security impact
---------------
None
Notifications impact
--------------------
None
Other end user impact
---------------------
* Change Cyborg Device table.
Performance Impact
------------------
None
Other deployer impact
---------------------
No need to configure the vpgu_type for cyborg-agent.
Developer impact
----------------
If the user want to use these feature, they should upgrade their Cyborg
project to latest to support these changes.
Implementation
==============
Assignee(s)
-----------
Primary assignee:
songwenping
Work Items
----------
* Change Cyborg Device table.
* Add API of patching vgpu_type for the device.
* Change cyborgclient to support change vgpu_type action.
* Add related tests.
Dependencies
============
None
Testing
=======
Appropriate unit and functional tests should be added.
Documentation Impact
====================
* Need a documentation to record microversion history.
* Need a documentaiton to explain api usage.
References
==========
.. [1] https://specs.openstack.org/openstack/cyborg-specs/specs/2023.1/implemented/vgpu-driver-proposal.html
History
=======
.. list-table:: Revisions
:header-rows: 1
* - Release Name
- Description
* - Bobcat
- Introduced