]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: domain: Regenerate alias for the TLS x509 credential object
authorPeter Krempa <pkrempa@redhat.com>
Wed, 30 May 2018 10:18:37 +0000 (12:18 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 5 Jun 2018 06:13:57 +0000 (08:13 +0200)
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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_domain.c
tests/qemustatusxml2xmldata/disk-secinfo-upgrade-in.xml
tests/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml

index d174fa70d81e6cf169e95169330c39491b3196dc..e3f279f6637b5ee134fa6c517c164b9aa82f769a 100644 (file)
@@ -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;
 }
 
index d364fc7644bbd935ec1955249a46ffab42c555bf..ce55a7063798962b828c1d597cb3e8e8d45f60b0 100644 (file)
         <alias name='virtio-disk5'/>
         <address type='pci' domain='0x0000' bus='0x00' slot='0x0f' function='0x0'/>
       </disk>
+      <disk type='network' device='disk'>
+        <driver name='qemu' type='raw'/>
+        <source protocol='vxhs' name='rbdpool/rbdimg' tls='yes' tlsFromConfig='0'>
+          <host name='example.org'/>
+        </source>
+        <backingStore/>
+        <target dev='vdg' bus='virtio'/>
+        <alias name='virtio-disk6'/>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
+      </disk>
       <controller type='usb' index='0' model='ich9-ehci1'>
         <alias name='usb'/>
         <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x7'/>
index a554bca99c48cadb2f10c3135bedf9f0d40aabb9..7a26e93aa4ab89f5c385382a23cfb13bc184bf57 100644 (file)
         <alias name='virtio-disk5'/>
         <address type='pci' domain='0x0000' bus='0x00' slot='0x0f' function='0x0'/>
       </disk>
+      <disk type='network' device='disk'>
+        <driver name='qemu' type='raw'/>
+        <source protocol='vxhs' name='rbdpool/rbdimg' tls='yes' tlsFromConfig='0'>
+          <host name='example.org' port='9999'/>
+          <privateData>
+            <objects>
+              <TLSx509 alias='objvirtio-disk6_tls0'/>
+            </objects>
+          </privateData>
+        </source>
+        <backingStore/>
+        <target dev='vdg' bus='virtio'/>
+        <alias name='virtio-disk6'/>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
+      </disk>
       <controller type='usb' index='0' model='ich9-ehci1'>
         <alias name='usb'/>
         <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x7'/>