[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [RFC PATCH 3/6] iscsi: Add initiator-name option
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [RFC PATCH 3/6] iscsi: Add initiator-name option |
Date: |
Thu, 8 Dec 2016 14:23:08 +0100 |
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.
Signed-off-by: Kevin Wolf <address@hidden>
---
block/iscsi.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index c5106c1..7b909e8 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1311,26 +1311,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);
@@ -1575,7 +1564,7 @@ static void iscsi_parse_iscsi_option(const char *target,
QDict *options)
{
QemuOptsList *list;
QemuOpts *opts;
- const char *user;
+ const char *user, *initiator_name;
list = qemu_find_opts("iscsi");
if (!list) {
@@ -1598,6 +1587,11 @@ static void iscsi_parse_iscsi_option(const char *target,
QDict *options)
qdict_set_default_str(options, "password-secret",
qemu_opt_get(opts, "password-secret"));
}
+
+ initiator_name = qemu_opt_get(opts, "initiator-name");
+ if (initiator_name) {
+ qdict_set_default_str(options, "initiator-name", initiator_name);
+ }
}
/*
@@ -1682,6 +1676,10 @@ static QemuOptsList runtime_opts = {
.name = "lun",
.type = QEMU_OPT_NUMBER,
},
+ {
+ .name = "initiator-name",
+ .type = QEMU_OPT_STRING,
+ },
{ /* end of list */ }
},
};
@@ -1738,7 +1736,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) {
--
1.8.3.1
- [Qemu-block] [RFC PATCH 0/6] iscsi: Add blockdev-add support, Kevin Wolf, 2016/12/08
- [Qemu-block] [RFC PATCH 2/6] iscsi: Handle -iscsi user/password in bdrv_parse_filename(), Kevin Wolf, 2016/12/08
- [Qemu-block] [RFC PATCH 1/6] iscsi: Split URL into individual options, Kevin Wolf, 2016/12/08
- [Qemu-block] [RFC PATCH 3/6] iscsi: Add initiator-name option,
Kevin Wolf <=
- [Qemu-block] [RFC PATCH 4/6] iscsi: Add header-digest option, Kevin Wolf, 2016/12/08
- [Qemu-block] [RFC PATCH 6/6] iscsi: Add blockdev-add support, Kevin Wolf, 2016/12/08
- [Qemu-block] [RFC PATCH 5/6] iscsi: Add timeout option, Kevin Wolf, 2016/12/08
- Re: [Qemu-block] [RFC PATCH 0/6] iscsi: Add blockdev-add support, Daniel P. Berrange, 2016/12/08