render / rpms / libvirt

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