Skip to content

Commit 4359255

Browse files
committed
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block layer patches: - Fix options that work only with -drive or -blockdev, but not with both, because of QDict type confusion - rbd: Add options 'auth-client-required' and 'key-secret' - Remove deprecated -drive options serial/addr/cyls/heads/secs/trans - rbd, iscsi: Remove deprecated 'filename' option - Fix 'qemu-img map' crash with unaligned image size - Improve QMP documentation for jobs # gpg: Signature made Fri 15 Jun 2018 15:20:03 BST # gpg: using RSA key 7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: (26 commits) block: Remove dead deprecation warning code block: Remove deprecated -drive option serial block: Remove deprecated -drive option addr block: Remove deprecated -drive geometry options rbd: New parameter key-secret rbd: New parameter auth-client-required block: Fix -blockdev / blockdev-add for empty objects and arrays check-block-qdict: Cover flattening of empty lists and dictionaries check-block-qdict: Rename qdict_flatten()'s variables for clarity block-qdict: Simplify qdict_is_list() some block-qdict: Clean up qdict_crumple() a bit block-qdict: Tweak qdict_flatten_qdict(), qdict_flatten_qlist() block-qdict: Simplify qdict_flatten_qdict() block: Make remaining uses of qobject input visitor more robust block: Factor out qobject_input_visitor_new_flat_confused() block: Clean up a misuse of qobject_to() in .bdrv_co_create_opts() block: Fix -drive for certain non-string scalars block: Fix -blockdev for certain non-string scalars qobject: Move block-specific qdict code to block-qdict.c block: Add block-specific QDict header ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 parents 81d3864 + 6266e90 commit 4359255

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1692
-1668
lines changed

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,8 @@ F: qemu-img*
13691369
F: qemu-io*
13701370
F: tests/qemu-iotests/
13711371
F: util/qemu-progress.c
1372+
F: qobject/block-qdict.c
1373+
F: test/check-block-qdict.c
13721374
T: git git://repo.or.cz/qemu/kevin.git block
13731375

13741376
Block I/O path

block.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "block/block_int.h"
2828
#include "block/blockjob.h"
2929
#include "block/nbd.h"
30+
#include "block/qdict.h"
3031
#include "qemu/error-report.h"
3132
#include "module_block.h"
3233
#include "qemu/module.h"

block/block-backend.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ static void drive_info_del(DriveInfo *dinfo)
419419
return;
420420
}
421421
qemu_opts_del(dinfo->opts);
422-
g_free(dinfo->serial);
423422
g_free(dinfo);
424423
}
425424

block/crypto.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
#include "qemu/osdep.h"
2222

