]> xenbits.xensource.com Git - libvirt.git/commitdiff
virStoragePRDefFormat: Suppress path formatting for migratable XML
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Jul 2018 11:58:33 +0000 (13:58 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 10 Jul 2018 12:56:22 +0000 (14:56 +0200)
If there are managed reservations for a disk source, the path to
the pr-helper socket is generated automatically by libvirt when
needed and points somewhere under priv->libDir. Therefore it is
very unlikely that the path will work even on migration
destination (the libDir is derived from domain short name and its
ID).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/domain_conf.c
src/util/virstoragefile.c
src/util/virstoragefile.h

index 7ab2953d837edc694976d7891fb07711d2d06d65..7396616eda210630b39f9699b759bdb353568ebb 100644 (file)
@@ -23565,7 +23565,8 @@ virDomainStorageSourceFormat(virBufferPtr attrBuf,
         return -1;
 
     if (src->pr)
-        virStoragePRDefFormat(childBuf, src->pr);
+        virStoragePRDefFormat(childBuf, src->pr,
+                              flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE);
 
     return 0;
 }
index 6ede542df65b264579cb56087aad2882e71a17d9..58f67278da9cca520b0f57541dff7714215eb277 100644 (file)
@@ -1982,11 +1982,13 @@ virStoragePRDefParseXML(xmlXPathContextPtr ctxt)
 
 void
 virStoragePRDefFormat(virBufferPtr buf,
-                      virStoragePRDefPtr prd)
+                      virStoragePRDefPtr prd,
+                      bool migratable)
 {
     virBufferAsprintf(buf, "<reservations managed='%s'",
                       virTristateBoolTypeToString(prd->managed));
-    if (prd->path) {
+    if (prd->path &&
+        (prd->managed == VIR_TRISTATE_BOOL_NO || !migratable)) {
         virBufferAddLit(buf, ">\n");
         virBufferAdjustIndent(buf, 2);
         virBufferAddLit(buf, "<source type='unix'");
index 592e19bd7fe56735b1a5636f68b508287d930eef..991098e6c69562aebe5992d7f0990747d174801c 100644 (file)
@@ -395,7 +395,8 @@ void virStorageAuthDefFormat(virBufferPtr buf, virStorageAuthDefPtr authdef);
 void virStoragePRDefFree(virStoragePRDefPtr prd);
 virStoragePRDefPtr virStoragePRDefParseXML(xmlXPathContextPtr ctxt);
 void virStoragePRDefFormat(virBufferPtr buf,
-                           virStoragePRDefPtr prd);
+                           virStoragePRDefPtr prd,
+                           bool migratable);
 bool virStoragePRDefIsEqual(virStoragePRDefPtr a,
                             virStoragePRDefPtr b);
 bool virStoragePRDefIsManaged(virStoragePRDefPtr prd);