mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
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 <pkrempa@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
3817fa10c4
commit
38fd7aec33
@ -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
|
|||||||
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 @@
|
|||||||
<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>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user