'Tests a negative scenario where the instance task_state is not
accepted for creating a guest-assisted volume snapshot.'

@mock.patch.object(objects.BlockDeviceMapping, 'get_by_volume', return_value=objects.BlockDeviceMapping(instance=objects.Instance(launched_at=timeutils.utcnow(), uuid=uuids.instance_uuid, vm_state=vm_states.ACTIVE, task_state=task_states.SHELVING, host='fake_host')))
def test_volume_snapshot_create_shelving(self, bdm_get_by_volume):

    self.assertRaises(exception.InstanceInvalidState, self.compute_api.volume_snapshot_create, self.context, mock.sentinel.volume_id, mock.sentinel.create_info)
