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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]