[PATCH 11/12] qemu: Mark when modifying access to existing source in qemuDomainStorageSourceAccessModify

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some operations e.g. namespace setup are not necessary when modifying
access to a file which the VM can already access. Add a flag which
allows to skip them.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 82ebf3c324..75d0b34e42 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9220,6 +9220,8 @@ typedef enum {
     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,
+    /* VM already has access to the source and we are just modifying it */
+    QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_MODIFY_ACCESS = 1 << 4,
 } qemuDomainStorageSourceAccessFlags;


@@ -9272,10 +9274,13 @@ qemuDomainStorageSourceAccessModify(virQEMUDriverPtr driver,

     revoke_lockspace = true;

-    if (qemuDomainNamespaceSetupDisk(vm, src) < 0)
-        goto revoke;
+    /* When modifying access of existing @src namespace does not need update */
+    if (!(flags & QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_MODIFY_ACCESS)) {
+        if (qemuDomainNamespaceSetupDisk(vm, src) < 0)
+            goto revoke;

-    revoke_namespace = true;
+        revoke_namespace = true;
+    }

     if (qemuSecuritySetImageLabel(driver, vm, src, chain) < 0)
         goto revoke;
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux