diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-06-20 09:07:42 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-06-20 09:07:43 +0100 |
commit | 5837aaac25e008ddafd1f12ddee78887e386c79d (patch) | |
tree | 3560d7338bf5f0d42f4f8e671841d469c060da92 | |
parent | 30ff7d1d0b3484bb91385853909476d4e4b2b988 (diff) | |
parent | 5c3ad1a6a8fa041c57403dbe1fc5927eec0be66b (diff) | |
download | qemu-5837aaac25e008ddafd1f12ddee78887e386c79d.zip qemu-5837aaac25e008ddafd1f12ddee78887e386c79d.tar.gz qemu-5837aaac25e008ddafd1f12ddee78887e386c79d.tar.bz2 |
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging
# gpg: Signature made Wed 14 Jun 2017 22:54:41 BST
# gpg: using RSA key 0xBDBE7B27C0DE3057
# gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>"
# gpg: aka "Jeffrey Cody <jeff@codyprime.org>"
# gpg: aka "Jeffrey Cody <codyprime@gmail.com>"
# Primary key fingerprint: 9957 4B4D 3474 90E7 9D98 D624 BDBE 7B27 C0DE 3057
* remotes/cody/tags/block-pull-request:
block/iscsi: enable filename option and parsing
block/rbd: enable filename option and parsing
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | block/iscsi.c | 22 | ||||
-rw-r--r-- | block/rbd.c | 22 |
2 files changed, 42 insertions, 2 deletions
diff --git a/block/iscsi.c b/block/iscsi.c index 5daa201..b5f7a22 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1732,6 +1732,10 @@ static QemuOptsList runtime_opts = { .name = "timeout", .type = QEMU_OPT_NUMBER, }, + { + .name = "filename", + .type = QEMU_OPT_STRING, + }, { /* end of list */ } }, }; @@ -1747,12 +1751,27 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, char *initiator_name = NULL; QemuOpts *opts; Error *local_err = NULL; - const char *transport_name, *portal, *target; + const char *transport_name, *portal, *target, *filename; #if LIBISCSI_API_VERSION >= (20160603) enum iscsi_transport_type transport; #endif int i, ret = 0, timeout = 0, lun; + /* If we are given a filename, parse the filename, with precedence given to + * filename encoded options */ + filename = qdict_get_try_str(options, "filename"); + if (filename) { + error_report("Warning: 'filename' option specified. " + "This is an unsupported option, and may be deprecated " + "in the future"); + iscsi_parse_filename(filename, options, &local_err); + if (local_err) { + ret = -EINVAL; + error_propagate(errp, local_err); + goto exit; + } + } + opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { @@ -1967,6 +1986,7 @@ out: } memset(iscsilun, 0, sizeof(IscsiLun)); } +exit: return ret; } diff --git a/block/rbd.c b/block/rbd.c index e551639..ff44e5f 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -340,6 +340,10 @@ static QemuOptsList runtime_opts = { .type = QEMU_OPT_STRING, .help = "Legacy rados key/value option parameters", }, + { + .name = "filename", + .type = QEMU_OPT_STRING, + }, { /* end of list */ } }, }; @@ -541,12 +545,27 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, { BDRVRBDState *s = bs->opaque; const char *pool, *snap, *conf, *user, *image_name, *keypairs; - const char *secretid; + const char *secretid, *filename; QemuOpts *opts; Error *local_err = NULL; char *mon_host = NULL; int r; + /* If we are given a filename, parse the filename, with precedence given to + * filename encoded options */ + filename = qdict_get_try_str(options, "filename"); + if (filename) { + error_report("Warning: 'filename' option specified. " + "This is an unsupported option, and may be deprecated " + "in the future"); + qemu_rbd_parse_filename(filename, options, &local_err); + if (local_err) { + r = -EINVAL; + error_propagate(errp, local_err); + goto exit; + } + } + opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { @@ -665,6 +684,7 @@ failed_shutdown: failed_opts: qemu_opts_del(opts); g_free(mon_host); +exit: return r; } |