[libvirt] [PATCH v2 23/25] qemu: Support virtio-serial controller model=virtio-{non-}transitional

Andrea Bolognani abologna at redhat.com
Tue Jan 29 15:14:41 UTC 2019


On Tue, 2019-01-29 at 15:53 +0100, Andrea Bolognani wrote:
> On Wed, 2019-01-23 at 16:32 -0500, Cole Robinson wrote:
> [...]
> > @@ -525,11 +525,21 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
> >              ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL;
> >              break;
> >  
> > +        case VIR_DOMAIN_DEVICE_CONTROLLER:
> > +            if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) {
> > +                has_tmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL;
> > +                has_ntmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL;
> > +                tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_TRANSITIONAL;
> > +                ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_NON_TRANSITIONAL;
> > +            } else {
> > +                return 0;
> > +            }
> 
> Please invert this, same as for hostdevs and input devices, so that
> it looks like
> 
>   case VIR_DOMAIN_DEVICE_CONTROLLER:
>       if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL)
>           return 0;
>       ...

Oh, I see now that you add another branch in the following commit,
which of course makes the above not applicable.

You can either leave it as is or turn it into a switch statement,
the latter being my personal preference.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list