render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Blob Blame History Raw
From 659d623740e3f15135b4c7b1e44d18ee08e67a11 Mon Sep 17 00:00:00 2001
Message-Id: <659d623740e3f15135b4c7b1e44d18ee08e67a11@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 14 Feb 2020 16:17:08 +0100
Subject: [PATCH] qemu_domain: Modify access to a NVMe disk iff needed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If a domain has a NVMe disk it already has the access configured.
Trying to configure it again on a commit or some other operation
is wrong and condemned to failure.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit b18328256b565806c04c153ce49fc3641412b35b)

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1519005#c24

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <ee3871eb043b3ae82daca2e365b696c8963665f7.1581693409.git.mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/qemu/qemu_domain.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1bed117eb0..8e0e919f9a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11828,13 +11828,12 @@ qemuDomainStorageSourceAccessModify(virQEMUDriverPtr driver,
 
     revoke_lockspace = true;
 
-    if (qemuDomainStorageSourceAccessModifyNVMe(driver, vm, src, false) < 0)
-        goto revoke;
-
-    revoke_nvme = true;
-
-    /* When modifying access of existing @src namespace does not need update */
     if (!(flags & QEMU_DOMAIN_STORAGE_SOURCE_ACCESS_MODIFY_ACCESS)) {
+        if (qemuDomainStorageSourceAccessModifyNVMe(driver, vm, src, false) < 0)
+            goto revoke;
+
+        revoke_nvme = true;
+
         if (qemuDomainNamespaceSetupDisk(vm, src) < 0)
             goto revoke;
 
-- 
2.25.0