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