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