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

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