mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: blockcopy: Explicitly assert 'reuse' for block devices
When copying to a block device, the block device will already exist. To allow users using a block device without any preparation, they need to use the block copy without VIR_DOMAIN_BLOCK_COPY_REUSE_EXT. This means that if the target is an existing block device we don't need to prepare it, but we can't reject it as being existing. To avoid breaking this feature, explicitly assume that existing block devices will be reused even without that flag explicitly specified, while skipping attempts to create it. qemuMonitorDriveMirror still needs to honor the flag as specified by the user, since qemu overwrites the metadata otherwise.
This commit is contained in:
parent
a805320b67
commit
060d4ec6a0
@ -16811,6 +16811,10 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
|
||||
disk->dst, mirror->path);
|
||||
goto endjob;
|
||||
}
|
||||
} else {
|
||||
/* if the target is a block device, assume that we are reusing it, so
|
||||
* there are no attempts to create it */
|
||||
reuse = true;
|
||||
}
|
||||
|
||||
if (!mirror->format) {
|
||||
@ -16850,6 +16854,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
|
||||
|
||||
/* Actually start the mirroring */
|
||||
qemuDomainObjEnterMonitor(driver, vm);
|
||||
/* qemuMonitorDriveMirror needs to honor the REUSE_EXT flag as specified
|
||||
* by the user regardless of how @reuse was modified */
|
||||
ret = qemuMonitorDriveMirror(priv->mon, device, mirror->path, format,
|
||||
bandwidth, granularity, buf_size, flags);
|
||||
virDomainAuditDisk(vm, NULL, mirror, "mirror", ret >= 0);
|
||||
|
Loading…
Reference in New Issue
Block a user