mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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.
This commit is contained in:
parent
893258063d
commit
bd00e00eaf
@ -235,6 +235,22 @@ static const vshCmdOptDef opts_pool_X_as[] = {
|
|||||||
.type = VSH_OT_STRING,
|
.type = VSH_OT_STRING,
|
||||||
.help = N_("auth secret usage to be used for underlying storage")
|
.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}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -247,7 +263,8 @@ vshBuildPoolXML(vshControl *ctl,
|
|||||||
const char *name = NULL, *type = NULL, *srcHost = NULL, *srcPath = NULL,
|
const char *name = NULL, *type = NULL, *srcHost = NULL, *srcPath = NULL,
|
||||||
*srcDev = NULL, *srcName = NULL, *srcFormat = NULL,
|
*srcDev = NULL, *srcName = NULL, *srcFormat = NULL,
|
||||||
*target = NULL, *authType = NULL, *authUsername = NULL,
|
*target = NULL, *authType = NULL, *authUsername = NULL,
|
||||||
*secretUsage = NULL;
|
*secretUsage = NULL, *adapterName = NULL, *adapterParent = NULL,
|
||||||
|
*adapterWwnn = NULL, *adapterWwpn = NULL;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0)
|
if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0)
|
||||||
@ -263,7 +280,11 @@ vshBuildPoolXML(vshControl *ctl,
|
|||||||
vshCommandOptStringReq(ctl, cmd, "target", &target) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "target", &target) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "auth-type", &authType) < 0 ||
|
vshCommandOptStringReq(ctl, cmd, "auth-type", &authType) < 0 ||
|
||||||
vshCommandOptStringReq(ctl, cmd, "auth-username", &authUsername) < 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;
|
goto cleanup;
|
||||||
|
|
||||||
virBufferAsprintf(&buf, "<pool type='%s'>\n", type);
|
virBufferAsprintf(&buf, "<pool type='%s'>\n", type);
|
||||||
@ -279,6 +300,16 @@ vshBuildPoolXML(vshControl *ctl,
|
|||||||
virBufferAsprintf(&buf, "<dir path='%s'/>\n", srcPath);
|
virBufferAsprintf(&buf, "<dir path='%s'/>\n", srcPath);
|
||||||
if (srcDev)
|
if (srcDev)
|
||||||
virBufferAsprintf(&buf, "<device path='%s'/>\n", 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) {
|
if (authType && authUsername && secretUsage) {
|
||||||
virBufferAsprintf(&buf, "<auth type='%s' username='%s'>\n",
|
virBufferAsprintf(&buf, "<auth type='%s' username='%s'>\n",
|
||||||
authType, authUsername);
|
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-host hostname>] [I<--source-path path>] [I<--source-dev path>]
|
||||||
[I<--source-name name>] [I<--target path>] [I<--source-format format>]
|
[I<--source-name name>] [I<--target path>] [I<--source-format format>]
|
||||||
[I<--auth-type authtype> I<--auth-username username> I<--secret-usage usage>]
|
[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
|
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
|
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
|
the storage pool. The I<authtype> is either chap for iscsi I<type> pools or
|
||||||
ceph for rbd I<type> pools.
|
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>
|
=item B<pool-define> I<file>
|
||||||
|
|
||||||
Create, but do not start, a pool object from the XML 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-host hostname>] [I<--source-path path>] [I<--source-dev path>]
|
||||||
[I<--source-name name>] [I<--target path>] [I<--source-format format>]
|
[I<--source-name name>] [I<--target path>] [I<--source-format format>]
|
||||||
[I<--auth-type authtype> I<--auth-username username> I<--secret-usage usage>]
|
[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
|
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
|
I<--print-xml> is specified, then print the XML of the pool object
|
||||||
|
Loading…
Reference in New Issue
Block a user