[libvirt-users] Libvirt for virtual devices like virtual printers

Andrea Bolognani abologna at redhat.com
Thu Feb 8 14:44:12 UTC 2018


On Thu, 2018-02-08 at 09:27 +0530, Deepti S wrote:
> Hi,
> 
> I have a couple of questions.
> 
> -  I am a new libvirt code user. I have just cloned the repo and I am looking
> for a suitable debugger/IDE which will help me debug the code.
> 
> -  I work in developing and creating virtual printers with display, with QEMU
> as the hypervisor (no KVM-only Qemu).  Currently we have our own application
> to manage the virtual printers. Our plan is to migrate to libvirt, and enable
> our application to use the libvirt APIs.
> 
>    libvirt code currently looks to be specialized in pure OS-specific guests
>    (like PCs), and I hit snags where there are manadatory devices added which
>    a virtual printer does not need.
> 
>    Are there any users who are looking into customized virtual devices? I
>    would like to knowledge share with them.
> 
>   The intention is to provide new libvirt APIs whenever there is such a snag
>   and thus enable libvirt to be used for managing virtual printers.

IIUC your "virtual printer with display" is basically a custom
machine type you have implemented out-of-tree in QEMU, along with
the relevant custom devices, is that right?

You can certainly drive custom virtual hardware with libvirt, but
you're probably going to run into a lot of issue like the one you
describe below: libvirt embeds a lot of knowledge about the
specifics of standard QEMU machines and devices, so the closer
your custom hardware is to that, the lesser work you'll have in
front of you, and vice versa.

> -  One issue that we are seeing is with regard to USB Host Controller: We
> have a customized model of ehci USB Host Controller (named nr52_ehci_usb) in
> qemu (locally built).  When I add the custom value (n552_ehci_usb) of the
> host controller as the "model" type in my dom xml, virsh define <xml> fails
> with invalid model type error.
> 
>     I remove the usb controller entry from the xml, and add "-usb" as a
>     "qemucommandline" parameter, but then libvirt adds the device lsi
>     (-device lsi,id=scsi0 -usb), and the virsh create command fails with:
>     "-device lsi,id=scsi0 No PCI bus found for lsi53c895a". 
> 
>    The board we have created in QEMU does not have PCI bus implemented.
> 
> 
>    Is there any way I can get my usb host controller to be recognized by
>    libvirt?  Is there a way I can prevent lsi device from getting added when
>    I make -usb a qemu command line parameter?

Try looking for the virDomainControllerModelUSB enumeration and
adding your custom model there. There are a lot of other places
that will need adjusting after that, but it's a good start.
qemu:commandline can be a way out in some cases, but in general
it should be avoided because it's completely opaque to libvirt.

The lsi device is a SCSI controller, so it probably shows up
because you've configured your guest to use SCSI disks. I have
no idea what a good alternative to that would be in your case.

Good luck!

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvirt-users mailing list