mbox

[PULL,00/24] block: Command line option -blockdev

Message ID 1488320775-9849-1-git-send-email-armbru@redhat.com
State New
Headers show

Pull-request

git://repo.or.cz/qemu/armbru.git tags/pull-block-2017-02-28

Message

Markus Armbruster Feb. 28, 2017, 10:25 p.m. UTC
Actually, the command line option is the least part of this series.
Its bulk is about building infrastructure and getting errors out of
the JSON parser[*].  The latter part could be spun out in its own
series, if that helps.  We'll see.

The design of the command line interface was discussed here:
Subject: Non-flat command line option argument syntax
Message-ID: <87bmukmlau.fsf@dusky.pond.sub.org>
https://lists.gnu.org/archive/html/qemu-devel/2017-02/msg00555.html

The following changes since commit e7c83a885f865128ae3cf1946f8cb538b63cbfba:

  vhost-user: delay vhost_user_stop (2017-02-28 19:11:15 +0000)

are available in the git repository at:

  git://repo.or.cz/qemu/armbru.git tags/pull-block-2017-02-28

for you to fetch changes up to cf66cd3cad56827ae943cc6d752ec619f448b7d7:

  keyval: Support lists (2017-02-28 23:17:56 +0100)

----------------------------------------------------------------
block: Command line option -blockdev

----------------------------------------------------------------
Daniel P. Berrange (1):
      qapi: qobject input visitor variant for use with keyval_parse()

