]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: storage: Add helpers to parse and format relPath into privateData
authorPeter Krempa <pkrempa@redhat.com>
Wed, 13 Dec 2017 16:04:54 +0000 (17:04 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 14 Dec 2017 09:27:30 +0000 (10:27 +0100)
This will be the first private piece of data that will need to be stored
in the XML for some drivers. Add helpers which will do it.

src/libvirt_private.syms
src/util/virstoragefile.c
src/util/virstoragefile.h

index b4b72c073417dc28172924f87c95ca8d79798a53..d5c3b9abb54e29ce5f470194fda7d98aa4bbe16c 100644 (file)
@@ -2734,6 +2734,8 @@ virStorageSourceParseRBDColonString;
 virStorageSourcePoolDefFree;
 virStorageSourcePoolModeTypeFromString;
 virStorageSourcePoolModeTypeToString;
+virStorageSourcePrivateDataFormatRelPath;
+virStorageSourcePrivateDataParseRelPath;
 virStorageSourceUpdateBackingSizes;
 virStorageSourceUpdateCapacity;
 virStorageSourceUpdatePhysicalSize;
index 6594715e5e56ce3dbbf41b121e32037cf93b4d68..5780180a94ef5180c83bb7cb20bc9a3807daaefe 100644 (file)
@@ -4086,3 +4086,23 @@ virStorageSourceNetworkAssignDefaultPorts(virStorageSourcePtr src)
             src->hosts[i].port = virStorageSourceNetworkDefaultPort(src->protocol);
     }
 }
+
+
+int
+virStorageSourcePrivateDataParseRelPath(xmlXPathContextPtr ctxt,
+                                        virStorageSourcePtr src)
+{
+    src->relPath = virXPathString("string(./relPath)", ctxt);
+    return 0;
+}
+
+
+int
+virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src,
+                                         virBufferPtr buf)
+{
+    if (src->relPath)
+        virBufferEscapeString(buf, "<relPath>%s</relPath>\n", src->relPath);
+
+    return 0;
+}
index 24382a0a6b3cf03c8fbec0b8ad32dea583649963..ecd806c93f842150baea4676cb5611fd2a7e7438 100644 (file)
@@ -441,4 +441,12 @@ bool
 virStorageSourceHasBacking(const virStorageSource *src);
 
 
+int
+virStorageSourcePrivateDataParseRelPath(xmlXPathContextPtr ctxt,
+                                        virStorageSourcePtr src);
+int
+virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src,
+                                         virBufferPtr buf);
+
+
 #endif /* __VIR_STORAGE_FILE_H__ */