提交 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
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, "<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)
return -1;
......
......@@ -309,6 +309,10 @@
<format type='qcow2'/>
<source file='/var/lib/libvirt/images/base.qcow2'>
<privateData>
<nodenames>
<nodename type='storage' name='test-storage'/>
<nodename type='format' name='test-format'/>
</nodenames>
<relPath>base.qcow2</relPath>
</privateData>
</source>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册