diff options
author | Lee Yarwood <lyarwood@redhat.com> | 2020-05-14 10:49:07 +0100 |
---|---|---|
committer | Elod Illes <elod.illes@est.tech> | 2020-08-26 10:24:12 +0200 |
commit | 69ae27579d7ac5fdd30efd57dbde62beff86d5ea (patch) | |
tree | 507891794fff1c9d2fe85ebfd20fe83e8ffed80d | |
parent | 8f7dc3d8700a37956abf567d170ad42863baa4d7 (diff) | |
download | nova-69ae27579d7ac5fdd30efd57dbde62beff86d5ea.tar.gz |
compute: Allow snapshots to be created from PAUSED volume backed instances
Iabeb44f843c3c04f767c4103038fcf6c52966ff3 allowed snapshots to be
created from PAUSED non-volume backed instances but missed the volume
backed use case.
This change simply adds PAUSED to the list of acceptable vm_states when
creating a snapshot from a volume backed instance in addition to the
already supported ACTIVE, STOPPED and SUSPENDED vm_states.
Closes-Bug: #1878583
Change-Id: I9f95a054de9d43ecaa50ff7ffc9343490e212d53
(cherry picked from commit cfde53e4b402e71d7f53b6e0ab232854dba160dc)
(cherry picked from commit a270eeeb9b1a65045c3a8bf3cfad5eee6415f63c)
(cherry picked from commit c93ca609568bac73210f39207c821867620b2f0e)
(cherry picked from commit 04a8399f1d0ce38bb3089c6c4cb3e11da924b2ae)
(cherry picked from commit 35c1846d5cbdf10b08de1ffcd454a67662d32917)
-rw-r--r-- | nova/compute/api.py | 2 | ||||
-rw-r--r-- | nova/tests/unit/compute/test_compute_api.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index 6f1ff7c48e..e756cdd1ba 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -2938,7 +2938,7 @@ class API(base.Base): # NOTE(melwitt): We don't check instance lock for snapshot because lock is # intended to prevent accidental change/delete of instances @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED, - vm_states.SUSPENDED]) + vm_states.PAUSED, vm_states.SUSPENDED]) def snapshot_volume_backed(self, context, instance, name, extra_properties=None): """Snapshot the given volume-backed instance. diff --git a/nova/tests/unit/compute/test_compute_api.py b/nova/tests/unit/compute/test_compute_api.py index a1c8de7f33..ed44e4b343 100644 --- a/nova/tests/unit/compute/test_compute_api.py +++ b/nova/tests/unit/compute/test_compute_api.py @@ -3415,6 +3415,11 @@ class _ComputeAPIUnitTestMixIn(object): quiesce_unsupported=True, vm_state=vm_states.SUSPENDED) + def test_snapshot_volume_backed_with_pause(self): + self._test_snapshot_volume_backed(quiesce_required=False, + quiesce_unsupported=True, + vm_state=vm_states.PAUSED) + @mock.patch.object(context, 'set_target_cell') @mock.patch.object(objects.BlockDeviceMapping, 'get_by_volume') def test_get_bdm_by_volume_id(self, mock_get_by_volume, |