[libvirt] How to detect if qemu supports discard?

Martin Kletzander mkletzan at redhat.com
Sun Mar 9 22:19:47 UTC 2014


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.

Martin

> Rich.
>
> --
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> libguestfs lets you edit virtual machines.  Supports shell scripting,
> bindings from many languages.  http://libguestfs.org
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140309/824ac1f3/attachment-0001.sig>


More information about the libvir-list mailing list