1. 02 6月, 2015 7 次提交
    • M
      monitor: Use trad. command interface for HMP pcie_aer_inject_error · 04e00c92
      Markus Armbruster 提交于
      All QMP commands use the "new" handler interface (mhandler.cmd_new).
      Most HMP commands still use the traditional interface (mhandler.cmd),
      but a few use the "new" one.  Complicates handle_user_command() for no
      gain, so I'm converting these to the traditional interface.
      
      pcie_aer_inject_error's implementation is split into the
      hmp_pcie_aer_inject_error() and pcie_aer_inject_error_print().  The
      former is a peculiar crossbreed between HMP and QMP handler.  On
      success, it works like a QMP handler: store QDict through ret_data
      parameter, return 0.  Printing the QDict is left to
      pcie_aer_inject_error_print().  On failure, it works more like an HMP
      handler: print error to monitor, return negative number.
      
      To convert to the traditional interface, turn
      pcie_aer_inject_error_print() into a command handler wrapping around
      hmp_pcie_aer_inject_error().  By convention, this command handler
      should be called hmp_pcie_aer_inject_error(), so rename the existing
      hmp_pcie_aer_inject_error() to do_pcie_aer_inject_error().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      04e00c92
    • M
      monitor: Use traditional command interface for HMP device_add · 318660f8
      Markus Armbruster 提交于
      All QMP commands use the "new" handler interface (mhandler.cmd_new).
      Most HMP commands still use the traditional interface (mhandler.cmd),
      but a few use the "new" one.  Complicates handle_user_command() for no
      gain, so I'm converting these to the traditional interface.
      
      For device_add, that's easy: just wrap the obvious hmp_device_add()
      around do_device_add().
      
      monitor_user_noop() is now unused, drop it.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      318660f8
    • M
      monitor: Use traditional command interface for HMP drive_del · 072ebe6b
      Markus Armbruster 提交于
      All QMP commands use the "new" handler interface (mhandler.cmd_new).
      Most HMP commands still use the traditional interface (mhandler.cmd),
      but a few use the "new" one.  Complicates handle_user_command() for no
      gain, so I'm converting these to the traditional interface.
      
      For drive_del, that's easy: hmp_drive_del() sheds its unused last
      parameter, and its return value, which the caller ignored anyway.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      072ebe6b
    • M
    • M
      monitor: Improve and document client_migrate_info protocol error · 13cadefb
      Markus Armbruster 提交于
      Protocol must be spice, vnc isn't implemented.  Fix up documentation.
      
      Attempts to use vnc or any other unknown protocol yield the misleading
      error message "Invalid parameter 'protocol'".  Improve it to
      "Parameter 'protocol' expects spice".
      
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by. Gerd Hoffmann <kraxel@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      13cadefb
    • M
      monitor: Clean up after previous commit · 84add864
      Markus Armbruster 提交于
      Inline qmp_call_cmd() along with its helper handler_audit() into its
      only caller handle_qmp_command(), and simplify the result.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      84add864
    • M
      monitor: Drop broken, unused asynchronous command interface · 65207c59
      Markus Armbruster 提交于
      The asynchronous monitor command interface goes back to commit 940cc30d
      (Jan 2010).  Added a third case to command execution.  The hope back
      then according to the commit message was that all commands get
      converted to the asynchronous interface, killing off the other two
      cases.  Didn't happen.
      
      The initial asynchronous commands balloon and info balloon were
      converted back to synchronous long ago (commit 96637bcd and d72f32),
      with commit messages calling the asynchronous interface "not fully
      working" and "deprecated".  The only other user went away in commit
      3b5704b2.
      
      New code generally uses synchronous commands and asynchronous events.
      
      What exactly is still "not fully working" with asynchronous commands?
      Well, here's a bug that defeats actual asynchronous use pretty
      reliably: the reply's ID is wrong (and has always been wrong) unless
      you use the command synchronously!  To reproduce, we need an
      asynchronous command, so we have to go back before commit 3b5704b2.
      Run QEMU with spice:
      
          $ qemu-system-x86_64 -nodefaults -S -spice port=5900,disable-ticketing -qmp stdio
          {"QMP": {"version": {"qemu": {"micro": 94, "minor": 2, "major": 2}, "package": ""}, "capabilities": []}}
      
      Connect a spice client in another terminal:
      
          $ remote-viewer spice://localhost:5900
      
      Set up a migration destination dummy in a third terminal:
      
          $ socat TCP-LISTEN:12345 STDIO
      
      Now paste the following into the QMP monitor:
      
          { "execute": "qmp_capabilities", "id": "i0" }
          { "execute": "client_migrate_info", "id": "i1", "arguments": { "protocol": "spice", "hostname": "localhost", "port": 12345 } }
          { "execute": "query-kvm", "id": "i2" }
      
      Produces two replies immediately, one to qmp_capabilities, and one to
      query-kvm:
      
          {"return": {}, "id": "i0"}
          {"return": {"enabled": false, "present": true}, "id": "i2"}
      
      Both are correct.  Two lines of debug output from libspice-server not
      shown.
      
      Now EOF socat's standard input to make it close the connection.  This
      makes the asynchronous client_migrate_info complete.  It replies:
      
          {"return": {}}
      
      Bug: "id": "i1" is missing.  Two lines of debug output from
      libspice-server not shown.  Cherry on top: storage for the missing ID
      is leaked.
      
      Get rid of this stuff before somebody hurts himself with it.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      65207c59
  2. 01 6月, 2015 23 次提交
  3. 31 5月, 2015 10 次提交