提交 38fd7aec 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 3817fa10
...@@ -1937,6 +1937,9 @@ static int ...@@ -1937,6 +1937,9 @@ static int
qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt, qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
virStorageSourcePtr src) 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) if (virStorageSourcePrivateDataParseRelPath(ctxt, src) < 0)
return -1; return -1;
...@@ -1948,6 +1951,15 @@ static int ...@@ -1948,6 +1951,15 @@ static int
qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src, qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
virBufferPtr buf) virBufferPtr buf)
{ {
if (src->nodestorage || src->nodeformat) {
virBufferAddLit(buf, "<nodenames>\n");
virBufferAdjustIndent(buf, 2);
virBufferEscapeString(buf, "<nodename type='storage' name='%s'/>\n", src->nodestorage);
virBufferEscapeString(buf, "<nodename type='format' name='%s'/>\n", src->nodeformat);
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</nodenames>\n");
}
if (virStorageSourcePrivateDataFormatRelPath(src, buf) < 0) if (virStorageSourcePrivateDataFormatRelPath(src, buf) < 0)
return -1; return -1;
......
...@@ -309,6 +309,10 @@ ...@@ -309,6 +309,10 @@
<format type='qcow2'/> <format type='qcow2'/>
<source file='/var/lib/libvirt/images/base.qcow2'> <source file='/var/lib/libvirt/images/base.qcow2'>
<privateData> <privateData>
<nodenames>
<nodename type='storage' name='test-storage'/>
<nodename type='format' name='test-format'/>
</nodenames>
<relPath>base.qcow2</relPath> <relPath>base.qcow2</relPath>
</privateData> </privateData>
</source> </source>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册