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. 22 6月, 2015 1 次提交
  3. 12 6月, 2015 3 次提交
    • A
      throttle: add the name of the ThrottleGroup to BlockDeviceInfo · b8fe1694
      Alberto Garcia 提交于
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: 172df91f09c69c6f0440a697bbd1b3f95b077ee4.1433779731.git.berto@igalia.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      b8fe1694
    • A
      throttle: Add throttle group support · 76f4afb4
      Alberto Garcia 提交于
      The throttle group support use a cooperative round robin scheduling
      algorithm.
      
      The principles of the algorithm are simple:
      - Each BDS of the group is used as a token in a circular way.
      - The active BDS computes if a wait must be done and arms the right
        timer.
      - If a wait must be done the token timer will be armed so the token
        will become the next active BDS.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Message-id: f0082a86f3ac01c46170f7eafe2101a92e8fde39.1433779731.git.berto@igalia.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      76f4afb4
    • S
      qmp/hmp: add rocker device support · fafa4d50
      Scott Feldman 提交于
      Add QMP/HMP support for rocker devices.  This is mostly for debugging purposes
      to see inside the device's tables and port configurations.  Some examples:
      
      (qemu) info rocker sw1
      name: sw1
      id: 0x0000013512005452
      ports: 4
      
      (qemu) info rocker-ports sw1
                  ena/    speed/ auto
            port  link    duplex neg?
           sw1.1  up     10G  FD  No
           sw1.2  up     10G  FD  No
           sw1.3  !ena   10G  FD  No
           sw1.4  !ena   10G  FD  No
      
      (qemu) info rocker-of-dpa-flows sw1
      prio tbl hits key(mask) --> actions
      2    60       pport 1 vlan 1 LLDP src 00:02:00:00:02:00 dst 01:80:c2:00:00:0e
      2    60       pport 1 vlan 1 ARP src 00:02:00:00:02:00 dst 00:02:00:00:03:00
      2    60       pport 2 vlan 2 IPv6 src 00:02:00:00:03:00 dst 33:33:ff:00:00:02 proto 58
      3    50       vlan 2 dst 33:33:ff:00:00:02 --> write group 0x32000001 goto tbl 60
      2    60       pport 2 vlan 2 IPv6 src 00:02:00:00:03:00 dst 33:33:ff:00:03:00 proto 58
      3    50  1    vlan 2 dst 33:33:ff:00:03:00 --> write group 0x32000001 goto tbl 60
      2    60       pport 2 vlan 2 ARP src 00:02:00:00:03:00 dst 00:02:00:00:02:00
      3    50  2    vlan 2 dst 00:02:00:00:02:00 --> write group 0x02000001 goto tbl 60
      2    60  1    pport 2 vlan 2 IP src 00:02:00:00:03:00 dst 00:02:00:00:02:00 proto 1
      3    50  2    vlan 1 dst 00:02:00:00:03:00 --> write group 0x01000002 goto tbl 60
      2    60  1    pport 1 vlan 1 IP src 00:02:00:00:02:00 dst 00:02:00:00:03:00 proto 1
      2    60       pport 1 vlan 1 IPv6 src 00:02:00:00:02:00 dst 33:33:ff:00:00:01 proto 58
      3    50       vlan 1 dst 33:33:ff:00:00:01 --> write group 0x31000000 goto tbl 60
      2    60       pport 1 vlan 1 IPv6 src 00:02:00:00:02:00 dst 33:33:ff:00:02:00 proto 58
      3    50  1    vlan 1 dst 33:33:ff:00:02:00 --> write group 0x31000000 goto tbl 60
      1    60  173  pport 2 vlan 2 LLDP src <any> dst 01:80:c2:00:00:0e --> write group 0x02000000
      1    60  6    pport 2 vlan 2 IPv6 src <any> dst <any> --> write group 0x02000000
      1    60  174  pport 1 vlan 1 LLDP src <any> dst 01:80:c2:00:00:0e --> write group 0x01000000
      1    60  174  pport 2 vlan 2 IP src <any> dst <any> --> write group 0x02000000
      1    60  6    pport 1 vlan 1 IPv6 src <any> dst <any> --> write group 0x01000000
      1    60  181  pport 2 vlan 2 ARP src <any> dst <any> --> write group 0x02000000
      1    10  715  pport 2 --> apply new vlan 2 goto tbl 20
      1    60  177  pport 1 vlan 1 ARP src <any> dst <any> --> write group 0x01000000
      1    60  174  pport 1 vlan 1 IP src <any> dst <any> --> write group 0x01000000
      1    10  717  pport 1 --> apply new vlan 1 goto tbl 20
      1    0   1432 pport 0(0xffff) --> goto tbl 10
      
      (qemu) info rocker-of-dpa-groups sw1
      id (decode) --> buckets
      0x32000001 (type L2 multicast vlan 2 index 1) --> groups [0x02000001,0x02000000]
      0x02000001 (type L2 interface vlan 2 pport 1) --> pop vlan out pport 1
      0x01000002 (type L2 interface vlan 1 pport 2) --> pop vlan out pport 2
      0x02000000 (type L2 interface vlan 2 pport 0) --> pop vlan out pport 0
      0x01000000 (type L2 interface vlan 1 pport 0) --> pop vlan out pport 0
      0x31000000 (type L2 multicast vlan 1 index 0) --> groups [0x01000002,0x01000000]
      
      [Added "query-" prefixes to rocker.json commands as suggested by Eric
      Blake <eblake@redhat.com>.
      --Stefan]
      Signed-off-by: NScott Feldman <sfeldma@gmail.com>
      Signed-off-by: NJiri Pirko <jiri@resnulli.us>
      Message-id: 1433985681-56138-5-git-send-email-sfeldma@gmail.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      fafa4d50
  4. 02 6月, 2015 2 次提交
  5. 08 5月, 2015 1 次提交
  6. 06 5月, 2015 2 次提交
    • E
      qapi: Drop inline nested structs in query-pci · 9fa02cd1
      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, and reduce
      some long lines.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      9fa02cd1
    • 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
  7. 28 4月, 2015 2 次提交
  8. 17 4月, 2015 1 次提交
    • A
      hmp: fix crash in 'info block -n -v' · 638b8366
      Alberto Garcia 提交于
      The image field in BlockDeviceInfo should never be null, however
      bdrv_block_device_info() is not filling it in.
      
      This makes the 'info block -n -v' command crash QEMU.
      
      The proper solution is probably to move the relevant code from
      bdrv_query_info() to bdrv_block_device_info(), but since we're too
      close to the release for that this simpler workaround solves the
      crash.
      Signed-off-by: NAlberto Garcia <berto@igalia.com>
      Message-id: 1429274688-8115-1-git-send-email-berto@igalia.com
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      638b8366
  9. 17 3月, 2015 5 次提交
  10. 16 3月, 2015 1 次提交
  11. 04 3月, 2015 1 次提交
  12. 03 3月, 2015 1 次提交
  13. 23 2月, 2015 1 次提交
  14. 18 2月, 2015 1 次提交
    • M
      hmp: Name HMP command handler functions hmp_COMMAND() · 3e5a50d6
      Markus Armbruster 提交于
      Some are called do_COMMAND() (old ones, usually), some hmp_COMMAND(),
      and sometimes COMMAND pointlessly differs in spelling.
      
      Normalize to hmp_COMMAND(), where COMMAND is exactly the command name
      with '-' replaced by '_'.
      
      Exceptions:
      
      * do_device_add() and client_migrate_info() *not* renamed to
        hmp_device_add(), hmp_client_migrate_info(), because they're also
        QMP handlers.  They still need to be converted to QAPI.
      
      * do_memory_dump(), do_physical_memory_dump(), do_ioport_read(),
        do_ioport_write() renamed do hmp_* instead of hmp_x(), hmp_xp(),
        hmp_i(), hmp_o(), because those names are too cryptic for my taste.
      
      * do_info_help() renamed to hmp_info_help() instead of hmp_info(),
        because it only covers help.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      3e5a50d6
  15. 16 2月, 2015 1 次提交
    • M
      qemu-io: Use BlockBackend · 4c7b7e9b
      Max Reitz 提交于
      qemu-io should behave like a guest, therefore it should use BlockBackend
      to access the block layer.
      
      There are a couple of places where that is infeasible: First, the
      bdrv_debug_* functions could theoretically be mirrored in the
      BlockBackend, but since these are functions internal to the block layer,
      they should not be visible externally (qemu-io as a test tool is exempt
      from this).
      
      Second, bdrv_get_info() and bdrv_get_specific_info() work on a single
      BDS alone, therefore they should stay BDS-specific.
      
      Third, bdrv_is_allocated() mainly works on a single BDS as well. Some
      data may be passed through from the BDS's file (if sectors which are
      apparently allocated in the file are not really allocated there but just
      zero).
      
      [Fixed conflicts around block_acct_start() usage from Fam Zheng's
      "qemu-io: Account IO by aio_read and aio_write" commit.  Use
      BlockBackend and blk_get_stats() instead of BlockDriverState.
      --Stefan]
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Message-id: 1423162705-32065-14-git-send-email-mreitz@redhat.com
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      4c7b7e9b
  16. 07 2月, 2015 1 次提交
  17. 29 1月, 2015 1 次提交
  18. 10 12月, 2014 5 次提交
  19. 27 9月, 2014 1 次提交
  20. 22 9月, 2014 1 次提交
  21. 03 9月, 2014 2 次提交
  22. 01 7月, 2014 1 次提交
    • J
      block: add backing-file option to block-stream · 13d8cc51
      Jeff Cody 提交于
      On some image chains, QEMU may not always be able to resolve the
      filenames properly, when updating the backing file of an image
      after a block job.
      
      For instance, certain relative pathnames may fail, or drives may
      have been specified originally by file descriptor (e.g. /dev/fd/???),
      or a relative protocol pathname may have been used.
      
      In these instances, QEMU may lack the information to be able to make
      the correct choice, but the user or management layer most likely does
      have that knowledge.
      
      With this extension to the block-stream api, the user is able to change
      the backing file of the active layer as part of the block-stream
      operation.
      
      This allows the change to be 'safe', in the sense that if the attempt
      to write the active image metadata fails, then the block-stream
      operation returns failure, without disrupting the guest.
      
      If a backing file string is not specified in the command, the backing
      file string to use is determined in the same manner as it was
      previously.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      13d8cc51