[libvirt] [PATCH 4/4] virsh: Use virNodeDeviceLookupSCSIHostByWWN

Osier Yang jyang at redhat.com
Mon Feb 4 13:53:23 UTC 2013


On 2013年02月04日 21:03, Osier Yang wrote:
> Only nodedev-destroy and nodedev-dumpxml can benifit from the
> new API, other commands like nodedev-detach only works for
> PCI devices, WWN makes no sense for them.
> ---
>   tools/virsh-nodedev.c |   98 ++++++++++++++++++++++++++++++++++++++-----------
>   tools/virsh.pod       |   15 ++++---
>   2 files changed, 85 insertions(+), 28 deletions(-)
>
> diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
> index 11135ab..6603803 100644
> --- a/tools/virsh-nodedev.c
> +++ b/tools/virsh-nodedev.c
> @@ -101,9 +101,14 @@ static const vshCmdInfo info_node_device_destroy[] = {
>
>   static const vshCmdOptDef opts_node_device_destroy[] = {
>       {.name = "name",
> +     .type = VSH_OT_ALIAS,
> +     .flags = 0,
> +     .help = "device"
> +    },
> +    {.name = "device",
>        .type = VSH_OT_DATA,
>        .flags = VSH_OFLAG_REQ,
> -     .help = N_("name of the device to be destroyed")
> +     .help = N_("device name or wwn pair in 'wwnn,wwpn' format")
>       },
>       {.name = NULL}
>   };
> @@ -112,21 +117,47 @@ static bool
>   cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd)
>   {
>       virNodeDevicePtr dev = NULL;
> -    bool ret = true;
> -    const char *name = NULL;
> +    bool ret = false;
> +    const char *device_value = NULL;
> +    char **arr = NULL;
> +    int narr;
>
> -    if (vshCommandOptString(cmd, "name",&name)<= 0)
> +    if (vshCommandOptString(cmd, "device",&device_value)<= 0)

Things like this need to be changed as Peter's helper is pushed
now. I'm going to post v2.

Osier




More information about the libvir-list mailing list