qemu_snapshot: Add the guest name to the transient disk path

Later patches will implement sharing of the backing file, so we'll need
to be able to discriminate the overlays per VM.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Masayoshi Mizuma 2021-03-24 20:54:11 -04:00 committed by Peter Krempa
parent b7583a5ba3
commit b4d87669ba
3 changed files with 7 additions and 4 deletions

View File

@ -6960,7 +6960,7 @@ qemuProcessSetupDisksTransientSnapshot(virDomainObj *vm,
/* validation code makes sure that we do this only for local disks
* with a file source */
if (!(snapdisk = qemuSnapshotGetTransientDiskDef(domdisk)))
if (!(snapdisk = qemuSnapshotGetTransientDiskDef(domdisk, vm->def->name)))
return -1;
if (qemuSnapshotDiskPrepareOne(snapctxt, domdisk, snapdisk,

View File

@ -1169,7 +1169,8 @@ qemuSnapshotDiskPrepareActiveExternal(virDomainObj *vm,
virDomainSnapshotDiskDef *
qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk)
qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk,
const char *suffix)
{
g_autoptr(virDomainSnapshotDiskDef) snapdisk = g_new0(virDomainSnapshotDiskDef, 1);
@ -1178,7 +1179,8 @@ qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk)
snapdisk->src = virStorageSourceNew();
snapdisk->src->type = VIR_STORAGE_TYPE_FILE;
snapdisk->src->format = VIR_STORAGE_FILE_QCOW2;
snapdisk->src->path = g_strdup_printf("%s.TRANSIENT", domdisk->src->path);
snapdisk->src->path = g_strdup_printf("%s.TRANSIENT-%s",
domdisk->src->path, suffix);
if (virFileExists(snapdisk->src->path)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,

View File

@ -79,4 +79,5 @@ int
qemuSnapshotDiskCreate(qemuSnapshotDiskContext *snapctxt);
virDomainSnapshotDiskDef *
qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk);
qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk,
const char *suffix);