9c6c51
From 448e9008661651e4a232e3919e13cc9114c4bdc9 Mon Sep 17 00:00:00 2001
9c6c51
Message-Id: <448e9008661651e4a232e3919e13cc9114c4bdc9@dist-git>
9c6c51
From: Michal Privoznik <mprivozn@redhat.com>
9c6c51
Date: Wed, 11 Jul 2018 17:27:24 +0200
9c6c51
Subject: [PATCH] qemuDomainValidateStorageSource: Relax PR validation
9c6c51
MIME-Version: 1.0
9c6c51
Content-Type: text/plain; charset=UTF-8
9c6c51
Content-Transfer-Encoding: 8bit
9c6c51
9c6c51
https://bugzilla.redhat.com/show_bug.cgi?id=1470007
9c6c51
9c6c51
Rather than rejecting the user provided path and alias for the
9c6c51
managed PR reservation we will ignore the provided path. The
9c6c51
reason is that migration XML does contain path even for managed
9c6c51
reservations.
9c6c51
9c6c51
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9c6c51
(cherry picked from commit 900403a3b2fe76ec3e03086c24a2d5480a7a6b06)
9c6c51
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9c6c51
Reviewed-by: Ján Tomko <jtomko@redhat.com>
9c6c51
---
9c6c51
 src/qemu/qemu_domain.c | 19 ++++++-------------
9c6c51
 1 file changed, 6 insertions(+), 13 deletions(-)
9c6c51
9c6c51
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
9c6c51
index f9bcf76f44..cfecbaca74 100644
9c6c51
--- a/src/qemu/qemu_domain.c
9c6c51
+++ b/src/qemu/qemu_domain.c
9c6c51
@@ -4615,19 +4615,11 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
9c6c51
         }
9c6c51
     }
9c6c51
 
9c6c51
-    if (src->pr) {
9c6c51
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER)) {
9c6c51
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
9c6c51
-                           _("reservations not supported with this QEMU binary"));
9c6c51
-            return -1;
9c6c51
-        }
9c6c51
-
9c6c51
-        if (virStoragePRDefIsManaged(src->pr) && src->pr->path) {
9c6c51
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
9c6c51
-                           _("'path' attribute should not be provided for "
9c6c51
-                             "managed reservations"));
9c6c51
-            return -1;
9c6c51
-        }
9c6c51
+    if (src->pr &&
9c6c51
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER)) {
9c6c51
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
9c6c51
+                       _("reservations not supported with this QEMU binary"));
9c6c51
+        return -1;
9c6c51
     }
9c6c51
 
9c6c51
     return 0;
9c6c51
@@ -12831,6 +12823,7 @@ qemuDomainPrepareStorageSourcePR(virStorageSourcePtr src,
9c6c51
         return 0;
9c6c51
 
9c6c51
     if (virStoragePRDefIsManaged(src->pr)) {
9c6c51
+        VIR_FREE(src->pr->path);
9c6c51
         if (!(src->pr->path = qemuDomainGetManagedPRSocketPath(priv)))
9c6c51
             return -1;
9c6c51
         if (VIR_STRDUP(src->pr->mgralias, qemuDomainGetManagedPRAlias()) < 0)
9c6c51
-- 
9c6c51
2.18.0
9c6c51