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