mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +03:00
qemu: blockcopy: Use the mirror disk source to label the files
Use the source struct and the corresponding function so that we can avoid using the path separately. Now that qemuDomainPrepareDiskChainElementPath isn't use anywhere, we can safely remove it. Additionally, the removal fixes a misaligned comment as the removed function was added under a comment for a different function.
This commit is contained in:
parent
750177104d
commit
9ff75a85e2
@ -12129,25 +12129,6 @@ qemuDomainPrepareDiskChainElement(virQEMUDriverPtr driver,
|
||||
/* Return -1 if request is not sent to agent due to misconfig, -2 if request
|
||||
* is sent but failed, and number of frozen filesystems on success. If -2 is
|
||||
* returned, FSThaw should be called revert the quiesced status. */
|
||||
static int
|
||||
qemuDomainPrepareDiskChainElementPath(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk,
|
||||
const char *file,
|
||||
qemuDomainDiskChainMode mode)
|
||||
{
|
||||
virStorageSource src;
|
||||
|
||||
memset(&src, 0, sizeof(src));
|
||||
|
||||
src.type = VIR_STORAGE_TYPE_FILE;
|
||||
src.format = VIR_STORAGE_FILE_RAW;
|
||||
src.path = (char *) file; /* casting away const is safe here */
|
||||
|
||||
return qemuDomainPrepareDiskChainElement(driver, vm, disk, &src, mode);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
@ -15429,10 +15410,10 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
|
||||
if (VIR_STRDUP(mirror->path, dest) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (qemuDomainPrepareDiskChainElementPath(driver, vm, disk, dest,
|
||||
VIR_DISK_CHAIN_READ_WRITE) < 0) {
|
||||
qemuDomainPrepareDiskChainElementPath(driver, vm, disk, dest,
|
||||
VIR_DISK_CHAIN_NO_ACCESS);
|
||||
if (qemuDomainPrepareDiskChainElement(driver, vm, disk, mirror,
|
||||
VIR_DISK_CHAIN_READ_WRITE) < 0) {
|
||||
qemuDomainPrepareDiskChainElement(driver, vm, disk, mirror,
|
||||
VIR_DISK_CHAIN_NO_ACCESS);
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
@ -15443,8 +15424,8 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
|
||||
virDomainAuditDisk(vm, NULL, mirror, "mirror", ret >= 0);
|
||||
qemuDomainObjExitMonitor(driver, vm);
|
||||
if (ret < 0) {
|
||||
qemuDomainPrepareDiskChainElementPath(driver, vm, disk, dest,
|
||||
VIR_DISK_CHAIN_NO_ACCESS);
|
||||
qemuDomainPrepareDiskChainElement(driver, vm, disk, mirror,
|
||||
VIR_DISK_CHAIN_NO_ACCESS);
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user