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