mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemu: blockcopy: sanitize permission handling for 'mirror'
At the point when we want to modify the permissions for the 'mirror' we know whether it is supposed to have a backing chain or no. Given that mirror->backingStore is populated only when we'd need to touch it ayways we can use qemuDomainStorageSourceChainAccessAllow even in place of qemuDomainStorageSourceAccessAllow used for other cases to simplify the code. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
32ec5fee02
commit
47d610e960
@ -17773,17 +17773,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
|
||||
qemuDomainDetermineDiskChain(driver, vm, disk, mirror, true) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT &&
|
||||
virStorageSourceHasBacking(mirror)) {
|
||||
/* note that we don't really know whether a part of the backing chain
|
||||
* is shared so rolling this back is not as easy. Thus we do it only
|
||||
* if there's a backing chain */
|
||||
if (qemuDomainStorageSourceChainAccessAllow(driver, vm, mirror) < 0)
|
||||
goto endjob;
|
||||
} else {
|
||||
if (qemuDomainStorageSourceAccessAllow(driver, vm, mirror, false, true) < 0)
|
||||
goto endjob;
|
||||
}
|
||||
if (qemuDomainStorageSourceChainAccessAllow(driver, vm, mirror) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (!(job = qemuBlockJobDiskNew(disk, QEMU_BLOCKJOB_TYPE_COPY, device)))
|
||||
goto endjob;
|
||||
@ -17800,7 +17791,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
ret = -1;
|
||||
if (ret < 0) {
|
||||
qemuDomainStorageSourceAccessRevoke(driver, vm, mirror);
|
||||
qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror);
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user