[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [PATCH 1/2] virtinst: add default USB controller if it's missing



On 09/23/2011 11:13 AM, Marc-André Lureau wrote:
> ---
>  virtinst/Guest.py |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/virtinst/Guest.py b/virtinst/Guest.py
> index 3dd04d1..a28942c 100644
> --- a/virtinst/Guest.py
> +++ b/virtinst/Guest.py
> @@ -40,6 +40,7 @@ from VirtualDevice import VirtualDevice
>  from VirtualDisk import VirtualDisk
>  from VirtualInputDevice import VirtualInputDevice
>  from VirtualCharDevice import VirtualCharDevice
> +from VirtualController import VirtualControllerUSB
>  from Clock import Clock
>  from Seclabel import Seclabel
>  from CPU import CPU
> @@ -795,6 +796,17 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
>                                     parsexmlnode=devnode, caps=caps)
>                  self._add_device(dev)
>  
> +
> +        def has_usb_ctrl():
> +            for ctrl in self.get_devices(VirtualDevice.VIRTUAL_DEV_CONTROLLER):
> +                if ctrl.type == ctrl.CONTROLLER_TYPE_USB:
> +                    return True
> +            return False
> +
> +        if not has_usb_ctrl():
> +            ctrl = VirtualControllerUSB(self.conn)
> +            self.add_device(ctrl)
> +
>          self._installer = virtinst.Installer.Installer(self.conn,
>                                                     parsexmlnode=self._xml_node,
>                                                     caps=caps)

This breaks a bunch of the unit tests (python setup.py test)

So prior to modeling a usb controller in the libvirt XML, how did this all
work? Was libvirt unconditionally adding a USB1 controller to all qemu guests?
If so, libvirt should be adding a USB controller to the XML automatically and
we shouldn't need to do that explicitly here (similar to how memballoon=virtio
is always added for qemu guests, since we hardcoded it on qemu command line
before we added XML to configure it).

Thanks,
Cole


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]