1. 25 10月, 2016 1 次提交
  2. 06 10月, 2016 1 次提交
  3. 23 9月, 2016 3 次提交
    • K
      block: Accept device model name for blockdev-change-medium · 70e2cb3b
      Kevin Wolf 提交于
      In order to remove the need for BlockBackend names in the external API,
      we want to allow qdev device names in all device related commands.
      
      This converts blockdev-change-medium to accept a qdev device name.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      70e2cb3b
    • F
      vl: Switch qemu_uuid to QemuUUID · 9c5ce8db
      Fam Zheng 提交于
      Update all qemu_uuid users as well, especially get rid of the duplicated
      low level g_strdup_printf, sscanf and snprintf calls with QEMU UUID API.
      
      Since qemu_uuid_parse is quite tangled with qemu_uuid, its switching to
      QemuUUID is done here too to keep everything in sync and avoid code
      churn.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Message-Id: <1474432046-325-10-git-send-email-famz@redhat.com>
      9c5ce8db
    • F
      util: Add UUID API · cea25275
      Fam Zheng 提交于
      A number of different places across the code base use CONFIG_UUID. Some
      of them are soft dependency, some are not built if libuuid is not
      available, some come with dummy fallback, some throws runtime error.
      
      It is hard to maintain, and hard to reason for users.
      
      Since UUID is a simple standard with only a small number of operations,
      it is cleaner to have a central support in libqemuutil. This patch adds
      qemu_uuid_* functions that all uuid users in the code base can
      rely on. Except for qemu_uuid_generate which is new code, all other
      functions are just copy from existing fallbacks from other files.
      
      Note that qemu_uuid_parse is moved without updating the function
      signature to use QemuUUID, to keep this patch simple.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Message-Id: <1474432046-325-2-git-send-email-famz@redhat.com>
      cea25275
  4. 19 9月, 2016 1 次提交
  5. 06 9月, 2016 3 次提交
  6. 06 7月, 2016 1 次提交
    • E
      qmp-input-visitor: Favor new visit_free() function · b70ce101
      Eric Blake 提交于
      Now that we have a polymorphic visit_free(), we no longer need
      qmp_input_visitor_cleanup(); which in turn means we no longer
      need to return a subtype from qmp_input_visitor_new() nor a
      public upcast function.
      
      Generated code changes to qmp-marshal.c look like:
      
      |@@ -52,11 +52,10 @@ void qmp_marshal_add_fd(QDict *args, QOb
      | {
      |     Error *err = NULL;
      |     AddfdInfo *retval;
      |-    QmpInputVisitor *qiv = qmp_input_visitor_new(QOBJECT(args), true);
      |     Visitor *v;
      |     q_obj_add_fd_arg arg = {0};
      |
      |-    v = qmp_input_get_visitor(qiv);
      |+    v = qmp_input_visitor_new(QOBJECT(args), true);
      |     visit_start_struct(v, NULL, NULL, 0, &err);
      |     if (err) {
      |         goto out;
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1465490926-28625-8-git-send-email-eblake@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      b70ce101
  7. 07 6月, 2016 1 次提交
    • F
      Makefile: Derive "PKGVERSION" from "git describe" by default · 67a1de0d
      Fam Zheng 提交于
      Currently, if not specified in "./configure", QEMU_PKGVERSION will be
      empty. Write a rule in Makefile to generate a value from "git describe"
      combined with a possible git tree cleanness suffix, and write into a new
      header.
      
          $ cat qemu-version.h
          #define QEMU_PKGVERSION "-v2.6.0-557-gd6550e9e-dirty"
      
      Include the header in .c files where the macro is referenced. It's not
      necessary to include it in all files, otherwise each time the content of
      the file changes, all sources have to be recompiled.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Message-Id: <1464774261-648-3-git-send-email-famz@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      67a1de0d
  8. 26 5月, 2016 1 次提交
    • K
      block: Fix bdrv_next() memory leak · 88be7b4b
      Kevin Wolf 提交于
      The bdrv_next() users all leaked the BdrvNextIterator after completing
      the iteration. Simply changing bdrv_next() to free the iterator before
      returning NULL at the end of list doesn't work because some callers exit
      the loop before looking at all BDSes.
      
      This patch moves the BdrvNextIterator from the heap to the stack of
      the caller and switches to a bdrv_first()/bdrv_next() interface for
      initialising the iterator.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      88be7b4b
  9. 19 5月, 2016 1 次提交
  10. 12 5月, 2016 2 次提交
    • E
      qapi: Use strict QMP input visitor in more places · 240f64b6
      Eric Blake 提交于
      The following uses of a QMP input visitor should be strict
      (that is, excess keys in QDict input should be flagged if not
      converted to QAPI):
      
      - Testsuite code unrelated to explicitly testing non-strict
      mode (test-qmp-commands, test-visitor-serialization); since
      we want more code to be strict by default, having more tests
      of strict mode doesn't hurt
      
      - Code used for cloning QAPI objects (replay-input.c,
      qemu-sockets.c); we are reparsing a QObject just barely
      produced by the qmp output visitor and which therefore should
      not have any garbage, so while it is extra work to be strict,
      it validates that our clone is correct [note that a later patch
      series will simplify these two uses by creating an actual
      clone visitor that is much more efficient than a
      generate/reparse cycle]
      
      - qmp_object_add(), which calls into user_creatable_add_type().
      Since command line parsing for '-object' uses the same
      user_creatable_add_type() through the OptsVisitor, and that is
      always strict, we want to ensure that any nested dictionaries
      would be treated the same in QMP and from the command line (I
      don't actually know if such nested dictionaries exist).  Note
      that on this code change, strictness only matters for nested
      dictionaries (if even possible), since we already flag excess
      input at the top level during an earlier object_property_set()
      on an unknown key, whether from QemuOpts:
      
      $ ./x86_64-softmmu/qemu-system-x86_64 -nographic -nodefaults -qmp stdio -object secret,id=sec0,data=letmein,format=raw,foo=bar
      qemu-system-x86_64: -object secret,id=sec0,data=letmein,format=raw,foo=bar: Property '.foo' not found
      
      or from QMP:
      
      $ ./x86_64-softmmu/qemu-system-x86_64 -nographic -nodefaults -qmp stdio
      {"QMP": {"version": {"qemu": {"micro": 93, "minor": 5, "major": 2}, "package": ""}, "capabilities": []}}
      {"execute":"qmp_capabilities"}
      {"return": {}}
      {"execute":"object-add","arguments":{"qom-type":"secret","id":"sec0","props":{"format":"raw","data":"letmein","foo":"bar"}}}
      {"error": {"class": "GenericError", "desc": "Property '.foo' not found"}}
      
      The only remaining uses of non-strict input visits are:
      
      - QMP 'qom-set' (which eventually executes
      object_property_set_qobject()) - mark it as something to revisit
      in the future (I didn't want to spend any more time on this patch
      auditing if we have any QOM dictionary properties that might be
      impacted, and couldn't easily prove whether this code path is
      shared with anything else).
      
      - test-qmp-input-visitor: explicit tests of non-strict mode. If
      we later get rid of users that don't need strictness, then this
      test should be merged with test-qmp-input-strict
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-7-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      240f64b6
    • E
      qapi: Consolidate QMP input visitor creation · fc471c18
      Eric Blake 提交于
      Rather than having two separate ways to create a QMP input
      visitor, where the safer approach has the more verbose name,
      it is better to consolidate things into a single function
      where the caller must explicitly choose whether to be strict
      or to ignore excess input.  This patch is the strictly
      mechanical conversion; the next patch will then audit which
      uses can be made stricter.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <1461879932-9020-6-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      fc471c18
  11. 23 3月, 2016 1 次提交
  12. 23 2月, 2016 1 次提交
  13. 17 2月, 2016 1 次提交
    • D
      qom: add helpers for UserCreatable object types · 90998d58
      Daniel P. Berrange 提交于
      The QMP monitor code has two helper methods object_add
      and qmp_object_del that are called from several places
      in the code (QMP, HMP and main emulator startup).
      
      The HMP and main emulator startup code also share
      further logic that extracts the qom-type & id
      values from a qdict.
      
      We soon need to use this logic from qemu-img, qemu-io
      and qemu-nbd too, but don't want those to depend on
      the monitor, nor do we want to duplicate the code.
      
      To avoid this, move some code out of qmp.c and hmp.c
      adding new methods to qom/object_interfaces.c
      
       - user_creatable_add - takes a QDict holding a full
         object definition & instantiates it
       - user_creatable_add_type - takes an ID, type name,
         and QDict holding object properties & instantiates
         it
       - user_creatable_add_opts - takes a QemuOpts holding
         a full object definition & instantiates it
       - user_creatable_add_opts_foreach - variant on
         user_creatable_add_opts which can be directly used
         in conjunction with qemu_opts_foreach.
       - user_creatable_del - takes an ID and deletes the
         corresponding object
      
      The existing code is updated to use these new methods.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1455129674-17255-2-git-send-email-berrange@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      90998d58
  14. 05 2月, 2016 1 次提交
    • P
      all: Clean up includes · d38ea87a
      Peter Maydell 提交于
      Clean up includes so that osdep.h is included first and headers
      which it implies are not included manually.
      
      This commit was created with scripts/clean-includes.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1454089805-5470-16-git-send-email-peter.maydell@linaro.org
      d38ea87a
  15. 20 1月, 2016 1 次提交
    • K
      block: Inactivate BDS when migration completes · 76b1c7fe
      Kevin Wolf 提交于
      So far, live migration with shared storage meant that the image is in a
      not-really-ready don't-touch-me state on the destination while the
      source is still actively using it, but after completing the migration,
      the image was fully opened on both sides. This is bad.
      
      This patch adds a block driver callback to inactivate images on the
      source before completing the migration. Inactivation means that it goes
      to a state as if it was just live migrated to the qemu instance on the
      source (i.e. BDRV_O_INACTIVE is set). You're then supposed to continue
      either on the source or on the destination, which takes ownership of the
      image.
      
      A typical migration looks like this now with respect to disk images:
      
      1. Destination qemu is started, the image is opened with
         BDRV_O_INACTIVE. The image is fully opened on the source.
      
      2. Migration is about to complete. The source flushes the image and
         inactivates it. Now both sides have the image opened with
         BDRV_O_INACTIVE and are expecting the other side to still modify it.
      
      3. One side (the destination on success) continues and calls
         bdrv_invalidate_all() in order to take ownership of the image again.
         This removes BDRV_O_INACTIVE on the resuming side; the flag remains
         set on the other side.
      
      This ensures that the same image isn't written to by both instances
      (unless both are resumed, but then you get what you deserve). This is
      important because .bdrv_close for non-BDRV_O_INACTIVE images could write
      to the image file, which is definitely forbidden while another host is
      using the image.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Snow <jsnow@redhat.com>
      76b1c7fe
  16. 19 1月, 2016 1 次提交
    • D
      qom: Change object property iterator API contract · 7746abd8
      Daniel P. Berrange 提交于
      Currently the ObjectProperty iterator API works as follows:
      
        ObjectPropertyIterator *iter;
      
        iter = object_property_iter_init(obj);
        while ((prop = object_property_iter_next(iter))) {
           ...
        }
        object_property_iter_free(iter);
      
      This has the benefit that the ObjectPropertyIterator struct
      can be opaque, but has the downside that callers need to
      explicitly call a free function. It is also not in keeping
      with iterator style used elsewhere in QEMU/GLib2.
      
      This patch changes the API to use stack allocation instead:
      
        ObjectPropertyIterator iter;
      
        object_property_iter_init(&iter, obj);
        while ((prop = object_property_iter_next(&iter))) {
           ...
        }
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      [AF: Fused ObjectPropertyIterator struct with typedef]
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      7746abd8
  17. 19 11月, 2015 1 次提交
  18. 11 11月, 2015 2 次提交
  19. 24 10月, 2015 1 次提交
  20. 09 10月, 2015 2 次提交
    • M
      qdev: Protect device-list-properties against broken devices · 4c315c27
      Markus Armbruster 提交于
      Several devices don't survive object_unref(object_new(T)): they crash
      or hang during cleanup, or they leave dangling pointers behind.
      
      This breaks at least device-list-properties, because
      qmp_device_list_properties() needs to create a device to find its
      properties.  Broken in commit f4eb32b5 "qmp: show QOM properties in
      device-list-properties", v2.1.  Example reproducer:
      
          $ qemu-system-aarch64 -nodefaults -display none -machine none -S -qmp stdio
          {"QMP": {"version": {"qemu": {"micro": 50, "minor": 4, "major": 2}, "package": ""}, "capabilities": []}}
          { "execute": "qmp_capabilities" }
          {"return": {}}
          { "execute": "device-list-properties", "arguments": { "typename": "pxa2xx-pcmcia" } }
          qemu-system-aarch64: /home/armbru/work/qemu/memory.c:1307: memory_region_finalize: Assertion `((&mr->subregions)->tqh_first == ((void *)0))' failed.
          Aborted (core dumped)
          [Exit 134 (SIGABRT)]
      
      Unfortunately, I can't fix the problems in these devices right now.
      Instead, add DeviceClass member cannot_destroy_with_object_finalize_yet
      to mark them:
      
      * Hang during cleanup (didn't debug, so I can't say why):
        "realview_pci", "versatile_pci".
      
      * Dangling pointer in cpus: most CPUs, plus "allwinner-a10", "digic",
        "fsl,imx25", "fsl,imx31", "xlnx,zynqmp", because they create such
        CPUs
      
      * Assert kvm_enabled(): "host-x86_64-cpu", host-i386-cpu",
        "host-powerpc64-cpu", "host-embedded-powerpc-cpu",
        "host-powerpc-cpu" (the powerpc ones can't currently reach the
        assertion, because the CPUs are only registered when KVM is enabled,
        but the assertion is arguably in the wrong place all the same)
      
      Make qmp_device_list_properties() fail cleanly when the device is so
      marked.  This improves device-list-properties from "crashes, hangs or
      leaves dangling pointers behind" to "fails".  Not a complete fix, just
      a better-than-nothing work-around.  In the above reproducer,
      device-list-properties now fails with "Can't list properties of device
      'pxa2xx-pcmcia'".
      
      This also protects -device FOO,help, which uses the same machinery
      since commit ef523587 "qdev-monitor: include QOM properties in -device
      FOO, help output", v2.2.  Example reproducer:
      
          $ qemu-system-aarch64 -machine none -device pxa2xx-pcmcia,help
      
      Before:
      
          qemu-system-aarch64: .../memory.c:1307: memory_region_finalize: Assertion `((&mr->subregions)->tqh_first == ((void *)0))' failed.
      
      After:
      
          Can't list properties of device 'pxa2xx-pcmcia'
      
      Cc: "Andreas Färber" <afaerber@suse.de>
      Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
      Cc: Alexander Graf <agraf@suse.de>
      Cc: Anthony Green <green@moxielogic.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
      Cc: Blue Swirl <blauwirbel@gmail.com>
      Cc: Eduardo Habkost <ehabkost@redhat.com>
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Cc: Jia Liu <proljc@gmail.com>
      Cc: Leon Alrae <leon.alrae@imgtec.com>
      Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Walle <michael@walle.cc>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: qemu-ppc@nongnu.org
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <1443689999-12182-10-git-send-email-armbru@redhat.com>
      4c315c27
    • M
      qmp: Fix device-list-properties not to crash for abstract device · edb1523d
      Markus Armbruster 提交于
      Broken in commit f4eb32b5 "qmp: show QOM properties in
      device-list-properties", v2.1.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NAndreas Färber <afaerber@suse.de>
      Message-Id: <1443689999-12182-9-git-send-email-armbru@redhat.com>
      edb1523d
  21. 21 9月, 2015 2 次提交
  22. 09 9月, 2015 1 次提交
  23. 23 6月, 2015 6 次提交
  24. 20 6月, 2015 1 次提交
  25. 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
  26. 01 4月, 2015 1 次提交
  27. 10 3月, 2015 1 次提交