diff --git a/tools/virsh.c b/tools/virsh.c index ba3ea1c482..eb0eff489c 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -212,6 +212,7 @@ typedef struct vshCmdOpt { */ enum { VSH_CMD_FLAG_NOCONNECT = (1 << 0), /* no prior connection needed */ + VSH_CMD_FLAG_ALIAS = (1 << 1), /* command is an alias */ }; /* @@ -685,9 +686,12 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, _(" %s (help keyword '%s'):\n"), grp->name, grp->keyword); - for (def = grp->commands; def->name; def++) + for (def = grp->commands; def->name; def++) { + if (def->flags & VSH_CMD_FLAG_ALIAS) + continue; vshPrint(ctl, " %-30s %s\n", def->name, _(vshCmddefGetInfo(def, "help"))); + } vshPrint(ctl, "\n"); } @@ -13093,22 +13097,22 @@ cmdNodeDeviceDumpXML (vshControl *ctl, const vshCmd *cmd) } /* - * "nodedev-dettach" command + * "nodedev-detach" command */ -static const vshCmdInfo info_node_device_dettach[] = { - {"help", N_("dettach node device from its device driver")}, - {"desc", N_("Dettach node device from its device driver before assigning to a domain.")}, +static const vshCmdInfo info_node_device_detach[] = { + {"help", N_("detach node device from its device driver")}, + {"desc", N_("Detach node device from its device driver before assigning to a domain.")}, {NULL, NULL} }; -static const vshCmdOptDef opts_node_device_dettach[] = { +static const vshCmdOptDef opts_node_device_detach[] = { {"device", VSH_OT_DATA, VSH_OFLAG_REQ, N_("device key")}, {NULL, 0, 0, NULL} }; static bool -cmdNodeDeviceDettach (vshControl *ctl, const vshCmd *cmd) +cmdNodeDeviceDetach (vshControl *ctl, const vshCmd *cmd) { const char *name = NULL; virNodeDevicePtr device; @@ -13123,10 +13127,12 @@ cmdNodeDeviceDettach (vshControl *ctl, const vshCmd *cmd) return false; } + /* Yes, our public API is misspelled. At least virsh can accept + * either spelling. */ if (virNodeDeviceDettach(device) == 0) { - vshPrint(ctl, _("Device %s dettached\n"), name); + vshPrint(ctl, _("Device %s detached\n"), name); } else { - vshError(ctl, _("Failed to dettach device %s"), name); + vshError(ctl, _("Failed to detach device %s"), name); ret = false; } virNodeDeviceFree(device); @@ -17245,8 +17251,10 @@ static const vshCmdDef nodedevCmds[] = { info_node_device_create, 0}, {"nodedev-destroy", cmdNodeDeviceDestroy, opts_node_device_destroy, info_node_device_destroy, 0}, - {"nodedev-dettach", cmdNodeDeviceDettach, opts_node_device_dettach, - info_node_device_dettach, 0}, + {"nodedev-detach", cmdNodeDeviceDetach, opts_node_device_detach, + info_node_device_detach, 0}, + {"nodedev-dettach", cmdNodeDeviceDetach, opts_node_device_detach, + info_node_device_detach, VSH_CMD_FLAG_ALIAS}, {"nodedev-dumpxml", cmdNodeDeviceDumpXML, opts_node_device_dumpxml, info_node_device_dumpxml, 0}, {"nodedev-list", cmdNodeListDevices, opts_node_list_devices, diff --git a/tools/virsh.pod b/tools/virsh.pod index 8b7a1cb402..ea7db5f775 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1459,7 +1459,7 @@ Attach a device to the domain, using a device definition in an XML file. See the documentation to learn about libvirt XML format for a device. For cdrom and floppy devices, this command only replaces the media within the single existing device; consider using B for this usage. -For passthrough host devices, see also B, needed if +For passthrough host devices, see also B, needed if the device does not use managed mode. =item B I I I @@ -1588,7 +1588,7 @@ guest domains, nor by multiple active guests at once. If the description includes the attribute B, and the hypervisor driver supports it, then the device is in managed mode, and attempts to use that passthrough device in an active guest will -automatically behave as if B (guest start, device +automatically behave as if B (guest start, device hot-plug) and B (guest stop, device hot-unplug) were called at the right points (currently, qemu does this for PCI devices, but not USB). If a device is not marked as managed, then it must @@ -1613,11 +1613,13 @@ Destroy (stop) a device on the host. Note that this makes libvirt quit managing a host device, and may even make that device unusable by the rest of the physical host until a reboot. -=item B I +=item B I Detach I from the host, so that it can safely be used by guests via passthrough. This is reversed with B, and is done automatically for managed devices. +For compatibility purposes, this command can also be spelled +B. =item B I @@ -1638,7 +1640,7 @@ formatted in a tree representing parents of each node. Declare that I is no longer in use by any guests, and that the host can resume normal use of the device. This is done automatically for devices in managed mode, but must be done explicitly -to match any explicit B. +to match any explicit B. =item B I