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