Merge "Add unit test for extract_snapshot with compression enabled"
This commit is contained in:
commit
c691a18acd
@ -494,9 +494,12 @@ disk size: 4.4M
|
|||||||
dest_format='raw', out_format='raw'):
|
dest_format='raw', out_format='raw'):
|
||||||
libvirt_utils.extract_snapshot('/path/to/disk/image', src_format,
|
libvirt_utils.extract_snapshot('/path/to/disk/image', src_format,
|
||||||
'/extracted/snap', dest_format)
|
'/extracted/snap', dest_format)
|
||||||
mock_execute.assert_called_once_with(
|
qemu_img_cmd = ('qemu-img', 'convert', '-f',
|
||||||
'qemu-img', 'convert', '-f', src_format, '-O', out_format,
|
src_format, '-O', out_format)
|
||||||
'/path/to/disk/image', '/extracted/snap')
|
if CONF.libvirt.snapshot_compression and dest_format == "qcow2":
|
||||||
|
qemu_img_cmd += ('-c',)
|
||||||
|
qemu_img_cmd += ('/path/to/disk/image', '/extracted/snap')
|
||||||
|
mock_execute.assert_called_once_with(*qemu_img_cmd)
|
||||||
|
|
||||||
@mock.patch.object(utils, 'execute')
|
@mock.patch.object(utils, 'execute')
|
||||||
def test_extract_snapshot_raw(self, mock_execute):
|
def test_extract_snapshot_raw(self, mock_execute):
|
||||||
@ -511,6 +514,12 @@ disk size: 4.4M
|
|||||||
self._do_test_extract_snapshot(mock_execute,
|
self._do_test_extract_snapshot(mock_execute,
|
||||||
dest_format='qcow2', out_format='qcow2')
|
dest_format='qcow2', out_format='qcow2')
|
||||||
|
|
||||||
|
@mock.patch.object(utils, 'execute')
|
||||||
|
def test_extract_snapshot_qcow2_and_compression(self, mock_execute):
|
||||||
|
self.flags(snapshot_compression=True, group='libvirt')
|
||||||
|
self._do_test_extract_snapshot(mock_execute,
|
||||||
|
dest_format='qcow2', out_format='qcow2')
|
||||||
|
|
||||||
@mock.patch.object(utils, 'execute')
|
@mock.patch.object(utils, 'execute')
|
||||||
def test_extract_snapshot_parallels(self, mock_execute):
|
def test_extract_snapshot_parallels(self, mock_execute):
|
||||||
self._do_test_extract_snapshot(mock_execute,
|
self._do_test_extract_snapshot(mock_execute,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user