[libvirt] [PATCH v2 02/10] qemu_hotplug: generate vioserial address list on demand

Martin Kletzander mkletzan at redhat.com
Mon Jul 25 15:01:04 UTC 2016


On Sat, Jul 23, 2016 at 03:47:07AM +0200, Tomasz Flendrich wrote:
>Dropping the caching of virtio serial address set.
>Instead of using the cached address set, a function in qemu_hotplug.c
>now recalculates it on demand.
>
>Credit goes to Cole Robinson.
>---
> src/qemu/qemu_hotplug.c | 38 ++++++++++++++++++++++++++------------
> 1 file changed, 26 insertions(+), 12 deletions(-)
>
>diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
>index 4e4bf82..5c82361 100644
>--- a/src/qemu/qemu_hotplug.c
>+++ b/src/qemu/qemu_hotplug.c
>@@ -1551,21 +1551,28 @@ qemuDomainChrRemove(virDomainDefPtr vmdef,
> }
>
> static int
>-qemuDomainAttachChrDeviceAssignAddr(qemuDomainObjPrivatePtr priv,
>+qemuDomainAttachChrDeviceAssignAddr(virDomainDefPtr def,
>+                                    qemuDomainObjPrivatePtr priv,
>                                     virDomainChrDefPtr chr)
> {
>+    int ret = -1;
>+    virDomainVirtioSerialAddrSetPtr vioaddrs = NULL;
>+
>+    if (!(vioaddrs = virDomainVirtioSerialAddrSetCreateFromDomain(def)))
>+        goto cleanup;
>+
>     if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
>         chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) {
>-        if (virDomainVirtioSerialAddrAutoAssign(NULL, priv->vioserialaddrs,
>+        if (virDomainVirtioSerialAddrAutoAssign(NULL, vioaddrs,
>                                                 &chr->info, true) < 0)
>-            return -1;
>-        return 1;
>+            goto cleanup;
>+        ret = 1;
>
>     } else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
>                chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI) {
>         if (virDomainPCIAddressEnsureAddr(priv->pciaddrs, &chr->info) < 0)
>-            return -1;
>-        return 1;
>+            goto cleanup;
>+        ret = 1;
>
>     } else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
>                chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB) {

You're missing one goto cleanup/ret = 1 here between these hunks.

ACK with that changed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160725/61e98198/attachment-0001.sig>


More information about the libvir-list mailing list