]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: domain: Store and restore TLS object alias of a disk
authorPeter Krempa <pkrempa@redhat.com>
Wed, 30 May 2018 10:03:41 +0000 (12:03 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 5 Jun 2018 06:13:57 +0000 (08:13 +0200)
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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_domain.c
tests/qemustatusxml2xmldata/modern-in.xml

index 0b50935938cb82c74a1b0f8081e8b4efcf04c3d0..d174fa70d81e6cf169e95169330c39491b3196dc 100644 (file)
@@ -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;
 
index 42869261d083ccefff88feffb7ed562a9cfdef96..4fb5f326c2e772a1a0eb8e327983174adc667c37 100644 (file)
               <objects>
                 <secret type='auth' alias='test-auth-alias'/>
                 <secret type='encryption' alias='test-encryption-alias'/>
+                <TLSx509 alias='transport-alias'/>
               </objects>
             </privateData>
           </source>