mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: snapshot: Delete leftover overlay files for <transient/> disks
When a VM is terminated by host reboot libvirt doesn't get to cleaning out the temporary overlay file used for transient disks. Since we create those files with a very specific suffix it's almost guaranteed that if it exists it's a leftover from a libvirt run. Delete them instead of complaining to preserve functionality. Closes: https://gitlab.com/libvirt/libvirt/-/issues/684 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
35fef220f1
commit
36080e1b57
@ -1287,10 +1287,12 @@ qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk,
|
||||
domdisk->src->path, suffix);
|
||||
|
||||
if (virFileExists(snapdisk->src->path)) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||
_("Overlay file '%1$s' for transient disk '%2$s' already exists"),
|
||||
snapdisk->src->path, domdisk->dst);
|
||||
return NULL;
|
||||
if (unlink(snapdisk->src->path) != 0) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to delete overlay file '%1$s' for transient disk '%2$s'"),
|
||||
snapdisk->src->path, domdisk->dst);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return g_steal_pointer(&snapdisk);
|
||||
|
Loading…
x
Reference in New Issue
Block a user