render / rpms / libvirt

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