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 commitcfde53e4b4
) (cherry picked from commita270eeeb9b
)
This commit is contained in:
parent
9f22f41286
commit
c93ca60956
@ -3074,7 +3074,7 @@ class API(base.Base):
|
|||||||
# NOTE(melwitt): We don't check instance lock for snapshot because lock is
|
# NOTE(melwitt): We don't check instance lock for snapshot because lock is
|
||||||
# intended to prevent accidental change/delete of instances
|
# intended to prevent accidental change/delete of instances
|
||||||
@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED,
|
@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,
|
def snapshot_volume_backed(self, context, instance, name,
|
||||||
extra_properties=None):
|
extra_properties=None):
|
||||||
"""Snapshot the given volume-backed instance.
|
"""Snapshot the given volume-backed instance.
|
||||||
|
@ -3297,6 +3297,11 @@ class _ComputeAPIUnitTestMixIn(object):
|
|||||||
quiesce_unsupported=True,
|
quiesce_unsupported=True,
|
||||||
vm_state=vm_states.SUSPENDED)
|
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(context, 'set_target_cell')
|
||||||
@mock.patch.object(objects.BlockDeviceMapping, 'get_by_volume')
|
@mock.patch.object(objects.BlockDeviceMapping, 'get_by_volume')
|
||||||
def test_get_bdm_by_volume_id(self, mock_get_by_volume,
|
def test_get_bdm_by_volume_id(self, mock_get_by_volume,
|
||||||
|
Loading…
Reference in New Issue
Block a user