mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
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:
parent
b7583a5ba3
commit
b4d87669ba
@ -6960,7 +6960,7 @@ qemuProcessSetupDisksTransientSnapshot(virDomainObj *vm,
|
|||||||
/* validation code makes sure that we do this only for local disks
|
/* validation code makes sure that we do this only for local disks
|
||||||
* with a file source */
|
* with a file source */
|
||||||
|
|
||||||
if (!(snapdisk = qemuSnapshotGetTransientDiskDef(domdisk)))
|
if (!(snapdisk = qemuSnapshotGetTransientDiskDef(domdisk, vm->def->name)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuSnapshotDiskPrepareOne(snapctxt, domdisk, snapdisk,
|
if (qemuSnapshotDiskPrepareOne(snapctxt, domdisk, snapdisk,
|
||||||
|
@ -1169,7 +1169,8 @@ qemuSnapshotDiskPrepareActiveExternal(virDomainObj *vm,
|
|||||||
|
|
||||||
|
|
||||||
virDomainSnapshotDiskDef *
|
virDomainSnapshotDiskDef *
|
||||||
qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk)
|
qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk,
|
||||||
|
const char *suffix)
|
||||||
{
|
{
|
||||||
g_autoptr(virDomainSnapshotDiskDef) snapdisk = g_new0(virDomainSnapshotDiskDef, 1);
|
g_autoptr(virDomainSnapshotDiskDef) snapdisk = g_new0(virDomainSnapshotDiskDef, 1);
|
||||||
|
|
||||||
@ -1178,7 +1179,8 @@ qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk)
|
|||||||
snapdisk->src = virStorageSourceNew();
|
snapdisk->src = virStorageSourceNew();
|
||||||
snapdisk->src->type = VIR_STORAGE_TYPE_FILE;
|
snapdisk->src->type = VIR_STORAGE_TYPE_FILE;
|
||||||
snapdisk->src->format = VIR_STORAGE_FILE_QCOW2;
|
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)) {
|
if (virFileExists(snapdisk->src->path)) {
|
||||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||||
|
@ -79,4 +79,5 @@ int
|
|||||||
qemuSnapshotDiskCreate(qemuSnapshotDiskContext *snapctxt);
|
qemuSnapshotDiskCreate(qemuSnapshotDiskContext *snapctxt);
|
||||||
|
|
||||||
virDomainSnapshotDiskDef *
|
virDomainSnapshotDiskDef *
|
||||||
qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk);
|
qemuSnapshotGetTransientDiskDef(virDomainDiskDef *domdisk,
|
||||||
|
const char *suffix);
|
||||||
|
Loading…
Reference in New Issue
Block a user