Allow an iSCSI initiator IQN to be set with the XML for the
find-storage-pool-sources-as virsh command
* tools/virsh.c: Add iSCSI IQN support
---
tools/virsh.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 6fc1b47..69a42e8 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -5743,6 +5743,7 @@ static const vshCmdOptDef
opts_find_storage_pool_sources_as[] = {
N_("type of storage pool sources to find")},
{"host", VSH_OT_DATA, VSH_OFLAG_NONE, N_("optional host to query")},
{"port", VSH_OT_DATA, VSH_OFLAG_NONE, N_("optional port to query")},
+ {"initiator", VSH_OT_DATA, VSH_OFLAG_NONE, N_("optional initiator IQN to
use for query")},
{NULL, 0, 0, NULL}
};
@@ -5752,6 +5753,7 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd *
cmd ATTRIBUTE_UNUSED)
char *type, *host;
char *srcSpec = NULL;
char *srcList;
+ char *initiator;
int found;
type = vshCommandOptString(cmd, "type", &found);
@@ -5760,6 +5762,9 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd *
cmd ATTRIBUTE_UNUSED)
host = vshCommandOptString(cmd, "host", &found);
if (!found)
host = NULL;
+ initiator = vshCommandOptString(cmd, "initiator", &found);
+ if (!found)
+ initiator = NULL;
if (!vshConnectionUsability(ctl, ctl->conn))
return FALSE;
@@ -5782,6 +5787,11 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd
* cmd ATTRIBUTE_UNUSED)
if (port)
virBufferVSprintf(&buf, " port='%s'", port);
virBufferAddLit(&buf, "/>\n");
+ if (initiator) {
+ virBufferAddLit(&buf, " <initiator>\n");
+ virBufferVSprintf(&buf, " <iqn name='%s'/>\n", initiator);
+ virBufferAddLit(&buf, " </initiator>\n");
+ }
virBufferAddLit(&buf, "</source>\n");
if (virBufferError(&buf)) {
vshError(ctl, "%s", _("Out of memory"));
--
1.7.2.3
--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list