On Wed, Mar 14, 2018 at 17:05:34 +0100, Michal Privoznik wrote:
Now that we generate pr-manager alias and socket path store them
in status XML so that they are preserved across daemon restarts.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_domain.c | 108 +++++++++++++++++++++++++++++++++++++++----------
1 file changed, 86 insertions(+), 22 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c17e40dc8..d673ddbb2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
[...]
+static int
+qemuStorageSourcePrivateDataFormatPR(virStorageSourcePtr src,
+ virBufferPtr buf)
+{
+ qemuDomainStorageSourcePrivatePtr srcPriv =
QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
+ qemuDomainDiskPRDPtr prd;
+
+ if (!srcPriv || !srcPriv->prd)
+ return 0;
+
+ prd = srcPriv->prd;
+
+ virBufferAddLit(buf, "<prd>\n");
+ virBufferAdjustIndent(buf, 2);
+ virBufferAsprintf(buf, "<alias>%s</alias>\n", prd->alias);
+ virBufferAsprintf(buf, "<path>%s</path>\n", prd->path);
'path' is user-controlled, so you need to use the 'virBufferEscape'
function.
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</prd>\n");
+ return 0;
+}
+