From: Jeff Cody <jcody@redhat.com>
To: qemu-block@nongnu.org
Cc: peter.maydell@linaro.org, jcody@redhat.com,
qemu-devel@nongnu.org, stefanha@redhat.com
Subject: [Qemu-devel] [PULL 4/9] iscsi: Add header-digest option
Date: Tue, 21 Feb 2017 10:40:52 -0500 [thread overview]
Message-ID: <20170221154057.20313-5-jcody@redhat.com> (raw)
In-Reply-To: <20170221154057.20313-1-jcody@redhat.com>
From: Kevin Wolf <kwolf@redhat.com>
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 <berrange@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
---
block/iscsi.c | 39 +++++++++++++++------------------------
1 file changed, 15 insertions(+), 24 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index 6db5615..11bbb93 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1283,32 +1283,15 @@ static void apply_chap(struct iscsi_context *iscsi, QemuOpts *opts,
g_free(secret);
}
-static void parse_header_digest(struct iscsi_context *iscsi, const char *target,
+static void apply_header_digest(struct iscsi_context *iscsi, QemuOpts *opts,
Error **errp)
{
- QemuOptsList *list;
- QemuOpts *opts;
const char *digest = NULL;
- list = qemu_find_opts("iscsi");
- if (!list) {
- return;
- }
-
- opts = qemu_opts_find(list, target);
- if (opts == NULL) {
- opts = QTAILQ_FIRST(&list->head);
- if (!opts) {
- return;
- }
- }
-
digest = qemu_opt_get(opts, "header-digest");
if (!digest) {
- return;
- }
-
- if (!strcmp(digest, "CRC32C")) {
+ iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C);
+ } else if (!strcmp(digest, "CRC32C")) {
iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_CRC32C);
} else if (!strcmp(digest, "NONE")) {
iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE);
@@ -1578,7 +1561,8 @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options)
{
QemuOptsList *list;
QemuOpts *opts;
- const char *user, *password, *password_secret, *initiator_name;
+ const char *user, *password, *password_secret, *initiator_name,
+ *header_digest;
list = qemu_find_opts("iscsi");
if (!list) {
@@ -1612,6 +1596,11 @@ static void iscsi_parse_iscsi_option(const char *target, QDict *options)
if (initiator_name) {
qdict_set_default_str(options, "initiator-name", initiator_name);
}
+
+ header_digest = qemu_opt_get(opts, "header-digest");
+ if (header_digest) {
+ qdict_set_default_str(options, "header-digest", header_digest);
+ }
}
/*
@@ -1704,6 +1693,10 @@ static QemuOptsList runtime_opts = {
.name = "initiator-name",
.type = QEMU_OPT_STRING,
},
+ {
+ .name = "header-digest",
+ .type = QEMU_OPT_STRING,
+ },
{ /* end of list */ }
},
};
@@ -1795,10 +1788,8 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
goto out;
}
- iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C);
-
/* check if we got HEADER_DIGEST via the options */
- parse_header_digest(iscsi, target, &local_err);
+ apply_header_digest(iscsi, opts, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
ret = -EINVAL;
--
2.9.3
next prev parent reply other threads:[~2017-02-21 15:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 15:40 [Qemu-devel] [PULL 0/9] Block patches Jeff Cody
2017-02-21 15:40 ` [Qemu-devel] [PULL 1/9] iscsi: Split URL into individual options Jeff Cody
2017-02-21 15:40 ` [Qemu-devel] [PULL 2/9] iscsi: Handle -iscsi user/password in bdrv_parse_filename() Jeff Cody
2017-02-21 15:40 ` [Qemu-devel] [PULL 3/9] iscsi: Add initiator-name option Jeff Cody
2017-02-21 15:40 ` Jeff Cody [this message]
2017-02-21 15:40 ` [Qemu-devel] [PULL 5/9] iscsi: Add timeout option Jeff Cody
2017-02-21 15:40 ` [Qemu-devel] [PULL 6/9] iscsi: Add blockdev-add support Jeff Cody
2017-02-21 15:40 ` [Qemu-devel] [PULL 7/9] QAPI: Fix blockdev-add example documentation Jeff Cody
2017-02-21 15:40 ` [Qemu-devel] [PULL 8/9] mirror: do not increase offset during initial zero_or_discard phase Jeff Cody
2017-02-21 15:40 ` [Qemu-devel] [PULL 9/9] qemu-options: Fix broken sheepdog URL Jeff Cody
2017-02-21 18:16 ` [Qemu-devel] [PULL 0/9] Block patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170221154057.20313-5-jcody@redhat.com \
--to=jcody@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).