Markus Armbruster (50):
      qga: Fix crash on non-dictionary QMP argument
      libqtest: Work around a "QMP wants a newline" bug
      qmp-test: New, covering basic QMP protocol
      qmp: Dumb down how we run QMP command registration
      qmp: Clean up how we enforce capability negotiation
      qmp: Drop duplicated QMP command object checks
      qmp: Eliminate silly QERR_QMP_* macros
      qmp: Improve QMP dispatch error messages
      qapi: Improve a QObject input visitor error message
      qapi: Clean up after commit 3d344c2
      qapi: Make QObject input visitor set *list reliably
      qapi: Improve qobject input visitor error reporting
      qapi: Drop string input visitor method optional()
      qapi: Make string input and opts visitor require non-null input
      qom: Make object_property_set_qobject()'s input visitor strict
      test-qobject-input-visitor: Use strict visitor
      qapi: Drop unused non-strict qobject input visitor
      tests-qobject-input-strict: Merge into test-qobject-input-visitor
      test-string-input-visitor: Tear down existing test automatically
      test-string-input-visitor: Improve list coverage
      tests: Cover partial input visit of list
      test-qobject-input-visitor: Cover missing nested struct member
      qapi: Make input visitors detect unvisited list tails
      tests: Cover input visit beyond end of list
      qapi: Fix object input visit beyond end of list
      qapi: Improve qobject visitor documentation
      Merge branch 'qapi-next' into block-next
      test-qemu-opts: Cover qemu_opts_parse() of "no"
      tests: Fix gcov-files-test-qemu-opts-y, gcov-files-test-logging-y
      keyval: New keyval_parse()
      test-keyval: Cover use with qobject input visitor
      qapi: Factor out common part of qobject input visitor creation
      qapi: Factor out common qobject_input_get_keyval()
      qobject: Propagate parse errors through qobject_from_jsonv()
      libqtest: Fix qmp() & friends to abort on JSON parse errors
      qjson: Abort earlier on qobject_from_jsonf() misuse
      test-qobject-input-visitor: Abort earlier on bad test input
      qobject: Propagate parse errors through qobject_from_json()
      block: More detailed syntax error reporting for JSON filenames
      check-qjson: Test errors from qobject_from_json()
      test-visitor-serialization: Pass &error_abort to qobject_from_json()
      monitor: Assert qmp_schema_json[] is sane
      test-qapi-util: New, covering qapi/qapi-util.c
      qapi: New parse_qapi_name()
      keyval: Restrict key components to valid QAPI names
      qapi: New qobject_input_visitor_new_str() for convenience
      block: Initial implementation of -blockdev
      qapi: Improve how keyval input visitor reports unexpected dicts
      docs/qapi-code-gen.txt: Clarify naming rules
      keyval: Support lists

 MAINTAINERS                           |   1 +
 block.c                               |   9 +-
 block/nbd.c                           |   2 +-
 block/nfs.c                           |   2 +-
 block/ssh.c                           |   2 +-
 docs/qapi-code-gen.txt                |  63 ++--
 hw/ppc/spapr_drc.c                    |   5 +
 include/monitor/monitor.h             |   1 +
 include/qapi/qmp/qerror.h             |   9 -
 include/qapi/qmp/qjson.h              |   5 +-
 include/qapi/qobject-input-visitor.h  |  61 +++-
 include/qapi/qobject-output-visitor.h |  35 +-
 include/qapi/util.h                   |   2 +
 include/qapi/visitor-impl.h           |   7 +-
 include/qapi/visitor.h                |  19 +-
 include/qemu/module.h                 |   2 -
 include/qemu/option.h                 |   3 +
 monitor.c                             | 151 +++-----
 qapi/opts-visitor.c                   |  12 +
 qapi/qapi-util.c                      |  47 +++
 qapi/qapi-visit-core.c                |   8 +
 qapi/qmp-dispatch.c                   |  22 +-
 qapi/qobject-input-visitor.c          | 429 ++++++++++++++++++-----
 qapi/string-input-visitor.c           |  97 +++---
 qapi/trace-events                     |   1 +
 qemu-options.hx                       |   7 +
 qga/main.c                            |   2 +-
 qmp.c                                 |   2 +-
 qobject/qjson.c                       |  14 +-
 qom/qom-qobject.c                     |   4 +-
 scripts/qapi-commands.py              |   7 +-
 scripts/qapi-visit.py                 |   3 +
 target/s390x/cpu_models.c             |   2 +-
 tests/.gitignore                      |   2 +
 tests/Makefile.include                |  19 +-
 tests/check-qjson.c                   |  88 +++--
 tests/check-qnull.c                   |   2 +-
 tests/libqtest.c                      |  32 +-
 tests/libqtest.h                      |   8 +
 tests/qmp-test.c                      | 139 ++++++++
 tests/test-keyval.c                   | 624 ++++++++++++++++++++++++++++++++++
 tests/test-opts-visitor.c             |  80 +++++
 tests/test-qapi-util.c                |  85 +++++
 tests/test-qemu-opts.c                |   5 +
 tests/test-qga.c                      |   2 +-
 tests/test-qmp-commands.c             |   4 +-
 tests/test-qobject-input-strict.c     | 381 ---------------------
 tests/test-qobject-input-visitor.c    | 446 +++++++++++++++++++++++-
 tests/test-string-input-visitor.c     | 142 ++++++--
 tests/test-visitor-serialization.c    |   4 +-
 trace-events                          |   1 -
 util/Makefile.objs                    |   1 +
 util/keyval.c                         | 394 +++++++++++++++++++++
 vl.c                                  |  41 ++-
 54 files changed, 2748 insertions(+), 788 deletions(-)
 create mode 100644 tests/qmp-test.c
 create mode 100644 tests/test-keyval.c
 create mode 100644 tests/test-qapi-util.c
 delete mode 100644 tests/test-qobject-input-strict.c
 create mode 100644 util/keyval.c

Comments

Peter Maydell March 2, 2017, 3:25 p.m. UTC | #1
On 28 February 2017 at 22:25, Markus Armbruster <armbru@redhat.com> wrote:
> Actually, the command line option is the least part of this series.
> Its bulk is about building infrastructure and getting errors out of
> the JSON parser[*].  The latter part could be spun out in its own
> series, if that helps.  We'll see.
>
> The design of the command line interface was discussed here:
> Subject: Non-flat command line option argument syntax
> Message-ID: <87bmukmlau.fsf@dusky.pond.sub.org>
> https://lists.gnu.org/archive/html/qemu-devel/2017-02/msg00555.html
>
> The following changes since commit e7c83a885f865128ae3cf1946f8cb538b63cbfba:
>
>   vhost-user: delay vhost_user_stop (2017-02-28 19:11:15 +0000)
>
> are available in the git repository at:
>
>   git://repo.or.cz/qemu/armbru.git tags/pull-block-2017-02-28
>
> for you to fetch changes up to cf66cd3cad56827ae943cc6d752ec619f448b7d7:
>
>   keyval: Support lists (2017-02-28 23:17:56 +0100)
>
> ----------------------------------------------------------------
> block: Command line option -blockdev
>

make check failures on OSX host:

  GTESTER check-qtest-mips
  GTESTER check-qtest-mips64
Broken pipe
GTester: last random seed: R02S52f9c996ae3acbcbb3d4c5231ff7098e
  GTESTER check-qtest-mips64el
  GTESTER check-qtest-mipsel
  GTESTER check-qtest-moxie
  GTESTER check-qtest-nios2
  GTESTER check-qtest-or1k
  GTESTER check-qtest-ppc
  GTESTER check-qtest-ppc64
  GTESTER check-qtest-ppcemb
  GTESTER check-qtest-s390x
  GTESTER check-qtest-sh4
Broken pipe
GTester: last random seed: R02S1e96ff49370f71f63240c3a6bb3c1aa7
Broken pipe
GTester: last random seed: R02S4bbfc4e42ade410e3dd44c93250c59b8
  GTESTER check-qtest-sh4eb
Broken pipe
GTester: last random seed: R02Sa22f920582e624373c4ca48eb3e707a3
  GTESTER check-qtest-sparc
Broken pipe
GTester: last random seed: R02Sb47b7d1736ce92e44ef4b913aa90a500
Broken pipe
GTester: last random seed: R02S14ec758ef2ee853ec65f24b7850fe3f4
Broken pipe
GTester: last random seed: R02Sde4dad4558fbe4522cb4b60443c5ead5
Broken pipe
GTester: last random seed: R02Se6220bcd0ec342bd3c6328ee66ed8f45
Broken pipe
GTester: last random seed: R02Sba7d358af8f414b8a3e25bb7e3ec50ef
make: *** [check-qtest-sparc] Error 1

May or may not be this pull's fault.

thanks
-- PMM
Peter Maydell March 3, 2017, 4:31 p.m. UTC | #2
On 2 March 2017 at 15:25, Peter Maydell <peter.maydell@linaro.org> wrote:
> make check failures on OSX host:

> May or may not be this pull's fault.

I gave the pull another test, since I've pretty much run out of
other stuff in the queue, but it failed again in the same way,
on both OSX and x86-64 Linux.
So I think there's definitely something up with this pull.

OSX host:
TEST: tests/qom-test... (pid=85614)
  /sparc/qom/SS-4:
Broken pipe
FAIL
GTester: last random seed: R02Sb28294de82a0cf258dc2ca2baf6b18c8
(pid=85617)
  /sparc/qom/LX:
Broken pipe
FAIL
GTester: last random seed: R02S4eb26bbab5c416277b06006ad8156cf1
(pid=85622)
  /sparc/qom/leon3_generic:                                            OK
  /sparc/qom/SS-600MP:                                                 OK
  /sparc/qom/Voyager:                                                  OK
  /sparc/qom/none:                                                     OK
  /sparc/qom/SS-10:
Broken pipe
FAIL
GTester: last random seed: R02S469761818cf79d3e6fa4962320fa77b1
(pid=85639)
  /sparc/qom/SS-20:
Broken pipe
FAIL
GTester: last random seed: R02S3a7473b699bcfb26035fd7c28443bf95
(pid=85644)
  /sparc/qom/SS-5:                                                     OK
  /sparc/qom/SPARCbook:
Broken pipe
FAIL
GTester: last random seed: R02Se07a10fe8e79e45763039203f04c24a1
(pid=85652)
  /sparc/qom/SPARCClassic:
Broken pipe
FAIL
GTester: last random seed: R02S9e34d27b7ec926de3636396718a84757
(pid=85655)
FAIL: tests/qom-test


x86-64 Linux host:

QTEST_QEMU_BINARY=cris-softmmu/qemu-system-cris
QTEST_QEMU_IMG=qemu-img MALLOC_PERTURB_=${MALLOC_PERTURB_:-$((RANDOM %
255 + 1))} gtester -k --verbose -m=quick  tests/qmp-test
tests/device-introspect-test tests/qom-test
TEST: tests/qmp-test... (pid=31974)
  /cris/qmp/protocol:
Broken pipe
FAIL
GTester: last random seed: R02S3574aa418580efa4bcf246970fbc840b
(pid=31979)
FAIL: tests/qmp-test
TEST: tests/device-introspect-test... (pid=31980)
  /cris/device/introspect/list:
Broken pipe
FAIL
GTester: last random seed: R02Sa1d63dd8533875a5d93dd74844a975d6
(pid=31984)
  /cris/device/introspect/none:
Broken pipe
FAIL
GTester: last random seed: R02S356b6ad895fd1c7287d0aca33d282e85
(pid=31988)
  /cris/device/introspect/abstract:
Broken pipe
FAIL
GTester: last random seed: R02Sc21ac5a1763bc530d24534be33594f47
(pid=31992)
  /cris/device/introspect/concrete:
Broken pipe
FAIL
GTester: last random seed: R02Sa794b06429bb8751ef09a03597812a8a
(pid=31998)
  /cris/device/introspect/abstract-interfaces:
Broken pipe
FAIL
GTester: last random seed: R02Scb050561a91791436483fa6e49d517a1
(pid=32002)
FAIL: tests/device-introspect-test
TEST: tests/qom-test... (pid=32003)
Broken pipe
FAIL: tests/qom-test

thanks
-- PMM
Peter Maydell March 3, 2017, 4:36 p.m. UTC | #3
On 3 March 2017 at 16:31, Peter Maydell <peter.maydell@linaro.org> wrote:
> x86-64 Linux host:
>
> QTEST_QEMU_BINARY=cris-softmmu/qemu-system-cris
> QTEST_QEMU_IMG=qemu-img MALLOC_PERTURB_=${MALLOC_PERTURB_:-$((RANDOM %
> 255 + 1))} gtester -k --verbose -m=quick  tests/qmp-test
> tests/device-introspect-test tests/qom-test
> TEST: tests/qmp-test... (pid=31974)
>   /cris/qmp/protocol:
> Broken pipe
> FAIL

Failure is intermittent. QEMU_LOG=1 output, failure case:

e104462:xenial:all$ QTEST_LOG=1
QTEST_QEMU_BINARY=cris-softmmu/qemu-system-cris
QTEST_QEMU_IMG=qemu-img MALLOC_PERTURB_=${MALLOC_PERTURB_:-$((RANDOM %
255 + 1))} gtester -k --verbose -m=quick  tests/qmp-test
TEST: tests/qmp-test... (pid=1841)
  /cris/qmp/protocol:
[I 1488558847.011696] OPENED
[R +0.000164] endianness
[S +0.000179] OK little
{"QMP": {"version": {"qemu": {"micro": 50, "minor": 8, "major": 2},
"package": " (vfio-updates-20170223.0-593-gde6e31a-dirty)"},
"capabilities": []}}{"execute": "query-version"}

