Blob Blame History Raw
From c20e818be2240b2399a0d23d8b819e525a2a4d92 Mon Sep 17 00:00:00 2001
Message-Id: <c20e818be2240b2399a0d23d8b819e525a2a4d92@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Wed, 11 Jul 2018 17:27:24 +0200
Subject: [PATCH] qemuDomainValidateStorageSource: Relax PR validation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

https://bugzilla.redhat.com/show_bug.cgi?id=1470007

Rather than rejecting the user provided path and alias for the
managed PR reservation we will ignore the provided path. The
reason is that migration XML does contain path even for managed
reservations.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 900403a3b2fe76ec3e03086c24a2d5480a7a6b06)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/qemu/qemu_domain.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f9bcf76f44..cfecbaca74 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4615,19 +4615,11 @@ qemuDomainValidateStorageSource(virStorageSourcePtr src,
         }
     }
 
-    if (src->pr) {
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("reservations not supported with this QEMU binary"));
-            return -1;
-        }
-
-        if (virStoragePRDefIsManaged(src->pr) && src->pr->path) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("'path' attribute should not be provided for "
-                             "managed reservations"));
-            return -1;
-        }
+    if (src->pr &&
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("reservations not supported with this QEMU binary"));
+        return -1;
     }
 
     return 0;
@@ -12831,6 +12823,7 @@ qemuDomainPrepareStorageSourcePR(virStorageSourcePtr src,
         return 0;
 
     if (virStoragePRDefIsManaged(src->pr)) {
+        VIR_FREE(src->pr->path);
         if (!(src->pr->path = qemuDomainGetManagedPRSocketPath(priv)))
             return -1;
         if (VIR_STRDUP(src->pr->mgralias, qemuDomainGetManagedPRAlias()) < 0)
-- 
2.18.0