From 3b5181b731c9f20001ea97adabe7128500fec756 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 30 May 2018 12:18:37 +0200 Subject: [PATCH] qemu: domain: Regenerate alias for the TLS x509 credential object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/qemu/qemu_domain.c | 7 +++++++ .../disk-secinfo-upgrade-in.xml | 10 ++++++++++ .../disk-secinfo-upgrade-out.xml | 15 +++++++++++++++ 3 files changed, 32 insertions(+) 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 @@
+ + + + + + + + + + + + + +
+
-- GitLab