Add API support for rebuilding BFV instances

This adds a microversion and API support for triggering a rebuild
of volume-backed instances by leveraging cinder functionality to
do so.

Implements: blueprint volume-backed-server-rebuild
Closes-Bug: #1482040

Co-Authored-By: Rajat Dhasmana <rajatdhasmana@gmail.com>

Change-Id: I211ad6b8aa7856eb94bfd40e4fdb7376a7f5c358
This commit is contained in:
Dan Smith
2022-02-24 11:03:39 -08:00
committed by whoami-rajat
parent 6919db5612
commit 45c5b80fd0
18 changed files with 380 additions and 32 deletions
+9 -8
View File
@@ -4019,14 +4019,15 @@ imageRef:
type: string
imageRef_rebuild:
description: |
The UUID of the image to rebuild for your server instance.
It must be a valid UUID otherwise API will return 400.
If rebuilding a volume-backed server with a new image
(an image different from the image used when creating the volume),
the API will return 400.
For non-volume-backed servers, specifying a new image will result
in validating that the image is acceptable for the current compute host
on which the server exists. If the new image is not valid,
The UUID of the image to rebuild for your server instance. It
must be a valid UUID otherwise API will return 400. To rebuild a
volume-backed server with a new image, at least microversion 2.93
needs to be provided in the request else the request will fall
back to old behaviour i.e. the API will return 400 (for an image
different from the image used when creating the volume). For
non-volume-backed servers, specifying a new image will result in
validating that the image is acceptable for the current compute
host on which the server exists. If the new image is not valid,
the server will go into ``ERROR`` status.
in: body
required: true
+11 -3
View File
@@ -540,7 +540,13 @@ Rebuilds a server.
Specify the ``rebuild`` action in the request body.
This operation recreates the root disk of the server.
For a volume-backed server, this operation keeps the contents of the volume.
With microversion 2.93, we support rebuilding volume backed
instances which will reimage the volume with the provided
image. For microversion < 2.93, this operation keeps the
contents of the volume given the image provided is same as
the image with which the volume was created else the opearation
will error out.
**Preconditions**
@@ -552,8 +558,10 @@ If the server was in status ``SHUTOFF`` before the rebuild, it will be stopped
and in status ``SHUTOFF`` after the rebuild, otherwise it will be ``ACTIVE``
if the rebuild was successful or ``ERROR`` if the rebuild failed.
.. note:: There is a `known limitation`_ where the root disk is not
replaced for volume-backed instances during a rebuild.
.. note:: With microversion 2.93, we support rebuilding volume backed
instances. If any microversion < 2.93 is specified, there is a
`known limitation`_ where the root disk is not replaced for
volume-backed instances during a rebuild.
.. _known limitation: https://bugs.launchpad.net/nova/+bug/1482040