Merge "Removes the delta file once image is extracted" into stable/train
This commit is contained in:
commit
17a233cf77
|
@ -19187,10 +19187,11 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
disconnect_volume.assert_called_once_with(self.context,
|
disconnect_volume.assert_called_once_with(self.context,
|
||||||
mock.sentinel.new_connection_info, instance)
|
mock.sentinel.new_connection_info, instance)
|
||||||
|
|
||||||
|
@mock.patch.object(fileutils, 'delete_if_exists')
|
||||||
@mock.patch('nova.virt.libvirt.guest.BlockDevice.is_job_complete')
|
@mock.patch('nova.virt.libvirt.guest.BlockDevice.is_job_complete')
|
||||||
@mock.patch('nova.privsep.path.chown')
|
@mock.patch('nova.privsep.path.chown')
|
||||||
def _test_live_snapshot(
|
def _test_live_snapshot(
|
||||||
self, mock_chown, mock_is_job_complete,
|
self, mock_chown, mock_is_job_complete, mock_delete,
|
||||||
can_quiesce=False, require_quiesce=False):
|
can_quiesce=False, require_quiesce=False):
|
||||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI())
|
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI())
|
||||||
mock_dom = mock.MagicMock()
|
mock_dom = mock.MagicMock()
|
||||||
|
@ -19248,6 +19249,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
mock_chown.assert_called_once_with(dltfile, uid=os.getuid())
|
mock_chown.assert_called_once_with(dltfile, uid=os.getuid())
|
||||||
mock_snapshot.assert_called_once_with(dltfile, "qcow2",
|
mock_snapshot.assert_called_once_with(dltfile, "qcow2",
|
||||||
dstfile, "qcow2")
|
dstfile, "qcow2")
|
||||||
|
mock_delete.assert_called_once_with(dltfile)
|
||||||
mock_define.assert_called_once_with(xmldoc)
|
mock_define.assert_called_once_with(xmldoc)
|
||||||
mock_quiesce.assert_any_call(mock.ANY, self.test_instance,
|
mock_quiesce.assert_any_call(mock.ANY, self.test_instance,
|
||||||
mock.ANY, True)
|
mock.ANY, True)
|
||||||
|
|
|
@ -2637,6 +2637,10 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||||
libvirt_utils.extract_snapshot(disk_delta, 'qcow2',
|
libvirt_utils.extract_snapshot(disk_delta, 'qcow2',
|
||||||
out_path, image_format)
|
out_path, image_format)
|
||||||
|
|
||||||
|
# Remove the disk_delta file once the snapshot extracted, so that
|
||||||
|
# it doesn't hang around till the snapshot gets uploaded
|
||||||
|
fileutils.delete_if_exists(disk_delta)
|
||||||
|
|
||||||
def _volume_snapshot_update_status(self, context, snapshot_id, status):
|
def _volume_snapshot_update_status(self, context, snapshot_id, status):
|
||||||
"""Send a snapshot status update to Cinder.
|
"""Send a snapshot status update to Cinder.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue