qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] ea2933: qapi: Improve input_type_enum()'s err


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] ea2933: qapi: Improve input_type_enum()'s error message
Date: Wed, 27 Oct 2021 09:43:40 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: ea29331ba6c0e622e63424cc8495177ed7655a77
      
https://github.com/qemu/qemu/commit/ea29331ba6c0e622e63424cc8495177ed7655a77
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-27 (Wed, 27 Oct 2021)

  Changed paths:
    M qapi/qapi-visit-core.c
    M tests/qemu-iotests/049.out
    M tests/qemu-iotests/206.out
    M tests/qemu-iotests/237.out
    M tests/qemu-iotests/245
    M tests/qemu-iotests/287
    M tests/qemu-iotests/308
    M tests/unit/check-qom-proplist.c

  Log Message:
  -----------
  qapi: Improve input_type_enum()'s error message

The error message claims the parameter is invalid:

    $ qemu-system-x86_64 -object qom-type=nonexistent
    qemu-system-x86_64: -object qom-type=nonexistent: Invalid parameter 
'nonexistent'

What's wrong is actually the *value* 'nonexistent'.  Improve the
message to

    qemu-system-x86_64: -object qom-type=nonexistent: Parameter 'qom-type' does 
not accept value 'nonexistent'

Fixes: https://gitlab.com/qemu-project/qemu/-/issues/608
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20211020180231.434071-1-armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 75ecee7262548d21a9e20c12f0b3b12f8a51d5c6
      
https://github.com/qemu/qemu/commit/75ecee7262548d21a9e20c12f0b3b12f8a51d5c6
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-27 (Wed, 27 Oct 2021)

  Changed paths:
    M docs/about/deprecated.rst
    M docs/devel/qapi-code-gen.rst
    M qapi/introspect.json
    M scripts/qapi/introspect.py

  Log Message:
  -----------
  qapi: Enable enum member introspection to show more than name

The next commit will add feature flags to enum members.  There's a
problem, though: query-qmp-schema shows an enum type's members as an
array of member names (SchemaInfoEnum member @values).  If it showed
an array of objects with a name member, we could simply add more
members to these objects.  Since it's just strings, we can't.

I can see three ways to correct this design mistake:

1. Do it the way we should have done it, plus compatibility goo.

   We want a ['SchemaInfoEnumMember'] member in SchemaInfoEnum.  Since
   changing @values would be a compatibility break, add a new member
   @members instead.

   @values is now redundant.  In my testing, output of
   qemu-system-x86_64's query-qmp-schema grows by 11% (18.5KiB).

   We can deprecate @values now and drop it later.  This will break
   outmoded clients.  Well-behaved clients such as libvirt are
   expected to break cleanly.

2. Like 1, but omit "boring" elements of @member, and empty @member.

   @values does not become redundant.  @members augments it.  Somewhat
   cumbersome, but output of query-qmp-schema grows only as we make
   enum members non-boring.

   There is nothing to deprecate here.

3. Versioned query-qmp-schema.

   query-qmp-schema provides either @values or @members.  The QMP
   client can select which version it wants.  There is no redundant
   output.

   We can deprecate old versions and eventually drop them.  This will
   break outmoded clients.  Breaking cleanly is easier than for 1.

   While 1 and 2 operate within the common rules for compatible
   evolution apply (section "Compatibility considerations" in
   docs/devel/qapi-code-gen.rst), 3 bypasses them.  Attractive when
   operating within the rules is just too awkward.  Not the case here.

This commit implements 1.  Libvirt developers prefer it.

Deprecate @values in favour of @members.  Since query-qmp-schema
compatibility is pretty fundamental for management applications, an
extended grace period is advised.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Peter Krempa <pkrempa@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
Message-Id: <20211025042405.3762351-2-armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>


  Commit: b6c18755e41f7b40aad4c2c8188fb1719535699d
      
https://github.com/qemu/qemu/commit/b6c18755e41f7b40aad4c2c8188fb1719535699d
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-27 (Wed, 27 Oct 2021)

  Changed paths:
    M docs/devel/qapi-code-gen.rst
    M qapi/compat.json
    M qapi/introspect.json
    M scripts/qapi/expr.py
    M scripts/qapi/introspect.py
    M scripts/qapi/schema.py
    M tests/qapi-schema/doc-good.json
    M tests/qapi-schema/doc-good.out
    M tests/qapi-schema/doc-good.txt
    M tests/qapi-schema/enum-dict-member-unknown.err
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/qapi-schema/test-qapi.py

  Log Message:
  -----------
  qapi: Add feature flags to enum members

