mirror of https://gitee.com/openkylin/libvirt.git
qemu: Disband qemuDomainSnapshotCreateSingleDiskActive
After we always assume support for the 'transaction' command
(c358adc571
) and follow-up cleanups
qemuDomainSnapshotCreateSingleDiskActive lost its value. Move the code
into appropriate helpers and remove the function.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
0d1622a1f4
commit
fd8e55ca93
|
@ -15361,6 +15361,22 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr driver,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* pre-create the image file so that we can label it before handing it to qemu */
|
||||||
|
if (!reuse && dd->src->type != VIR_STORAGE_TYPE_BLOCK) {
|
||||||
|
if (virStorageFileCreate(dd->src) < 0) {
|
||||||
|
virReportSystemError(errno, _("failed to create image file '%s'"),
|
||||||
|
NULLSTR(dd->src->path));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
dd->created = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set correct security, cgroup and locking options on the new image */
|
||||||
|
if (qemuDomainStorageSourceAccessAllow(driver, vm, dd->src, false, true) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
dd->prepared = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15463,36 +15479,6 @@ qemuDomainSnapshotDiskUpdateSource(virQEMUDriverPtr driver,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
|
|
||||||
virDomainObjPtr vm,
|
|
||||||
qemuDomainSnapshotDiskDataPtr dd,
|
|
||||||
virJSONValuePtr actions,
|
|
||||||
bool reuse)
|
|
||||||
{
|
|
||||||
if (qemuBlockSnapshotAddLegacy(actions, dd->disk, dd->src, reuse) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* pre-create the image file so that we can label it before handing it to qemu */
|
|
||||||
if (!reuse && dd->src->type != VIR_STORAGE_TYPE_BLOCK) {
|
|
||||||
if (virStorageFileCreate(dd->src) < 0) {
|
|
||||||
virReportSystemError(errno, _("failed to create image file '%s'"),
|
|
||||||
NULLSTR(dd->src->path));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
dd->created = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set correct security, cgroup and locking options on the new image */
|
|
||||||
if (qemuDomainStorageSourceAccessAllow(driver, vm, dd->src, false, true) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
dd->prepared = true;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* The domain is expected to be locked and active. */
|
/* The domain is expected to be locked and active. */
|
||||||
static int
|
static int
|
||||||
qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
||||||
|
@ -15534,9 +15520,10 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
|
||||||
* VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL with a valid file name and
|
* VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL with a valid file name and
|
||||||
* qcow2 format. */
|
* qcow2 format. */
|
||||||
for (i = 0; i < ndiskdata; i++) {
|
for (i = 0; i < ndiskdata; i++) {
|
||||||
if (qemuDomainSnapshotCreateSingleDiskActive(driver, vm,
|
if (qemuBlockSnapshotAddLegacy(actions,
|
||||||
&diskdata[i],
|
diskdata[i].disk,
|
||||||
actions, reuse) < 0)
|
diskdata[i].src,
|
||||||
|
reuse) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue