[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v2 3/7] iscsi: Add initiator-name option
From: |
Jeff Cody |
Subject: |
[Qemu-block] [PATCH v2 3/7] iscsi: Add initiator-name option |
Date: |
Wed, 25 Jan 2017 12:42:04 -0500 |
From: Kevin Wolf <address@hidden>
This was previously only available with -iscsi. Again, after this patch,
the -iscsi option only takes effect if an URL is given. New users are
supposed to use the new driver-specific option.
Reviewed-by: Daniel P. Berrange <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
Signed-off-by: Jeff Cody <address@hidden>
---
block/iscsi.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index fc91d0f..3401b7e 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1312,26 +1312,15 @@ static void parse_header_digest(struct iscsi_context
*iscsi, const char *target,
}
}
-static char *parse_initiator_name(const char *target)
+static char *get_initiator_name(QemuOpts *opts)
{
- QemuOptsList *list;
- QemuOpts *opts;
const char *name;
char *iscsi_name;
UuidInfo *uuid_info;
- list = qemu_find_opts("iscsi");
- if (list) {
- opts = qemu_opts_find(list, target);
- if (!opts) {
- opts = QTAILQ_FIRST(&list->head);
- }
- if (opts) {
- name = qemu_opt_get(opts, "initiator-name");
- if (name) {
- return g_strdup(name);
- }
- }
+ name = qemu_opt_get(opts, "initiator-name");
+ if (name) {
+ return g_strdup(name);
}
uuid_info = qmp_query_uuid(NULL);
@@ -1576,7 +1565,7 @@ static void iscsi_parse_iscsi_option(const char *target,
QDict *options)
{
QemuOptsList *list;
QemuOpts *opts;
- const char *user, *password, *password_secret;
+ const char *user, *password, *password_secret, *initiator_name;
list = qemu_find_opts("iscsi");
if (!list) {
@@ -1605,6 +1594,11 @@ static void iscsi_parse_iscsi_option(const char *target,
QDict *options)
if (password_secret) {
qdict_set_default_str(options, "password-secret", password_secret);
}
+
+ initiator_name = qemu_opt_get(opts, "initiator-name");
+ if (initiator_name) {
+ qdict_set_default_str(options, "initiator-name", initiator_name);
+ }
}
/*
@@ -1689,6 +1683,10 @@ static QemuOptsList runtime_opts = {
.name = "lun",
.type = QEMU_OPT_NUMBER,
},
+ {
+ .name = "initiator-name",
+ .type = QEMU_OPT_STRING,
+ },
{ /* end of list */ }
},
};
@@ -1745,7 +1743,7 @@ static int iscsi_open(BlockDriverState *bs, QDict
*options, int flags,
memset(iscsilun, 0, sizeof(IscsiLun));
- initiator_name = parse_initiator_name(target);
+ initiator_name = get_initiator_name(opts);
iscsi = iscsi_create_context(initiator_name);
if (iscsi == NULL) {
--
2.9.3
- [Qemu-block] [PATCH v2 0/7] iscsi: Add blockdev-add support, Jeff Cody, 2017/01/25
- [Qemu-block] [PATCH v2 3/7] iscsi: Add initiator-name option,
Jeff Cody <=
- [Qemu-block] [PATCH v2 4/7] iscsi: Add header-digest option, Jeff Cody, 2017/01/25
- [Qemu-block] [PATCH v2 2/7] iscsi: Handle -iscsi user/password in bdrv_parse_filename(), Jeff Cody, 2017/01/25
- [Qemu-block] [PATCH v2 1/7] iscsi: Split URL into individual options, Jeff Cody, 2017/01/25
- [Qemu-block] [PATCH v2 7/7] QAPI: Fix blockdev-add example documentation, Jeff Cody, 2017/01/25
- [Qemu-block] [PATCH v2 6/7] iscsi: Add blockdev-add support, Jeff Cody, 2017/01/25
- [Qemu-block] [PATCH v2 5/7] iscsi: Add timeout option, Jeff Cody, 2017/01/25
- Re: [Qemu-block] [Qemu-devel] [PATCH v2 0/7] iscsi: Add blockdev-add support, no-reply, 2017/01/25