This is quite similar to commit 84ab008687 "qapi: Add feature flags to
struct members", only for enums instead of structs.

Special feature flag 'deprecated' is silently ignored there.  This is
okay only because it will be implemented shortly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20211025042405.3762351-3-armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>


  Commit: ed29bb28f8b0b17e965efcc2535fc32e101e3ceb
      
https://github.com/qemu/qemu/commit/ed29bb28f8b0b17e965efcc2535fc32e101e3ceb
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-27 (Wed, 27 Oct 2021)

  Changed paths:
    M include/qapi/qobject-input-visitor.h
    M include/qapi/qobject-output-visitor.h
    M include/qapi/visitor-impl.h
    M include/qapi/visitor.h
    M qapi/qapi-visit-core.c
    M qapi/qmp-dispatch.c
    M qapi/qobject-input-visitor.c
    M qapi/qobject-output-visitor.c

  Log Message:
  -----------
  qapi: Move compat policy from QObject to generic visitor

The next commit needs to access compat policy from the generic visitor
core.  Move it there from qobject input and output visitor.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20211025042405.3762351-4-armbru@redhat.com>


  Commit: aa2370444b62f8f9a809c024d0c41cb40658a5c3
      
https://github.com/qemu/qemu/commit/aa2370444b62f8f9a809c024d0c41cb40658a5c3
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-10-27 (Wed, 27 Oct 2021)

  Changed paths:
    M include/qapi/util.h
    M qapi/compat.json
    M qapi/qapi-visit-core.c
    M scripts/qapi/types.py

  Log Message:
  -----------
  qapi: Implement deprecated-input={reject,crash} for enum values

This copies the code implementing the policy from qapi/qmp-dispatch.c
to qapi/qobject-input-visitor.c.  Tolerable, but if we acquire more
copies, we should look into factoring them out.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Peter Krempa <pkrempa@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
Message-Id: <20211025042405.3762351-5-armbru@redhat.com>


  Commit: 5c49c6c241e524b6ba7768de07cab6f2056feb90
      
https://github.com/qemu/qemu/commit/5c49c6c241e524b6ba7768de07cab6f2056feb90
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2021-10-27 (Wed, 27 Oct 2021)

  Changed paths:
    M docs/about/deprecated.rst
    M docs/devel/qapi-code-gen.rst
    M include/qapi/qobject-input-visitor.h
    M include/qapi/qobject-output-visitor.h
    M include/qapi/util.h
    M include/qapi/visitor-impl.h
    M include/qapi/visitor.h
    M qapi/compat.json
    M qapi/introspect.json
    M qapi/qapi-visit-core.c
    M qapi/qmp-dispatch.c
    M qapi/qobject-input-visitor.c
    M qapi/qobject-output-visitor.c
    M scripts/qapi/expr.py
    M scripts/qapi/introspect.py
    M scripts/qapi/schema.py
    M scripts/qapi/types.py
    M tests/qapi-schema/doc-good.json
    M tests/qapi-schema/doc-good.out
    M tests/qapi-schema/doc-good.txt
    M tests/qapi-schema/enum-dict-member-unknown.err
    M tests/qapi-schema/qapi-schema-test.json
    M tests/qapi-schema/qapi-schema-test.out
    M tests/qapi-schema/test-qapi.py
    M tests/qemu-iotests/049.out
    M tests/qemu-iotests/206.out
    M tests/qemu-iotests/237.out
    M tests/qemu-iotests/245
    M tests/qemu-iotests/287
    M tests/qemu-iotests/308
    M tests/unit/check-qom-proplist.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-10-27' into 
staging

QAPI patches patches for 2021-10-27

# gpg: Signature made Wed 27 Oct 2021 08:21:54 AM PDT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]

* remotes/armbru/tags/pull-qapi-2021-10-27:
  qapi: Implement deprecated-input={reject,crash} for enum values
  qapi: Move compat policy from QObject to generic visitor
  qapi: Add feature flags to enum members
  qapi: Enable enum member introspection to show more than name
  qapi: Improve input_type_enum()'s error message

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/66b095c4fe18...5c49c6c241e5



reply via email to

[Prev in Thread] Current Thread [Next in Thread]