fbe740
From 659d623740e3f15135b4c7b1e44d18ee08e67a11 Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <659d623740e3f15135b4c7b1e44d18ee08e67a11@dist-git>
fbe740
From: Michal Privoznik <mprivozn@redhat.com>
fbe740
Date: Fri, 14 Feb 2020 16:17:08 +0100
fbe740
Subject: [PATCH] qemu_domain: Modify access to a NVMe disk iff needed
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
If a domain has a NVMe disk it already has the access configured.
fbe740
Trying to configure it again on a commit or some other operation
fbe740
is wrong and condemned to failure.
fbe740
fbe740
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
(cherry picked from commit b18328256b565806c04c153ce49fc3641412b35b)
fbe740
fbe740
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1519005#c24
fbe740
fbe740
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
fbe740
Message-Id: <ee3871eb043b3ae82daca2e365b696c8963665f7.1581693409.git.mprivozn@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 src/qemu/qemu_domain.c | 11 +++++------
fbe740
 1 file changed, 5 insertions(+), 6 deletions(-)
fbe740
fbe740
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
fbe740
index 1bed117eb0..8e0e919f9a 100644
fbe740
--- a/src/qemu/qemu_domain.c
fbe740
+++ b/src/qemu/qemu_domain.c
fbe740
@@ -11828,13 +11828,12 @@ qemuDomainStorageSourceAccessModify(virQEMUDriverPtr driver,
fbe740
 
fbe740
     revoke_lockspace = true;
fbe740
 
fbe740
-    if (qemuDomainStorageSourceAccessModifyNVMe(driver, vm, src, false) < 0)
fbe740
-        goto revoke;
fbe740
-
fbe740
-    revoke_nvme = true;
fbe740
-
fbe740
-    /* When modifying access of existing @src namespace does not need update */
fbe740
     if (!(flags & QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_MODIFY_ACCESS)) {
fbe740
+        if (qemuDomainStorageSourceAccessModifyNVMe(driver, vm, src, false) < 0)
fbe740
+            goto revoke;
fbe740
+
fbe740
+        revoke_nvme = true;
fbe740
+
fbe740
         if (qemuDomainNamespaceSetupDisk(vm, src) < 0)
fbe740
             goto revoke;
fbe740
 
fbe740
-- 
fbe740
2.25.0
fbe740