提交 1f1aa21c 编写于 作者: P Peter Krempa

qemu: domain: Store and restore TLS object alias of a disk

Libvirt uses the stored alias to detach the TLS x509 object on disk
unplug. As the alias was not stored, the object would not be detached
if unplugging disks after libvirtd restart.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 5e8218fa
......@@ -2023,6 +2023,7 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
src->nodestorage = virXPathString("string(./nodenames/nodename[@type='storage']/@name)", ctxt);
src->nodeformat = virXPathString("string(./nodenames/nodename[@type='format']/@name)", ctxt);
src->tlsAlias = virXPathString("string(./objects/TLSx509/@alias)", ctxt);
if (src->pr)
src->pr->mgralias = virXPathString("string(./reservations/@mgralias)", ctxt);
......@@ -2102,6 +2103,9 @@ qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
qemuStorageSourcePrivateDataFormatSecinfo(&tmp, srcPriv->encinfo, "encryption");
}
if (src->tlsAlias)
virBufferAsprintf(&tmp, "<TLSx509 alias='%s'/>\n", src->tlsAlias);
if (virXMLFormatElement(buf, "objects", NULL, &tmp) < 0)
goto cleanup;
......
......@@ -322,6 +322,7 @@
<objects>
<secret type='auth' alias='test-auth-alias'/>
<secret type='encryption' alias='test-encryption-alias'/>
<TLSx509 alias='transport-alias'/>
</objects>
</privateData>
</source>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册