Fix ImageBackendFixture not to support direct_snapshot
The ImageBackendFixture mocks returns a mocked disk and that disk blindly supports the direct_snapshot call by returning a MagicMock as a result. A real imagebacked returns the location of the snapshot instead. When the result of the snapshot is uploaded to the GlanceFixture the fixtures stores the metadata including the MagicMock. Later when such snapshot is downloaded from the fixture (e.g. during unshelve) the Glance fixture tries to deepcopy the metadata to avoid clients modifying the returned data to affect the internal state of the fixture. But MagicMock cannot be deep copied. An easy fix is to declare direct_snapshot not supported for ImageBackendFixture by raising NotImplementedError. This is already handled by the virt driver as we have real backends that are not supporting the direct snapshot call. This way the whole issue in the GlanceFixture can be avoided. Change-Id: Ia222e0f64b932e6aefe779b168d0aa4e9ff48075
This commit is contained in:
parent
8cddd243bf
commit
947f813e56
|
@ -119,6 +119,9 @@ class ImageBackendFixture(fixtures.Fixture):
|
|||
disk.libvirt_info.side_effect = functools.partial(
|
||||
self._fake_libvirt_info, disk)
|
||||
|
||||
disk.direct_snapshot.side_effect = (
|
||||
NotImplementedError('direct_snapshot() is not implemented'))
|
||||
|
||||
return disk
|
||||
|
||||
def _mock_backend(self, backend_self, image_type=None):
|
||||
|
|
Loading…
Reference in New Issue