From: Peter Krempa Date: Wed, 30 May 2018 10:03:41 +0000 (+0200) Subject: qemu: domain: Store and restore TLS object alias of a disk X-Git-Tag: v4.5.0-rc1~335 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f1aa21cb96d1698b16337beadb4cde19fe3c3d8;p=thirdparty%2Flibvirt.git 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: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0b50935938..d174fa70d8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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, "\n", src->tlsAlias); + if (virXMLFormatElement(buf, "objects", NULL, &tmp) < 0) goto cleanup; diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxml2xmldata/modern-in.xml index 42869261d0..4fb5f326c2 100644 --- a/tests/qemustatusxml2xmldata/modern-in.xml +++ b/tests/qemustatusxml2xmldata/modern-in.xml @@ -322,6 +322,7 @@ +