[libvirt] [PATCH 7/7] virsh: use new virNodeDeviceDetachFlags

Eric Blake eblake at redhat.com
Thu Apr 25 02:12:19 UTC 2013


On 04/24/2013 01:26 PM, Laine Stump wrote:
> The virsh nodedev-detach command has a new --driver option. If it's
> given virsh will attempt to use the new virNodeDeviceDetachFlags API
> instead of virNodeDeviceDettach. Validation of the driver name string
> is left to the hypervisor (qemu accepts "kvm" or "vfio". The only
> other hypervisor that implements these functions is xen, and it only
> accepts NULL).
> ---
>  tools/virsh-nodedev.c | 28 +++++++++++++++++++++-------
>  1 file changed, 21 insertions(+), 7 deletions(-)


> -    /* Yes, our public API is misspelled.  At least virsh can accept
> -     * either spelling.  */
> -    if (virNodeDeviceDettach(device) == 0) {
> -        vshPrint(ctl, _("Device %s detached\n"), name);
> +    if (driverName) {
> +        /* we must use the newer API that accepts a driverName */
> +        if (virNodeDeviceDetachFlags(device, driverName, 0) < 0)
> +            ret = false;
>      } else {
> -        vshError(ctl, _("Failed to detach device %s"), name);
> -        ret = false;
> +        /* Yes, our (old) public API is misspelled.  At least virsh
> +         * can accept either spelling.  */
> +        if (virNodeDeviceDettach(device) < 0)
> +            ret = false;

I'm glad you fixed the spelling in the new api; I'm also glad you still
added a Flags suffix instead of using the subtle change in spelling as
the only distinguishing factor.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130424/f2e3c97e/attachment-0001.sig>


More information about the libvir-list mailing list