2323
#include "block/block_int.h"
24+
#include "block/qdict.h"
2425
#include "sysemu/block-backend.h"
2526
#include "crypto/block.h"
2627
#include "qapi/opts-visitor.h"
2728
#include "qapi/qapi-visit-crypto.h"
28-
#include "qapi/qmp/qdict.h"
2929
#include "qapi/qobject-input-visitor.h"
3030
#include "qapi/error.h"
3131
#include "qemu/option.h"
@@ -159,7 +159,10 @@ block_crypto_open_opts_init(QCryptoBlockFormat format,
159159
ret = g_new0(QCryptoBlockOpenOptions, 1);
160160
ret->format = format;
161161

162-
v = qobject_input_visitor_new_keyval(QOBJECT(opts));
162+
v = qobject_input_visitor_new_flat_confused(opts, &local_err);
163+
if (local_err) {
164+
goto out;
165+
}
163166

164167
visit_start_struct(v, NULL, NULL, 0, &local_err);
165168
if (local_err) {
@@ -210,7 +213,10 @@ block_crypto_create_opts_init(QCryptoBlockFormat format,
210213
ret = g_new0(QCryptoBlockCreateOptions, 1);
211214
ret->format = format;
212215

213-
v = qobject_input_visitor_new_keyval(QOBJECT(opts));
216+
v = qobject_input_visitor_new_flat_confused(opts, &local_err);
217+
if (local_err) {
218+
goto out;
219+
}
214220

215221
visit_start_struct(v, NULL, NULL, 0, &local_err);
216222
if (local_err) {

block/gluster.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "qemu/osdep.h"
1212
#include <glusterfs/api/glfs.h>
1313
#include "block/block_int.h"
14+
#include "block/qdict.h"
1415
#include "qapi/error.h"
1516
#include "qapi/qmp/qdict.h"
1617
#include "qapi/qmp/qerror.h"

block/iscsi.c

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "qemu/bitops.h"
3434
#include "qemu/bitmap.h"
3535
#include "block/block_int.h"
36+
#include "block/qdict.h"
3637
#include "scsi/constants.h"
3738
#include "qemu/iov.h"
3839
#include "qemu/option.h"
@@ -1713,10 +1714,6 @@ static QemuOptsList runtime_opts = {
17131714
.name = "timeout",
17141715
.type = QEMU_OPT_NUMBER,
17151716
},
1716-
{
1717-
.name = "filename",
1718-
.type = QEMU_OPT_STRING,
1719-
},
17201717
{ /* end of list */ }
17211718
},
17221719
};
@@ -1756,27 +1753,12 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
17561753
char *initiator_name = NULL;
17571754
QemuOpts *opts;
17581755
Error *local_err = NULL;
1759-
const char *transport_name, *portal, *target, *filename;
1756+
const char *transport_name, *portal, *target;
17601757
#if LIBISCSI_API_VERSION >= (20160603)
17611758
enum iscsi_transport_type transport;
17621759
#endif
17631760
int i, ret = 0, timeout = 0, lun;
17641761

1765-
/* If we are given a filename, parse the filename, with precedence given to
1766-
* filename encoded options */
1767-
filename = qdict_get_try_str(options, "filename");
1768-
if (filename) {
1769-
warn_report("'filename' option specified. "
1770-
"This is an unsupported option, and may be deprecated "
1771-
"in the future");
1772-
iscsi_parse_filename(filename, options, &local_err);
1773-
if (local_err) {
1774-
ret = -EINVAL;
1775-
error_propagate(errp, local_err);
1776-
goto exit;
1777-
}
1778-
}
1779-
17801762
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
17811763
qemu_opts_absorb_qdict(opts, options, &local_err);
17821764
if (local_err) {
@@ -2006,7 +1988,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
20061988
}
20071989
memset(iscsilun, 0, sizeof(IscsiLun));
20081990
}
2009-
exit:
1991+
20101992
return ret;
20111993
}
20121994

block/nbd.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include "qemu/osdep.h"
3030
#include "nbd-client.h"
31+
#include "block/qdict.h"
3132
#include "qapi/error.h"
3233
#include "qemu/uri.h"
3334
#include "block/block_int.h"
@@ -262,7 +263,6 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options,
262263
{
263264
SocketAddress *saddr = NULL;
264265
QDict *addr = NULL;
265-
QObject *crumpled_addr = NULL;
266266
Visitor *iv = NULL;
267267
Error *local_err = NULL;
268268

@@ -272,20 +272,11 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options,
272272
goto done;
273273
}
274274

