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

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