|
|
c1c534 |
From a6aa51d7aa34a75355993d818a43bcb31094693e Mon Sep 17 00:00:00 2001
|
|
|
c1c534 |
Message-Id: <a6aa51d7aa34a75355993d818a43bcb31094693e@dist-git>
|
|
|
c1c534 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
c1c534 |
Date: Thu, 14 Dec 2017 14:31:52 +0100
|
|
|
c1c534 |
Subject: [PATCH] util: storage: Add helpers to parse and format relPath into
|
|
|
c1c534 |
privateData
|
|
|
c1c534 |
|
|
|
c1c534 |
This will be the first private piece of data that will need to be stored
|
|
|
c1c534 |
in the XML for some drivers. Add helpers which will do it.
|
|
|
c1c534 |
|
|
|
c1c534 |
(cherry picked from commit cd31709351142a2770d2b9baa7755eaed672710a)
|
|
|
c1c534 |
|
|
|
c1c534 |
https://bugzilla.redhat.com/show_bug.cgi?id=1523261
|
|
|
c1c534 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c1c534 |
---
|
|
|
c1c534 |
src/libvirt_private.syms | 2 ++
|
|
|
c1c534 |
src/util/virstoragefile.c | 20 ++++++++++++++++++++
|
|
|
c1c534 |
src/util/virstoragefile.h | 8 ++++++++
|
|
|
c1c534 |
3 files changed, 30 insertions(+)
|
|
|
c1c534 |
|
|
|
c1c534 |
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
|
c1c534 |
index cb76bbac87..478b3b3a6f 100644
|
|
|
c1c534 |
--- a/src/libvirt_private.syms
|
|
|
c1c534 |
+++ b/src/libvirt_private.syms
|
|
|
c1c534 |
@@ -2728,6 +2728,8 @@ virStorageSourceParseRBDColonString;
|
|
|
c1c534 |
virStorageSourcePoolDefFree;
|
|
|
c1c534 |
virStorageSourcePoolModeTypeFromString;
|
|
|
c1c534 |
virStorageSourcePoolModeTypeToString;
|
|
|
c1c534 |
+virStorageSourcePrivateDataFormatRelPath;
|
|
|
c1c534 |
+virStorageSourcePrivateDataParseRelPath;
|
|
|
c1c534 |
virStorageSourceUpdateBackingSizes;
|
|
|
c1c534 |
virStorageSourceUpdateCapacity;
|
|
|
c1c534 |
virStorageSourceUpdatePhysicalSize;
|
|
|
c1c534 |
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
|
|
|
c1c534 |
index 3a2d2aa056..d1e356a121 100644
|
|
|
c1c534 |
--- a/src/util/virstoragefile.c
|
|
|
c1c534 |
+++ b/src/util/virstoragefile.c
|
|
|
c1c534 |
@@ -4083,3 +4083,23 @@ virStorageSourceNetworkAssignDefaultPorts(virStorageSourcePtr src)
|
|
|
c1c534 |
src->hosts[i].port = virStorageSourceNetworkDefaultPort(src->protocol);
|
|
|
c1c534 |
}
|
|
|
c1c534 |
}
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+int
|
|
|
c1c534 |
+virStorageSourcePrivateDataParseRelPath(xmlXPathContextPtr ctxt,
|
|
|
c1c534 |
+ virStorageSourcePtr src)
|
|
|
c1c534 |
+{
|
|
|
c1c534 |
+ src->relPath = virXPathString("string(./relPath)", ctxt);
|
|
|
c1c534 |
+ return 0;
|
|
|
c1c534 |
+}
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+int
|
|
|
c1c534 |
+virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src,
|
|
|
c1c534 |
+ virBufferPtr buf)
|
|
|
c1c534 |
+{
|
|
|
c1c534 |
+ if (src->relPath)
|
|
|
c1c534 |
+ virBufferEscapeString(buf, "<relPath>%s</relPath>\n", src->relPath);
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+ return 0;
|
|
|
c1c534 |
+}
|
|
|
c1c534 |
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
|
|
|
c1c534 |
index af8f56c8a1..c909488024 100644
|
|
|
c1c534 |
--- a/src/util/virstoragefile.h
|
|
|
c1c534 |
+++ b/src/util/virstoragefile.h
|
|
|
c1c534 |
@@ -438,4 +438,12 @@ bool
|
|
|
c1c534 |
virStorageSourceHasBacking(const virStorageSource *src);
|
|
|
c1c534 |
|
|
|
c1c534 |
|
|
|
c1c534 |
+int
|
|
|
c1c534 |
+virStorageSourcePrivateDataParseRelPath(xmlXPathContextPtr ctxt,
|
|
|
c1c534 |
+ virStorageSourcePtr src);
|
|
|
c1c534 |
+int
|
|
|
c1c534 |
+virStorageSourcePrivateDataFormatRelPath(virStorageSourcePtr src,
|
|
|
c1c534 |
+ virBufferPtr buf);
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+
|
|
|
c1c534 |
#endif /* __VIR_STORAGE_FILE_H__ */
|
|
|
c1c534 |
--
|
|
|
c1c534 |
2.15.1
|
|
|
c1c534 |
|