From bd00e00eaf07b25d3c71d95784d95bdef693d8be Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Thu, 4 Dec 2014 09:22:30 -0500 Subject: [PATCH] virsh: Add adapter options for pool-{create|define}-as Add the optional adapter options for pool create/define. Results in either: or (on one line) being generated. --- tools/virsh-pool.c | 35 +++++++++++++++++++++++++++++++++-- tools/virsh.pod | 13 +++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index bba7d6870f..a9482c4c8c 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -235,6 +235,22 @@ static const vshCmdOptDef opts_pool_X_as[] = { .type = VSH_OT_STRING, .help = N_("auth secret usage to be used for underlying storage") }, + {.name = "adapter-name", + .type = VSH_OT_STRING, + .help = N_("adapter name to be used for underlying storage") + }, + {.name = "adapter-wwnn", + .type = VSH_OT_STRING, + .help = N_("adapter wwnn to be used for underlying storage") + }, + {.name = "adapter-wwpn", + .type = VSH_OT_STRING, + .help = N_("adapter wwpn to be used for underlying storage") + }, + {.name = "adapter-parent", + .type = VSH_OT_STRING, + .help = N_("adapter parent to be used for underlying storage") + }, {.name = NULL} }; @@ -247,7 +263,8 @@ vshBuildPoolXML(vshControl *ctl, const char *name = NULL, *type = NULL, *srcHost = NULL, *srcPath = NULL, *srcDev = NULL, *srcName = NULL, *srcFormat = NULL, *target = NULL, *authType = NULL, *authUsername = NULL, - *secretUsage = NULL; + *secretUsage = NULL, *adapterName = NULL, *adapterParent = NULL, + *adapterWwnn = NULL, *adapterWwpn = NULL; virBuffer buf = VIR_BUFFER_INITIALIZER; if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0) @@ -263,7 +280,11 @@ vshBuildPoolXML(vshControl *ctl, vshCommandOptStringReq(ctl, cmd, "target", &target) < 0 || vshCommandOptStringReq(ctl, cmd, "auth-type", &authType) < 0 || vshCommandOptStringReq(ctl, cmd, "auth-username", &authUsername) < 0 || - vshCommandOptStringReq(ctl, cmd, "secret-usage", &secretUsage) < 0) + vshCommandOptStringReq(ctl, cmd, "secret-usage", &secretUsage) < 0 || + vshCommandOptStringReq(ctl, cmd, "adapter-name", &adapterName) < 0 || + vshCommandOptStringReq(ctl, cmd, "adapter-wwnn", &adapterWwnn) < 0 || + vshCommandOptStringReq(ctl, cmd, "adapter-wwpn", &adapterWwpn) < 0 || + vshCommandOptStringReq(ctl, cmd, "adapter-parent", &adapterParent) < 0) goto cleanup; virBufferAsprintf(&buf, "\n", type); @@ -279,6 +300,16 @@ vshBuildPoolXML(vshControl *ctl, virBufferAsprintf(&buf, "\n", srcPath); if (srcDev) virBufferAsprintf(&buf, "\n", srcDev); + if (adapterWwnn && adapterWwpn) { + virBufferAddLit(&buf, "\n", + adapterWwnn, adapterWwpn); + } else if (adapterName) { + virBufferAsprintf(&buf, "\n", + adapterName); + } if (authType && authUsername && secretUsage) { virBufferAsprintf(&buf, "\n", authType, authUsername); diff --git a/tools/virsh.pod b/tools/virsh.pod index 45dd924fcd..c070261d79 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -2960,6 +2960,9 @@ Create and start a pool object from the XML I. [I<--source-host hostname>] [I<--source-path path>] [I<--source-dev path>] [I<--source-name name>] [I<--target path>] [I<--source-format format>] [I<--auth-type authtype> I<--auth-username username> I<--secret-usage usage>] +[[I<--adapter-name name>] | [I<--adapter-wwnn> I<--adapter-wwpn>] +[I<--adapter-parent parent>]] + Create and start a pool object I from the raw parameters. If I<--print-xml> is specified, then print the XML of the pool object @@ -2990,6 +2993,14 @@ provides the elements required to generate authentication credentials for the storage pool. The I is either chap for iscsi I pools or ceph for rbd I pools. +[I<--adapter-name name>] defines the scsi_hostN adapter name to be used for +the scsi_host adapter type pool. + +[I<--adapter-wwnn> I<--adapter-wwpn> [I<--adapter-parent parent>]] defines +the wwnn and wwpn to be used for the fc_host adapter type pool. The parent +optionally provides the name of the scsi_hostN node device to be used for +the vHBA. + =item B I Create, but do not start, a pool object from the XML I. @@ -2998,6 +3009,8 @@ Create, but do not start, a pool object from the XML I. [I<--source-host hostname>] [I<--source-path path>] [I<--source-dev path>] [I<--source-name name>] [I<--target path>] [I<--source-format format>] [I<--auth-type authtype> I<--auth-username username> I<--secret-usage usage>] +[[I<--adapter-name name>] | [I<--adapter-wwnn> I<--adapter-wwpn>] +[I<--adapter-parent parent>]] Create, but do not start, a pool object I from the raw parameters. If I<--print-xml> is specified, then print the XML of the pool object -- GitLab