qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 46abb8: balloon: improve error msg when addin


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 46abb8: balloon: improve error msg when adding second devi...
Date: Mon, 27 Apr 2015 11:30:07 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 46abb8124006887d071921c5e657eeec3c50a9e2
      
https://github.com/qemu/qemu/commit/46abb8124006887d071921c5e657eeec3c50a9e2
  Author: Luiz Capitulino <address@hidden>
  Date:   2015-04-24 (Fri, 24 Apr 2015)

  Changed paths:
    M balloon.c
    M hw/virtio/virtio-balloon.c

  Log Message:
  -----------
  balloon: improve error msg when adding second device

A VM supports only one balloon device, but due to several changes
in infrastructure the error message got messed up when trying
to add a second device. Fix it.

Before this fix

Command-line:

qemu-qmp: -device virtio-balloon-pci,id=balloon0: Another balloon device 
already registered
qemu-qmp: -device virtio-balloon-pci,id=balloon0: Adding balloon handler failed
qemu-qmp: -device virtio-balloon-pci,id=balloon0: Device 'virtio-balloon-pci' 
could not be initialized

HMP:

Another balloon device already registered
Adding balloon handler failed
Device 'virtio-balloon-pci' could not be initialized

QMP:

{ "execute": "device_add", "arguments": { "driver": "virtio-balloon-pci", "id": 
"balloon0" } }
{
        "error": {
                "class": "GenericError",
                "desc": "Adding balloon handler failed"
        }
}

After this fix

Command-line:

qemu-qmp: -device virtio-balloon-pci,id=balloon0: Only one balloon device is 
supported
qemu-qmp: -device virtio-balloon-pci,id=balloon0: Device 'virtio-balloon-pci' 
could not be initialized

HMP:

(qemu) device_add virtio-balloon-pci,id=balloon0
Only one balloon device is supported
Device 'virtio-balloon-pci' could not be initialized
(qemu)

QMP:

{ "execute": "device_add",
    "arguments": { "driver": "virtio-balloon-pci", "id": "balloon0" } }
{
    "error": {
  "class": "GenericError",
  "desc": "Only one balloon device is supported"
    }
}

Signed-off-by: Luiz Capitulino <address@hidden>
Reviewed-by: Eric Blake <address@hidden>


  Commit: 6540e9f35bfeea2baf4509745516172070dca412
      
https://github.com/qemu/qemu/commit/6540e9f35bfeea2baf4509745516172070dca412
  Author: Eric Blake <address@hidden>
  Date:   2015-04-24 (Fri, 24 Apr 2015)

  Changed paths:
    M scripts/qapi-visit.py

  Log Message:
  -----------
  qapi: Drop dead genlist parameter

Defaulting a parameter to True, then having all callers omit or
pass an explicit True for that parameter, is pointless. Looks
like it has been dead since introduction in commit 06d64c6, more
than 4 years ago.

Signed-off-by: Eric Blake <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 43d0a2c1af5bc77ed067636db956209779351dfe
      
https://github.com/qemu/qemu/commit/43d0a2c1af5bc77ed067636db956209779351dfe
  Author: Paolo Bonzini <address@hidden>
  Date:   2015-04-24 (Fri, 24 Apr 2015)

  Changed paths:
    M qmp-commands.hx

  Log Message:
  -----------
  qmp-commands: fix incorrect uses of ":O" specifier

As far as the QMP parser is concerned, neither the 'O' nor the 'q' format 
specifiers
put any constraint on the command.  However, there are two differences:

1) from a documentation point of view 'O' says that this command takes
a dictionary.  The dictionary will be converted to QemuOpts in the
handler to match the corresponding HMP command.

2) 'O' sets QMP_ACCEPT_UNKNOWNS, resulting in the command accepting invalid
extra arguments.  For example the following is accepted:

   { "execute": "send-key",
  "arguments": { "keys": [ { "type": "qcode", "data": "ctrl" },
                           { "type": "qcode", "data": "alt" },
                           { "type": "qcode", "data": "delete" } ], "foo": 
"bar" } }

Neither send-key nor migrate-set-capabilities take a QemuOpts-like
dictionary; they take an array of dictionaries.  And neither command
really wants to have extra unknown arguments.  Thus, the right
specifier to use in this case is 'q'; with this patch the above
command fails with

   {"error": {"class": "GenericError", "desc": "Invalid parameter 'foo'"}}

as intended.

Reported-by: Alberto Garcia <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 2d5a8346a484250934526a15b3a522bdba7e6772
      
https://github.com/qemu/qemu/commit/2d5a8346a484250934526a15b3a522bdba7e6772
  Author: Eric Blake <address@hidden>
  Date:   2015-04-24 (Fri, 24 Apr 2015)

  Changed paths:
    M monitor.c

  Log Message:
  -----------
  qmp: Give saner messages related to qmp_capabilities misuse

Pretending that QMP doesn't understand a command merely because
we are not in the right mode doesn't help first-time users figure
out what to do to correct things.  Although the documentation for
QMP calls out capabilities negotiation, we should also make it
clear in our error messages what we were expecting.  With this
patch, I now get the following transcript:

$ ./x86_64-softmmu/qemu-system-x86_64 -qmp stdio -nodefaults
{"QMP": {"version": {"qemu": {"micro": 93, "minor": 2, "major": 2}, "package": 
""}, "capabilities": []}}
{"execute":"huh"}
{"error": {"class": "CommandNotFound", "desc": "The command huh has not been 
found"}}
{"execute":"quit"}
{"error": {"class": "CommandNotFound", "desc": "Expecting capabilities 
negotiation with 'qmp_capabilities' before command 'quit'"}}
{"execute":"qmp_capabilities"}
{"return": {}}
{"execute":"qmp_capabilities"}
{"error": {"class": "CommandNotFound", "desc": "Capabilities negotiation is 
already complete, command 'qmp_capabilities' ignored"}}
{"execute":"quit"}
{"return": {}}
{"timestamp": {"seconds": 1429110729, "microseconds": 181935}, "event": 
"SHUTDOWN"}

Signed-off-by: Eric Blake <address@hidden>
Tested-By: Kashyap Chamarthy <address@hidden>
Reviewed-by: Paulo Vital <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 0d81cdddaa40a1988b24657aeac19959cfad0fde
      
https://github.com/qemu/qemu/commit/0d81cdddaa40a1988b24657aeac19959cfad0fde
  Author: Peter Maydell <address@hidden>
  Date:   2015-04-27 (Mon, 27 Apr 2015)

  Changed paths:
    M balloon.c
    M hw/virtio/virtio-balloon.c
    M monitor.c
    M qmp-commands.hx
    M scripts/qapi-visit.py

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/qmp-unstable/tags/for-upstream' into 
staging

Four little fixes

# gpg: Signature made Fri Apr 24 19:56:51 2015 BST using RSA key ID E24ED5A7
# gpg: Good signature from "Luiz Capitulino <address@hidden>"

* remotes/qmp-unstable/tags/for-upstream:
  qmp: Give saner messages related to qmp_capabilities misuse
  qmp-commands: fix incorrect uses of ":O" specifier
  qapi: Drop dead genlist parameter
  balloon: improve error msg when adding second device

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/e1a5476354d3...0d81cdddaa40

reply via email to

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