Blame SOURCES/libvirt-virStoragePRDefFormat-Suppress-path-formatting-for-migratable-XML.patch

982648
From 93033dbc3db732627db049e6d491c58e1efa5547 Mon Sep 17 00:00:00 2001
982648
Message-Id: <93033dbc3db732627db049e6d491c58e1efa5547@dist-git>
982648
From: Michal Privoznik <mprivozn@redhat.com>
982648
Date: Wed, 11 Jul 2018 17:27:25 +0200
982648
Subject: [PATCH] virStoragePRDefFormat: Suppress path formatting for
982648
 migratable XML
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
If there are managed reservations for a disk source, the path to
982648
the pr-helper socket is generated automatically by libvirt when
982648
needed and points somewhere under priv->libDir. Therefore it is
982648
very unlikely that the path will work even on migration
982648
destination (the libDir is derived from domain short name and its
982648
ID).
982648
982648
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
982648
(cherry picked from commit 0da435118cb2abe5b747818fc209c7a647590687)
982648
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
982648
Reviewed-by: Ján Tomko <jtomko@redhat.com>
982648
---
982648
 src/conf/domain_conf.c    | 3 ++-
982648
 src/util/virstoragefile.c | 6 ++++--
982648
 src/util/virstoragefile.h | 3 ++-
982648
 3 files changed, 8 insertions(+), 4 deletions(-)
982648
982648
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
982648
index f4e59f6c91..70eb45f03a 100644
982648
--- a/src/conf/domain_conf.c
982648
+++ b/src/conf/domain_conf.c
982648
@@ -23548,7 +23548,8 @@ virDomainStorageSourceFormat(virBufferPtr attrBuf,
982648
         return -1;
982648
 
982648
     if (src->pr)
982648
-        virStoragePRDefFormat(childBuf, src->pr);
982648
+        virStoragePRDefFormat(childBuf, src->pr,
982648
+                              flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE);
982648
 
982648
     return 0;
982648
 }
982648
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
982648
index 6ede542df6..58f67278da 100644
982648
--- a/src/util/virstoragefile.c
982648
+++ b/src/util/virstoragefile.c
982648
@@ -1982,11 +1982,13 @@ virStoragePRDefParseXML(xmlXPathContextPtr ctxt)
982648
 
982648
 void
982648
 virStoragePRDefFormat(virBufferPtr buf,
982648
-                      virStoragePRDefPtr prd)
982648
+                      virStoragePRDefPtr prd,
982648
+                      bool migratable)
982648
 {
982648
     virBufferAsprintf(buf, "
982648
                       virTristateBoolTypeToString(prd->managed));
982648
-    if (prd->path) {
982648
+    if (prd->path &&
982648
+        (prd->managed == VIR_TRISTATE_BOOL_NO || !migratable)) {
982648
         virBufferAddLit(buf, ">\n");
982648
         virBufferAdjustIndent(buf, 2);
982648
         virBufferAddLit(buf, "
982648
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
982648
index 592e19bd7f..991098e6c6 100644
982648
--- a/src/util/virstoragefile.h
982648
+++ b/src/util/virstoragefile.h
982648
@@ -395,7 +395,8 @@ void virStorageAuthDefFormat(virBufferPtr buf, virStorageAuthDefPtr authdef);
982648
 void virStoragePRDefFree(virStoragePRDefPtr prd);
982648
 virStoragePRDefPtr virStoragePRDefParseXML(xmlXPathContextPtr ctxt);
982648
 void virStoragePRDefFormat(virBufferPtr buf,
982648
-                           virStoragePRDefPtr prd);
982648
+                           virStoragePRDefPtr prd,
982648
+                           bool migratable);
982648
 bool virStoragePRDefIsEqual(virStoragePRDefPtr a,
982648
                             virStoragePRDefPtr b);
982648
 bool virStoragePRDefIsManaged(virStoragePRDefPtr prd);
982648
-- 
982648
2.18.0
982648