Followup: Address review comments on re-image patch

This is a followup patch to address review comments on change
I031aae50ee82198648f46c503bba04c6e231bbe5.

Change-Id: I38884b313ea63ff76bc65c41580343226a128ae8
This commit is contained in:
whoami-rajat 2022-02-24 22:58:53 +05:30
parent d69e89ea3b
commit fedd9b1459
3 changed files with 13 additions and 13 deletions

View File

@ -86,7 +86,7 @@ class VolumeReimageTestCase(base.BaseVolumeTestCase):
volume.status = status
volume.save()
self.assertEqual(volume.status, status)
# The available or error volume can be reimage directly
# The available or error volume can be reimaged directly
self.volume_api.reimage(self.context, volume, self.image_meta['id'])
mock_check.assert_called_once_with(self.image_meta, volume.size)
mock_reimage.assert_called_once_with(self.context, volume,
@ -97,7 +97,7 @@ class VolumeReimageTestCase(base.BaseVolumeTestCase):
def test_volume_reimage_api_with_reimage_reserved(self, mock_reimage,
mock_check):
volume = tests_utils.create_volume(self.context)
# The reserved volume can not be reimage directly, and only can
# The reserved volume can not be reimaged directly, and only can
# be reimaged with reimage_reserved flag
volume.status = 'reserved'
volume.save()
@ -110,7 +110,7 @@ class VolumeReimageTestCase(base.BaseVolumeTestCase):
def test_volume_reimage_api_with_invaild_status(self):
volume = tests_utils.create_volume(self.context)
# The reserved volume can not be reimage directly, and only can
# The reserved volume can not be reimaged directly, and only can
# be reimaged with reimage_reserved flag
volume.status = 'reserved'

View File

@ -5342,7 +5342,7 @@ class VolumeManager(manager.CleanableManager,
for attachment in attachments]
nova_api.reimage_volume(context, instance_uuids, volume.id)
LOG.debug("Re-image %(image_id)s"
LOG.debug("Re-imaged %(image_id)s"
" to volume %(volume_id)s successfully.",
{'image_id': image_id, 'volume_id': volume.id})
except Exception:

View File

@ -1,22 +1,22 @@
---
features:
- |
Add microversion 3.68 to support ability to re-image a volume with a
Add microversion 3.68 to support the ability to re-image a volume with a
specific image. Specify the ``os-reimage`` action in the request body.
The 'available' and 'error' volume can be re-imaged directly, and the
'reserved' volume can only be re-imaged when the `reimage_reserved`
parameter is set to 'true'. When reimaging a volume, the volume state
will be changed to ``downloading`` first.
A volume in ``available`` or ``error`` status can be re-imaged directly.
To re-image a volume in ``reserved`` status, you must include the
``reimage_reserved`` parameter set to ``true``. When reimaging a volume,
the volume state will be changed to ``downloading`` first.
Note that this is a destructive action, that is, all data currently
contained in a volume is destroyed when the volume is re-imaged.
Two new policies are introduced to govern this functionality:
* ``REIMAGE_POLICY`` - users who satisfy this policy may re-image a volume
* ``volume:reimage`` - users who satisfy this policy may re-image a volume
in status ``available`` or ``error``
* ``REIMAGE_RESERVED_POLICY`` - users who satisfy this policy may re-image
* ``volume:reimage_reserved`` - users who satisfy this policy may re-image
a volume in status ``reserved``
The default setting for both policies allow an administrator or the volume
@ -29,9 +29,9 @@ upgrade:
Two new policies are introduced to govern the volume reimage functionality
introduced with microversion 3.68:
* ``REIMAGE_POLICY`` - users who satisfy this policy may re-image a volume
* ``volume:reimage`` - users who satisfy this policy may re-image a volume
in status ``available`` or ``error``
* ``REIMAGE_RESERVED_POLICY`` - users who satisfy this policy may re-image
* ``volume:reimage_reserved`` - users who satisfy this policy may re-image
a volume in status ``reserved``
The default setting for both policies allow an administrator or the volume