{"error": {"class": "CommandNotFound", "desc": "Expecting capabilities
negotiation with 'qmp_capabilities'"}}null

{"error": {"class": "GenericError", "desc": "QMP input must be a JSON
object"}}{}

{"error": {"class": "GenericError", "desc": "QMP input object lacks
key 'execute'"}}{"execute": true}

{"error": {"class": "GenericError", "desc": "QMP input object member
'execute' must be a string"}}{"execute": "no-such-cmd", "arguments":
[]}

{"error": {"class": "GenericError", "desc": "QMP input object member
'arguments' must be an object"}}{"extra": true, "execute":
"no-such-cmd"}

{"error": {"class": "GenericError", "desc": "QMP input object member
'extra' is unexpected"}}{"execute": "qmp_capabilities"}

Broken pipe
FAIL
GTester: last random seed: R02S7b62b97f8c425a4013400ffd29bcf904
(pid=1846)
FAIL: tests/qmp-test


Success case:
e104462:xenial:all$ QTEST_LOG=1
QTEST_QEMU_BINARY=cris-softmmu/qemu-system-cris
QTEST_QEMU_IMG=qemu-img MALLOC_PERTURB_=${MALLOC_PERTURB_:-$((RANDOM %
255 + 1))} gtester -k --verbose -m=quick  tests/qmp-test
TEST: tests/qmp-test... (pid=1836)
  /cris/qmp/protocol:
[I 1488558845.027917] OPENED
[R +0.000181] endianness
[S +0.000186] OK little
{"QMP": {"version": {"qemu": {"micro": 50, "minor": 8, "major": 2},
"package": " (vfio-updates-20170223.0-593-gde6e31a-dirty)"},
"capabilities": []}}{"execute": "query-version"}

{"error": {"class": "CommandNotFound", "desc": "Expecting capabilities
negotiation with 'qmp_capabilities'"}}null

{"error": {"class": "GenericError", "desc": "QMP input must be a JSON
object"}}{}

{"error": {"class": "GenericError", "desc": "QMP input object lacks
key 'execute'"}}{"execute": true}

{"error": {"class": "GenericError", "desc": "QMP input object member
'execute' must be a string"}}{"execute": "no-such-cmd", "arguments":
[]}

{"error": {"class": "GenericError", "desc": "QMP input object member
'arguments' must be an object"}}{"extra": true, "execute":
"no-such-cmd"}

{"error": {"class": "GenericError", "desc": "QMP input object member
'extra' is unexpected"}}{"execute": "qmp_capabilities"}

{"return": {}}{"execute": "qmp_capabilities"}

{"error": {"class": "CommandNotFound", "desc": "Capabilities
negotiation is already complete, command ignored"}}{"execute":
"query-version"}

{"return": {"qemu": {"micro": 50, "minor": 8, "major": 2}, "package":
" (vfio-updates-20170223.0-593-gde6e31a-dirty)"}}null

{"error": {"class": "GenericError", "desc": "QMP input must be a JSON
object"}}{}

{"error": {"class": "GenericError", "desc": "QMP input object lacks
key 'execute'"}}{"execute": true}

{"error": {"class": "GenericError", "desc": "QMP input object member
'execute' must be a string"}}{"execute": "no-such-cmd", "arguments":
[]}

{"error": {"class": "GenericError", "desc": "QMP input object member
'arguments' must be an object"}}{"extra": true, "execute":
"no-such-cmd"}

{"error": {"class": "GenericError", "desc": "QMP input object member
'extra' is unexpected"}}{"execute": "query-name", "id": "cookie#1"}

{"return": {}, "id": "cookie#1"}{"execute": "human-monitor-command", "id": 2}

{"id": 2, "error": {"class": "GenericError", "desc": "Parameter
'command-line' is missing"}}[I +0.003521] CLOSED
OK
PASS: tests/qmp-test

thanks
-- PMM
Peter Maydell March 3, 2017, 4:40 p.m. UTC | #4
On 3 March 2017 at 16:36, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 3 March 2017 at 16:31, Peter Maydell <peter.maydell@linaro.org> wrote:
>> x86-64 Linux host:
>>
>> QTEST_QEMU_BINARY=cris-softmmu/qemu-system-cris
>> QTEST_QEMU_IMG=qemu-img MALLOC_PERTURB_=${MALLOC_PERTURB_:-$((RANDOM %
>> 255 + 1))} gtester -k --verbose -m=quick  tests/qmp-test
>> tests/device-introspect-test tests/qom-test
>> TEST: tests/qmp-test... (pid=31974)
>>   /cris/qmp/protocol:
>> Broken pipe
>> FAIL
>
> Failure is intermittent.

gdb'ing the qemu shows a SEGV accessing a NULL qdict:

Thread 1 "qemu-system-cri" received signal SIGSEGV, Segmentation fault.
0x00005555557e98b9 in qdict_find (bucket=<optimised out>,
    key=0x55555587fd17 "error", qdict=0x0)
    at /home/petmay01/linaro/qemu-for-merges/qobject/qdict.c:110
110         QLIST_FOREACH(entry, &qdict->table[bucket], next)
(gdb) bt
#0  0x00005555557e98b9 in qdict_get (bucket=<optimised out>,
key=0x55555587fd17 "error", qdict=0x0)
    at /home/petmay01/linaro/qemu-for-merges/qobject/qdict.c:110
#1  0x00005555557e98b9 in qdict_get (qdict=0x0,
key=key@entry=0x55555587fd17 "error")
    at /home/petmay01/linaro/qemu-for-merges/qobject/qdict.c:157
#2  0x00005555557e9a69 in qdict_get_qdict (qdict=<optimised out>,
key=key@entry=0x55555587fd17 "error")
    at /home/petmay01/linaro/qemu-for-merges/qobject/qdict.c:242
#3  0x000055555561c1f8 in handle_qmp_command (parser=<optimised out>,
tokens=<optimised out>)
    at /home/petmay01/linaro/qemu-for-merges/monitor.c:3727
#4  0x00005555557ebca7 in json_message_process_token
(lexer=0x55555607d148, input=0x55555606b480, type=JSON_RCURLY, x=31,
y=6)
    at /home/petmay01/linaro/qemu-for-merges/qobject/json-streamer.c:105
#5  0x00005555558086fd in json_lexer_feed_char
(lexer=lexer@entry=0x55555607d148, ch=125 '}',
flush=flush@entry=false)
    at /home/petmay01/linaro/qemu-for-merges/qobject/json-lexer.c:319
#6  0x000055555580880e in json_lexer_feed (lexer=0x55555607d148,
buffer=<optimised out>, size=<optimised out>)
    at /home/petmay01/linaro/qemu-for-merges/qobject/json-lexer.c:369
#7  0x00005555557ebd69 in json_message_parser_feed (parser=<optimised
out>, buffer=<optimised out>, size=<optimised out>)
    at /home/petmay01/linaro/qemu-for-merges/qobject/json-streamer.c:124
#8  0x000055555561ad8b in monitor_qmp_read (opaque=<optimised out>,
buf=<optimised out>, size=<optimised out>)
    at /home/petmay01/linaro/qemu-for-merges/monitor.c:3768
#9  0x00005555557a190d in tcp_chr_read (chan=<optimised out>,
cond=<optimised out>, opaque=<optimised out>)
    at /home/petmay01/linaro/qemu-for-merges/chardev/char-socket.c:411
#10 0x00007fffe144404a in g_main_context_dispatch
(context=0x55555606ba80) at
/build/glib2.0-prJhLS/glib2.0-2.48.2/./glib/gmain.c:3154
#11 0x00007fffe144404a in g_main_context_dispatch
(context=context@entry=0x55555606ba80)
    at /build/glib2.0-prJhLS/glib2.0-2.48.2/./glib/gmain.c:3769
#12 0x00005555557f167b in main_loop_wait () at
/home/petmay01/linaro/qemu-for-merges/util/main-loop.c:215
#13 0x00005555557f167b in main_loop_wait (timeout=<optimised out>) at
/home/petmay01/linaro/qemu-for-merges/util/main-loop.c:260
#14 0x00005555557f167b in main_loop_wait (nonblocking=<optimised out>)
at /home/petmay01/linaro/qemu-for-merges/util/main-loop.c:508
#15 0x00005555555d87c5 in main () at
/home/petmay01/linaro/qemu-for-merges/vl.c:1900
#16 0x00005555555d87c5 in main (argc=<optimised out>, argv=<optimised
out>, envp=<optimised out>)
    at /home/petmay01/linaro/qemu-for-merges/vl.c:4714

(In frame 3 handle_qmp_command() the rsp returned from qmp_dispatch()
is NULL.)

thanks
-- PMM
Markus Armbruster March 3, 2017, 4:58 p.m. UTC | #5
Peter Maydell <peter.maydell@linaro.org> writes:

> On 2 March 2017 at 15:25, Peter Maydell <peter.maydell@linaro.org> wrote:
>> make check failures on OSX host:
>
>> May or may not be this pull's fault.
>
> I gave the pull another test, since I've pretty much run out of
> other stuff in the queue, but it failed again in the same way,
> on both OSX and x86-64 Linux.

Thanks, I appreciate it.  I already tracked down the problem (I think),
NAKed the pull request containing it[1], and posted revised patches for
review [2].  I now realize I should have NAKed the one depending on it,
too.  Sorry if this wasted your time!

[...]


[1] [PULL 00/26] QAPI patches for 2017-02-28
[2] [PATCH v4 00/28] qapi: QMP dispatch and input visitor work