qemu: Allow skipping the revoke step in qemuDomainStorageSourceAccessModify

In some cases when we need to modify access permissions for a storage
source which is already used by the VM we should not revoke all
permissions on a failure. Allow this in qemuDomainStorageSourceAccessModify
by adding a new flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-04-18 16:10:52 +02:00
parent 657216b60d
commit f50d1b7f49

View File

@ -9218,6 +9218,8 @@ typedef enum {
QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_CHAIN = 1 << 1, QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_CHAIN = 1 << 1,
/* force permissions to read-only when allowing */ /* force permissions to read-only when allowing */
QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_READ_ONLY = 1 << 2, QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_READ_ONLY = 1 << 2,
/* don't revoke permissions when modification has failed */
QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_SKIP_REVOKE = 1 << 3,
} qemuDomainStorageSourceAccessFlags; } qemuDomainStorageSourceAccessFlags;
@ -9294,6 +9296,9 @@ qemuDomainStorageSourceAccessModify(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
revoke: revoke:
if (flags & QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_SKIP_REVOKE)
goto cleanup;
if (revoke_cgroup) { if (revoke_cgroup) {
if (chain) if (chain)
rc = qemuTeardownImageChainCgroup(vm, src); rc = qemuTeardownImageChainCgroup(vm, src);