1. 23 6月, 2015 5 次提交
    • M
      Include qapi/qmp/qerror.h exactly where needed · cc7a8ea7
      Markus Armbruster 提交于
      In particular, don't include it into headers.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      cc7a8ea7
    • M
      qmp: Wean off qerror_report() · 485febc6
      Markus Armbruster 提交于
      The traditional QMP command handler interface
      
          int qmp_FOO(Monitor *mon, const QDict *params, QObject **ret_data);
      
      doesn't provide for returning an Error object.  Instead, the handler
      is expected to stash it in the monitor with qerror_report().
      
      When we rebased QMP on top of QAPI, we didn't change this interface.
      Instead, commit 776574d6 introduced "middle mode" as a temporary aid
      for converting existing QMP commands to QAPI one by one.  More than
      three years later, we're still using it.
      
      Middle mode has two effects:
      
      * Instead of the native input marshallers
      
            static void qmp_marshal_input_FOO(QDict *, QObject **, Error **)
      
        it generates input marshallers conforming to the traditional QMP
        command handler interface.
      
      * It suppresses generation of code to register them with
        qmp_register_command()
      
        This permits giving them internal linkage.
      
      As long as we need qmp-commands.hx, we can't use the registry behind
      qmp_register_command(), so the latter has to stay for now.
      
      The former has to go to get rid of qerror_report().  Changing all QMP
      commands to fit the QAPI mold in one go was impractical back when we
      started, but by now there are just a few stragglers left:
      do_qmp_capabilities(), qmp_qom_set(), qmp_qom_get(), qmp_object_add(),
      qmp_netdev_add(), do_device_add().
      
      Switch middle mode to generate native input marshallers, and adapt the
      stragglers.  Simplifies both the monitor code and the stragglers.
      
      Rename do_qmp_capabilities() to qmp_capabilities(), and
      do_device_add() to qmp_device_add, because that's how QMP command
      handlers are named today.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      485febc6
    • M
      qerror: Clean up QERR_ macros to expand into a single string · c6bd8c70
      Markus Armbruster 提交于
      These macros expand into error class enumeration constant, comma,
      string.  Unclean.  Has been that way since commit 13f59ae8.
      
      The error class is always ERROR_CLASS_GENERIC_ERROR since the previous
      commit.
      
      Clean up as follows:
      
      * Prepend every use of a QERR_ macro by ERROR_CLASS_GENERIC_ERROR, and
        delete it from the QERR_ macro.  No change after preprocessing.
      
      * Rewrite error_set(ERROR_CLASS_GENERIC_ERROR, ...) into
        error_setg(...).  Again, no change after preprocessing.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      c6bd8c70
    • M
      qerror: Eliminate QERR_DEVICE_NOT_FOUND · 75158ebb
      Markus Armbruster 提交于
      Error classes other than ERROR_CLASS_GENERIC_ERROR should not be used
      in new code.  Hiding them in QERR_ macros makes new uses hard to spot.
      Fortunately, there's just one such macro left.  Eliminate it with this
      coccinelle semantic patch:
      
          @@
          expression EP, E;
          @@
          -error_set(EP, QERR_DEVICE_NOT_FOUND, E)
          +error_set(EP, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", E)
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      75158ebb
    • M
      QemuOpts: Wean off qerror_report_err() · 70b94331
      Markus Armbruster 提交于
      qerror_report_err() is a transitional interface to help with
      converting existing monitor commands to QMP.  It should not be used
      elsewhere.
      
      The only remaining user in qemu-option.c is qemu_opts_parse().  Is it
      used in QMP context?  If not, we can simply replace
      qerror_report_err() by error_report_err().
      
      The uses in qemu-img.c, qemu-io.c, qemu-nbd.c and under tests/ are
      clearly not in QMP context.
      
      The uses in vl.c aren't either, because the only QMP command handlers
      there are qmp_query_status() and qmp_query_machines(), and they don't
      call it.
      
      Remaining uses:
      
      * drive_def(): Command line -drive and such, HMP drive_add and pci_add
      
      * hmp_chardev_add(): HMP chardev-add
      
      * monitor_parse_command(): HMP core
      
      * tmp_config_parse(): Command line -tpmdev
      
      * net_host_device_add(): HMP host_net_add
      
      * net_client_parse(): Command line -net and -netdev
      
      * qemu_global_option(): Command line -global
      
      * vnc_parse_func(): Command line -display, -vnc, default display, HMP
        change, QMP change.  Bummer.
      
      * qemu_pci_hot_add_nic(): HMP pci_add
      
      * usb_net_init(): Command line -usbdevice, HMP usb_add
      
      Propagate errors through qemu_opts_parse().  Create a convenience
      function qemu_opts_parse_noisily() that passes errors to
      error_report_err().  Switch all non-QMP users outside tests to it.
      
      That leaves vnc_parse_func().  Propagate errors through it.  Since I'm
      touching it anyway, rename it to vnc_parse().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NLuiz Capitulino <lcapitulino@redhat.com>
      70b94331
  2. 20 6月, 2015 1 次提交
  3. 06 5月, 2015 1 次提交
    • E
      qapi: Drop inline nested struct in query-version · 4752cdbb
      Eric Blake 提交于
      A future patch will be using a 'name':{dictionary} entry in the
      QAPI schema to specify a default value for an optional argument
      (see previous commit message for more details why); but existing
      use of inline nested structs conflicts with that goal. This patch
      fixes one of only two commands relying on nested types, by
      breaking the nesting into an explicit type; it means that the
      type is now boxed instead of unboxed in C code, but the QMP wire
      format is unaffected by this change.
      
      Prefer the safer g_new0() while making the conversion.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      4752cdbb
  4. 01 4月, 2015 1 次提交
  5. 10 3月, 2015 1 次提交
  6. 16 2月, 2015 1 次提交
  7. 10 2月, 2015 1 次提交
  8. 07 2月, 2015 1 次提交
  9. 29 1月, 2015 2 次提交
  10. 22 1月, 2015 1 次提交
  11. 15 10月, 2014 1 次提交
    • G
      qmp: Print descriptions of object properties · 07d09c58
      Gonglei 提交于
      Add a new "description" field to DevicePropertyInfo.
      The descriptions can serve as documentation in the code,
      and they can be used to provide better help. For example:
      
      $./qemu-system-x86_64 -device virtio-blk-pci,?
      
      Before this patch:
      
      virtio-blk-pci.iothread=link<iothread>
      virtio-blk-pci.x-data-plane=bool
      virtio-blk-pci.scsi=bool
      virtio-blk-pci.config-wce=bool
      virtio-blk-pci.serial=str
      virtio-blk-pci.secs=uint32
      virtio-blk-pci.heads=uint32
      virtio-blk-pci.cyls=uint32
      virtio-blk-pci.discard_granularity=uint32
      virtio-blk-pci.bootindex=int32
      virtio-blk-pci.opt_io_size=uint32
      virtio-blk-pci.min_io_size=uint16
      virtio-blk-pci.physical_block_size=uint16
      virtio-blk-pci.logical_block_size=uint16
      virtio-blk-pci.drive=str
      virtio-blk-pci.virtio-backend=child<virtio-blk-device>
      virtio-blk-pci.command_serr_enable=on/off
      virtio-blk-pci.multifunction=on/off
      virtio-blk-pci.rombar=uint32
      virtio-blk-pci.romfile=str
      virtio-blk-pci.addr=pci-devfn
      virtio-blk-pci.event_idx=on/off
      virtio-blk-pci.indirect_desc=on/off
      virtio-blk-pci.vectors=uint32
      virtio-blk-pci.ioeventfd=on/off
      virtio-blk-pci.class=uint32
      
      After:
      
      virtio-blk-pci.iothread=link<iothread>
      virtio-blk-pci.x-data-plane=bool (on/off)
      virtio-blk-pci.scsi=bool (on/off)
      virtio-blk-pci.config-wce=bool (on/off)
      virtio-blk-pci.serial=str
      virtio-blk-pci.secs=uint32
      virtio-blk-pci.heads=uint32
      virtio-blk-pci.cyls=uint32
      virtio-blk-pci.discard_granularity=uint32
      virtio-blk-pci.bootindex=int32
      virtio-blk-pci.opt_io_size=uint32
      virtio-blk-pci.min_io_size=uint16
      virtio-blk-pci.physical_block_size=uint16 (A power of two between 512 and 32768)
      virtio-blk-pci.logical_block_size=uint16 (A power of two between 512 and 32768)
      virtio-blk-pci.drive=str (ID of a drive to use as a backend)
      virtio-blk-pci.virtio-backend=child<virtio-blk-device>
      virtio-blk-pci.command_serr_enable=bool (on/off)
      virtio-blk-pci.multifunction=bool (on/off)
      virtio-blk-pci.rombar=uint32
      virtio-blk-pci.romfile=str
      virtio-blk-pci.addr=int32 (Slot and optional function number, example: 06.0 or 06)
      virtio-blk-pci.event_idx=bool (on/off)
      virtio-blk-pci.indirect_desc=bool (on/off)
      virtio-blk-pci.vectors=uint32
      virtio-blk-pci.ioeventfd=bool (on/off)
      virtio-blk-pci.class=uint32
      
      Cc: Markus Armbruster <armbru@redhat.com>
      Signed-off-by: NGonglei <arei.gonglei@huawei.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      07d09c58
  12. 15 8月, 2014 1 次提交
  13. 07 7月, 2014 1 次提交
    • S
      qmp: show QOM properties in device-list-properties · f4eb32b5
      Stefan Hajnoczi 提交于
      Devices can use a mix of qdev and QOM properties.  Currently only the
      qdev properties are displayed by device-list-properties.
      
      This patch extends the property enumeration algorithm to also display
      QOM properties (excluding the implicit "type", "realized",
      "hotpluggable", and "parent_bus" properties).
      
      When a qdev property exists, use the qdev type name to preserve
      backwards compatibility.  QOM type names can be different for bool (qdev
      on/off) and str (used by qdev pointers).
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      f4eb32b5
  14. 19 6月, 2014 4 次提交
  15. 09 5月, 2014 2 次提交
  16. 08 5月, 2014 1 次提交
  17. 06 5月, 2014 1 次提交
  18. 25 4月, 2014 2 次提交
  19. 13 3月, 2014 1 次提交
  20. 02 3月, 2014 1 次提交
  21. 29 1月, 2014 2 次提交
  22. 07 1月, 2014 2 次提交
  23. 16 12月, 2013 1 次提交
  24. 01 5月, 2013 1 次提交
  25. 30 4月, 2013 1 次提交
  26. 16 4月, 2013 1 次提交
  27. 19 12月, 2012 2 次提交