275-
crumpled_addr = qdict_crumple(addr, errp);
276-
if (!crumpled_addr) {
275+
iv = qobject_input_visitor_new_flat_confused(addr, errp);
276+
if (!iv) {
277277
goto done;
278278
}
279279

280-
/*
281-
* FIXME .numeric, .to, .ipv4 or .ipv6 don't work with -drive
282-
* server.type=inet. .to doesn't matter, it's ignored anyway.
283-
* That's because when @options come from -blockdev or
284-
* blockdev_add, members are typed according to the QAPI schema,
285-
* but when they come from -drive, they're all QString. The
286-
* visitor expects the former.
287-
*/
288-
iv = qobject_input_visitor_new(crumpled_addr);
289280
visit_type_SocketAddress(iv, NULL, &saddr, &local_err);
290281
if (local_err) {
291282
error_propagate(errp, local_err);
@@ -294,7 +285,6 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options,
294285

295286
done:
296287
qobject_unref(addr);
297-
qobject_unref(crumpled_addr);
298288
visit_free(iv);
299289
return saddr;
300290
}

block/nfs.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "qemu/error-report.h"
3030
#include "qapi/error.h"
3131
#include "block/block_int.h"
32+
#include "block/qdict.h"
3233
#include "trace.h"
3334
#include "qemu/iov.h"
3435
#include "qemu/option.h"
@@ -555,20 +556,17 @@ static BlockdevOptionsNfs *nfs_options_qdict_to_qapi(QDict *options,
555556
Error **errp)
556557
{
557558
BlockdevOptionsNfs *opts = NULL;
558-
QObject *crumpled = NULL;
559559
Visitor *v;
560560
const QDictEntry *e;
561561
Error *local_err = NULL;
562562

563-
crumpled = qdict_crumple(options, errp);
564-
if (crumpled == NULL) {
563+
v = qobject_input_visitor_new_flat_confused(options, errp);
564+
if (!v) {
565565
return NULL;
566566
}
567567

568-
v = qobject_input_visitor_new_keyval(crumpled);
569568
visit_type_BlockdevOptionsNfs(v, NULL, &opts, &local_err);
570569
visit_free(v);
571-
qobject_unref(crumpled);
572570

573571
if (local_err) {
574572
error_propagate(errp, local_err);

block/parallels.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "qemu/osdep.h"
3232
#include "qapi/error.h"
3333
#include "block/block_int.h"
34+
#include "block/qdict.h"
3435
#include "sysemu/block-backend.h"
3536
#include "qemu/module.h"
3637
#include "qemu/option.h"
@@ -615,8 +616,7 @@ static int coroutine_fn parallels_co_create_opts(const char *filename,
615616
BlockdevCreateOptions *create_options = NULL;
616617
Error *local_err = NULL;
617618
BlockDriverState *bs = NULL;
618-
QDict *qdict = NULL;
619-
QObject *qobj;
619+
QDict *qdict;
620620
Visitor *v;
621621
int ret;
622622

@@ -652,15 +652,12 @@ static int coroutine_fn parallels_co_create_opts(const char *filename,
652652
qdict_put_str(qdict, "driver", "parallels");
653653
qdict_put_str(qdict, "file", bs->node_name);
654654

655-
qobj = qdict_crumple(qdict, errp);
656-
qobject_unref(qdict);
657-
qdict = qobject_to(QDict, qobj);
658-
if (qdict == NULL) {
655+
v = qobject_input_visitor_new_flat_confused(qdict, errp);
656+
if (!v) {
659657
ret = -EINVAL;
660658
goto done;
661659
}
662660

663-
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
664661
visit_type_BlockdevCreateOptions(v, NULL, &create_options, &local_err);
665662
visit_free(v);
666663

block/qcow.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "qapi/error.h"
2727
#include "qemu/error-report.h"
2828
#include "block/block_int.h"
29+
#include "block/qdict.h"
2930
#include "sysemu/block-backend.h"
3031
#include "qemu/module.h"
3132
#include "qemu/option.h"
@@ -945,8 +946,7 @@ static int coroutine_fn qcow_co_create_opts(const char *filename,
945946
{
946947
BlockdevCreateOptions *create_options = NULL;
947948
BlockDriverState *bs = NULL;
948-
QDict *qdict = NULL;
949-
QObject *qobj;
949+
QDict *qdict;
950950
Visitor *v;
951951
const char *val;
952952
Error *local_err = NULL;
@@ -996,15 +996,12 @@ static int coroutine_fn qcow_co_create_opts(const char *filename,
996996
qdict_put_str(qdict, "driver", "qcow");
997997
qdict_put_str(qdict, "file", bs->node_name);
998998

999-
qobj = qdict_crumple(qdict, errp);
1000-
qobject_unref(qdict);
1001-
qdict = qobject_to(QDict, qobj);
1002-
if (qdict == NULL) {
999+
v = qobject_input_visitor_new_flat_confused(qdict, errp);
1000+
if (!v) {
10031001
ret = -EINVAL;
10041002
goto fail;
10051003
}
10061004

1007-
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
10081005
visit_type_BlockdevCreateOptions(v, NULL, &create_options, &local_err);
10091006
visit_free(v);
10101007

0 commit comments

Comments
 (0)