From 38fd7aec33d3e990f2511da1093473674f66f309 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 1 Mar 2018 18:39:45 +0100 Subject: [PATCH] qemu: domain: Format storage source node names into private data Save and restore node names if we know them or when we will be generating them in the status XML. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 12 ++++++++++++ tests/qemustatusxml2xmldata/modern-in.xml | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 727ea33f14..0648703fd9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1937,6 +1937,9 @@ static int qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt, virStorageSourcePtr src) { + src->nodestorage = virXPathString("string(./nodenames/nodename[@type='storage']/@name)", ctxt); + src->nodeformat = virXPathString("string(./nodenames/nodename[@type='format']/@name)", ctxt); + if (virStorageSourcePrivateDataParseRelPath(ctxt, src) < 0) return -1; @@ -1948,6 +1951,15 @@ static int qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src, virBufferPtr buf) { + if (src->nodestorage || src->nodeformat) { + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + virBufferEscapeString(buf, "\n", src->nodestorage); + virBufferEscapeString(buf, "\n", src->nodeformat); + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + } + if (virStorageSourcePrivateDataFormatRelPath(src, buf) < 0) return -1; diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxml2xmldata/modern-in.xml index c1e57618b6..d57e1f605f 100644 --- a/tests/qemustatusxml2xmldata/modern-in.xml +++ b/tests/qemustatusxml2xmldata/modern-in.xml @@ -309,6 +309,10 @@ + + + + base.qcow2 -- GitLab