[libvirt] How to detect if qemu supports discard?

Daniel P. Berrange berrange at redhat.com
Mon Mar 10 10:30:21 UTC 2014


On Sun, Mar 09, 2014 at 11:19:47PM +0100, Martin Kletzander wrote:
> On Sun, Mar 09, 2014 at 03:23:25PM +0000, Richard W.M. Jones wrote:
> > from src/qemu/qemu_command.c:
> >
> >     if (disk->discard) {
> >         if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_DISCARD)) {
> >             virBufferAsprintf(&opt, ",discard=%s",
> >                               virDomainDiskDiscardTypeToString(disk->discard));
> >         } else {
> >             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> >                            _("discard is not supported by this QEMU binary"));
> >             goto error;
> >         }
> >     }
> >
> > However there appears to be no way to tell programmatically if the
> > qemu binary supports discard (ie. via libvirt).  Therefore libguestfs
> > can never know when it is safe to use this option in the XML.
> >
> 
> Many of these requests/issues are appearing lately.  Can we dump qemu
> caps with normal capablities with e.g. "virsh capabilities --verbose"?
> We have to keep the strings used consitent anyway since it's used in
> migration data and so on.

Stability isn't the only concern for the public API. The representation
of the data is just as important if not more so. The QEMU capabilities
are intimately related to the QEMU command line arg syntax, so not at
all suitable for the public API.

We need to consider logical features individually and determine how
to expose info about their hypervisor support matrix.

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