1. 27 3月, 2010 1 次提交
  2. 17 3月, 2010 4 次提交
    • S
      fd04a2ae
    • M
      monitor: New argument type 'O' · 361127df
      Markus Armbruster 提交于
      In the human monitor, it declares a single optional argument to be
      parsed according to the QemuOptsList given by its name.
      
      In QMP, it declares an optional argument for each member of the
      QemuOptsList.
      
      Restriction: only lists with empty desc are supported for now.  Good
      enough for the job at hand.  We'll lift the restriction when we need
      that.
      361127df
    • M
      error: Let converted handlers print in human monitor · cde0fc75
      Markus Armbruster 提交于
      While fully converted handlers are not supposed to print anything when
      running in a QMP monitor, they are free to print in a human monitor.
      For instance, device_add (not yet converted) prints help, and will
      continue to do so after conversion.
      
      Moreover, utility functions converted to QError should remain usable
      from unconverted handlers.
      
      Two problems:
      
      * handler_audit() complains when a converted handler prints.  Limit
        that to QMP monitors.
      
      * With QMP, handlers need to pass the error object by way of
        monitor_set_error().  However, we do that both for QMP and for the
        human monitor.  The human monitor prints the error object after the
        handler returns.  If the handler prints anything else, that output
        "overtakes" the error message.
      
        Limit use of monitor_set_error() to QMP monitors.  Update
        handler_audit() accordingly.
      cde0fc75
    • M
      monitor: New monitor_cur_is_qmp() · 6620d3ce
      Markus Armbruster 提交于
      6620d3ce
  3. 16 3月, 2010 6 次提交
    • M
      ab5b027e
    • M
      error: Simplify error sink setup · 6e4f984c
      Markus Armbruster 提交于
      qemu_error_sink can either point to a monitor or a file.  In practice,
      it always points to the current monitor if we have one, else to
      stderr.  Simply route errors to the current monitor or else to stderr,
      and remove qemu_error_sink along with the functions to control it.
      
      Actually, the old code switches the sink slightly later, in
      handle_user_command() and handle_qmp_command(), than it gets switched
      now, implicitly, by setting the current monitor in monitor_read() and
      monitor_control_read().  Likewise, it switches back slightly earlier
      (same places).  Doesn't make a difference, because there are no calls
      of qemu_error() in between.
      6e4f984c
    • M
      error: Move qemu_error() & friends from monitor.c to own file · b4a51f7f
      Markus Armbruster 提交于
      They're about reporting errors, not about the monitor.
      b4a51f7f
    • M
      monitor: Factor monitor_set_error() out of qemu_error_internal() · d6f46833
      Markus Armbruster 提交于
      This separates the monitor part from the QError part.
      d6f46833
    • M
      monitor: Separate "default monitor" and "current monitor" cleanly · 8631b608
      Markus Armbruster 提交于
      Commits 376253ec..731b0364 introduced global variable cur_mon, which
      points to the "default monitor" (if any), except during execution of
      monitor_read() or monitor_control_read() it points to the monitor from
      which we're reading instead (the "current monitor").  Monitor command
      handlers run within monitor_read() or monitor_control_read().
      
      Default monitor and current monitor are really separate things, and
      squashing them together is confusing and error-prone.
      
      For instance, usb_host_scan() can run both in "info usbhost" and
      periodically via usb_host_auto_check().  It prints to cur_mon, which
      is what we want in the former case: the monitor executing "info
      usbhost".  But since that's the default monitor in the latter case, it
      periodically spams the default monitor there.
      
      A few places use cur_mon to log stuff to the default monitor.  If we
      ever log something while cur_mon points to current monitor instead of
      default monitor, the log temporarily "jumps" to another monitor.
      Whether that can or cannot happen isn't always obvious.
      
      Maybe logging to the default monitor (which may not even exist) is a
      bad idea, and we should log to stderr or a logfile instead.  But
      that's outside the scope of this commit.
      
      Change cur_mon to point to the current monitor.  Create new
      default_mon to point to the default monitor.  Update users of cur_mon
      accordingly.
      
      This fixes the periodical spamming of the default monitor by
      usb_host_scan().  It also stops "log jumping", should that problem
      exist.
      8631b608
    • M
      savevm: Fix -loadvm to report errors to stderr, not the monitor · 03cd4655
      Markus Armbruster 提交于
      A monitor may not even exist.
      
      Change load_vmstate() to use qemu_error() instead of monitor_printf().
      Parameter mon is now unused, remove it.
      03cd4655
  4. 09 3月, 2010 4 次提交
  5. 24 2月, 2010 1 次提交
  6. 20 2月, 2010 19 次提交
  7. 11 2月, 2010 5 次提交
    • L
      QMP: Don't leak on connection close · 47116d1c
      Luiz Capitulino 提交于
      QMP's chardev event callback doesn't call
      json_message_parser_destroy() on CHR_EVENT_CLOSED. As the call
      to json_message_parser_init() on CHR_EVENT_OPENED allocates memory,
      we'are leaking on close.
      
      Fix that by just calling json_message_parser_destroy() on
      CHR_EVENT_CLOSED.
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      47116d1c
    • L
      QError: Don't abort on multiple faults · 27a749fb
      Luiz Capitulino 提交于
      Ideally, Monitor code should report an error only once and
      return the error information up the call chain.
      
      To assure that this happens as expected and that no error is
      lost, we have an assert() in qemu_error_internal().
      
      However, we still have not fully converted handlers using
      monitor_printf() to report errors. As there can be multiple
      monitor_printf() calls on an error, the assertion is easily
      triggered when debugging is enabled; and we will get a memory
      leak if it's not.
      
      The solution to this problem is to allow multiple faults by only
      reporting the first one, and to release the additional error objects.
      
      A better mechanism to report multiple errors to programmers is
      underway.
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      27a749fb
    • L
      Monitor: remove unneeded checks · ba144141
      Luiz Capitulino 提交于
      It's not needed to check the return of qobject_from_jsonf()
      anymore, as an assert() has been added there.
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      ba144141
    • L
      QMP: Enforce capability negotiation rules · 09069b19
      Luiz Capitulino 提交于
      With this commit QMP will be started in Capabilities Negotiation
      mode, where the only command allowed to run is 'qmp_capabilities'.
      
      All other commands will return CommandNotFound error. Asynchronous
      messages are not delivered either.
      
      When 'qmp_capabilities' is successfully executed QMP enters in
      Command mode, where all commands (except 'qmp_capabilities') are
      allowed to run and asynchronous messages are delivered.
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      09069b19
    • L
      QMP: Introduce the qmp_capabilities command · 4a7e1190
      Luiz Capitulino 提交于
      This command will be used to enable QMP capabilities advertised
      by the capabilities array.
      
      Note that it will be mandatory to issue this command in order
      to make QMP functional (although this behavior is not being
      enforced by this commit).
      
      Also, as we don't have any capabilities yet, the new command
      doesn't accept any arguments. I will postpone the decision for
      a format for this until we get our first capability.
      
      Finally, this command is visible from the user Monitor too, in
      the meaning that you can execute it but it won't do anything.
      Making it only visible in QMP is beyond this series' goal, as
      it requires changes in unrelated places.
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      4a7e1190