From: Peter Krempa Date: Wed, 30 May 2018 10:18:37 +0000 (+0200) Subject: qemu: domain: Regenerate alias for the TLS x509 credential object X-Git-Tag: v4.5.0-rc1~334 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b5181b731c9f20001ea97adabe7128500fec756;p=thirdparty%2Flibvirt.git qemu: domain: Regenerate alias for the TLS x509 credential object When restarting libvirt would previously lose the alias of the x509 certificate object. Upon unplug we would then not delete the corresponding objects. Restore the alias if we know it should be there. Luckily for disks we don't support encrypted TLS environment, so there's no need to regenerate the 'secret' alias for decryption. 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 d174fa70d8..e3f279f663 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5982,6 +5982,13 @@ qemuDomainDeviceDiskDefPostParse(virDomainDiskDefPtr disk, parseFlags) < 0) return -1; + /* regenerate TLS alias for old status XMLs */ + if (parseFlags & VIR_DOMAIN_DEF_PARSE_STATUS && + disk->src->haveTLS == VIR_TRISTATE_BOOL_YES && + !disk->src->tlsAlias && + !(disk->src->tlsAlias = qemuAliasTLSObjFromSrcAlias(disk->info.alias))) + return -1; + return 0; } diff --git a/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-in.xml b/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-in.xml index d364fc7644..ce55a70637 100644 --- a/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-in.xml +++ b/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-in.xml @@ -387,6 +387,16 @@
+ + + + + + + + +
+
diff --git a/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml b/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml index a554bca99c..7a26e93aa4 100644 --- a/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml +++ b/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml @@ -403,6 +403,21 @@
+ + + + + + + + + + + + + +
+