提交 bd00e00e 编写于 作者: J John Ferlan

virsh: Add adapter options for pool-{create|define}-as

Add the optional adapter options for pool create/define.  Results in
either:

<adapter type='scsi_host' name='scsi_host2'/>

or (on one line)

<adapter type='fc_host' parent='scsi_host5'
         wwnn='20000000c9831b4b' wwpn='10000000c9831b4b'/>

being generated.
上级 89325806
......@@ -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, "<pool type='%s'>\n", type);
......@@ -279,6 +300,16 @@ vshBuildPoolXML(vshControl *ctl,
virBufferAsprintf(&buf, "<dir path='%s'/>\n", srcPath);
if (srcDev)
virBufferAsprintf(&buf, "<device path='%s'/>\n", srcDev);
if (adapterWwnn && adapterWwpn) {
virBufferAddLit(&buf, "<adapter type='fc_host'");
if (adapterParent)
virBufferAsprintf(&buf, " parent='%s'", adapterParent);
virBufferAsprintf(&buf, " wwnn='%s' wwpn='%s'/>\n",
adapterWwnn, adapterWwpn);
} else if (adapterName) {
virBufferAsprintf(&buf, "<adapter type='scsi_host' name='%s'/>\n",
adapterName);
}
if (authType && authUsername && secretUsage) {
virBufferAsprintf(&buf, "<auth type='%s' username='%s'>\n",
authType, authUsername);
......
......@@ -2960,6 +2960,9 @@ Create and start a pool object from the XML I<file>.
[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<name> 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<authtype> is either chap for iscsi I<type> pools or
ceph for rbd I<type> 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<pool-define> I<file>
Create, but do not start, a pool object from the XML I<file>.
......@@ -2998,6 +3009,8 @@ Create, but do not start, a pool object from the XML I<file>.
[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<name> from the raw parameters. If
I<--print-xml> is specified, then print the XML of the pool object
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册