[libvirt] [PATCH for 1.2.7 8/8] qemu: Implement virConnectGetDomainCapabilities

Daniel P. Berrange berrange at redhat.com
Wed Jul 2 14:56:35 UTC 2014


On Mon, Jun 30, 2014 at 05:31:51PM +0200, Michal Privoznik wrote:
> So far only information on disks and host devices are exposed in the
> capabilities XML. Well, at least something. Even a new test is
> introduced. The qemu capabilities are stolen from already existing
> qemucapabilities test. There's one tricky point though. Functions that
> checks host's KVM and VFIO capabilities, are impossible to mock
> currently. So in the test, we are setting the capabilities by hand.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/libvirt_private.syms                           |   1 +
>  src/qemu/qemu_capabilities.c                       |  90 ++++++++++++++++++
>  src/qemu/qemu_capabilities.h                       |   4 +
>  src/qemu/qemu_driver.c                             | 101 +++++++++++++++++++++
>  tests/Makefile.am                                  |   5 +
>  .../domaincaps-qemu_1.6.50-1.xml                   |  44 +++++++++
>  tests/domaincapstest.c                             |  45 +++++++++
>  7 files changed, 290 insertions(+)
>  create mode 100644 tests/domaincapsschemadata/domaincaps-qemu_1.6.50-1.xml
> 


> +static void
> +virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps,
> +                                    virDomainCapsDeviceDiskPtr disk)
> +{
> +    disk->device.supported = true;
> +    /* QEMU supports all of these */
> +    VIR_DOMAIN_CAPS_ENUM_SET(disk->diskDevice,
> +                             VIR_DOMAIN_DISK_DEVICE_DISK,
> +                             VIR_DOMAIN_DISK_DEVICE_CDROM,
> +                             VIR_DOMAIN_DISK_DEVICE_FLOPPY);
> +
> +    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO))
> +        VIR_DOMAIN_CAPS_ENUM_SET(disk->diskDevice, VIR_DOMAIN_DISK_DEVICE_LUN);
> +
> +    VIR_DOMAIN_CAPS_ENUM_SET(disk->bus,
> +                             VIR_DOMAIN_DISK_BUS_IDE,
> +                             VIR_DOMAIN_DISK_BUS_FDC,
> +                             VIR_DOMAIN_DISK_BUS_SCSI,
> +                             VIR_DOMAIN_DISK_BUS_VIRTIO,
> +                             VIR_DOMAIN_DISK_BUS_SD);

I have a feeling that 'SD' is not supported in all QEMU's we claim to
work with, though perhaps we've never checked this before when
building the CLI args.

> +
> +    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE))
> +        VIR_DOMAIN_CAPS_ENUM_SET(disk->bus, VIR_DOMAIN_DISK_BUS_USB);
> +}
> +
> +

> +    <hostdev supported='yes'>
> +      <enum name='mode'/>

Hmm, so that's claiming we don't support any values for
the mode attribute, but we support subsys.

> +      <enum name='startupPolicy'>
> +        <value>default</value>
> +        <value>mandatory</value>
> +        <value>requisite</value>
> +        <value>optional</value>
> +      </enum>
> +      <enum name='subsysType'>
> +        <value>usb</value>
> +        <value>pci</value>
> +        <value>scsi</value>
> +      </enum>
> +      <enum name='capsType'/>

Yep, only LXC supports the caps mode.

> +      <enum name='pciBackend'>
> +        <value>default</value>
> +        <value>kvm</value>
> +        <value>vfio</value>
> +      </enum>
> +    </hostdev>
> +  </devices>
> +</domainCapabilities>


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list