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:
parent
d69e89ea3b
commit
fedd9b1459
|
@ -86,7 +86,7 @@ class VolumeReimageTestCase(base.BaseVolumeTestCase):
|
||||||
volume.status = status
|
volume.status = status
|
||||||
volume.save()
|
volume.save()
|
||||||
self.assertEqual(volume.status, status)
|
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'])
|
self.volume_api.reimage(self.context, volume, self.image_meta['id'])
|
||||||
mock_check.assert_called_once_with(self.image_meta, volume.size)
|
mock_check.assert_called_once_with(self.image_meta, volume.size)
|
||||||
mock_reimage.assert_called_once_with(self.context, volume,
|
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,
|
def test_volume_reimage_api_with_reimage_reserved(self, mock_reimage,
|
||||||
mock_check):
|
mock_check):
|
||||||
volume = tests_utils.create_volume(self.context)
|
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
|
# be reimaged with reimage_reserved flag
|
||||||
volume.status = 'reserved'
|
volume.status = 'reserved'
|
||||||
volume.save()
|
volume.save()
|
||||||
|
@ -110,7 +110,7 @@ class VolumeReimageTestCase(base.BaseVolumeTestCase):
|
||||||
|
|
||||||
def test_volume_reimage_api_with_invaild_status(self):
|
def test_volume_reimage_api_with_invaild_status(self):
|
||||||
volume = tests_utils.create_volume(self.context)
|
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
|
# be reimaged with reimage_reserved flag
|
||||||
|
|
||||||
volume.status = 'reserved'
|
volume.status = 'reserved'
|
||||||
|
|
|
@ -5342,7 +5342,7 @@ class VolumeManager(manager.CleanableManager,
|
||||||
for attachment in attachments]
|
for attachment in attachments]
|
||||||
nova_api.reimage_volume(context, instance_uuids, volume.id)
|
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.",
|
" to volume %(volume_id)s successfully.",
|
||||||
{'image_id': image_id, 'volume_id': volume.id})
|
{'image_id': image_id, 'volume_id': volume.id})
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
---
|
---
|
||||||
features:
|
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.
|
specific image. Specify the ``os-reimage`` action in the request body.
|
||||||
|
|
||||||
The 'available' and 'error' volume can be re-imaged directly, and the
|
A volume in ``available`` or ``error`` status can be re-imaged directly.
|
||||||
'reserved' volume can only be re-imaged when the `reimage_reserved`
|
To re-image a volume in ``reserved`` status, you must include the
|
||||||
parameter is set to 'true'. When reimaging a volume, the volume state
|
``reimage_reserved`` parameter set to ``true``. When reimaging a volume,
|
||||||
will be changed to ``downloading`` first.
|
the volume state will be changed to ``downloading`` first.
|
||||||
|
|
||||||
Note that this is a destructive action, that is, all data currently
|
Note that this is a destructive action, that is, all data currently
|
||||||
contained in a volume is destroyed when the volume is re-imaged.
|
contained in a volume is destroyed when the volume is re-imaged.
|
||||||
|
|
||||||
Two new policies are introduced to govern this functionality:
|
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``
|
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``
|
a volume in status ``reserved``
|
||||||
|
|
||||||
The default setting for both policies allow an administrator or the volume
|
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
|
Two new policies are introduced to govern the volume reimage functionality
|
||||||
introduced with microversion 3.68:
|
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``
|
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``
|
a volume in status ``reserved``
|
||||||
|
|
||||||
The default setting for both policies allow an administrator or the volume
|
The default setting for both policies allow an administrator or the volume
|
||||||
|
|
Loading…
Reference in New Issue