1. 12 5月, 2016 3 次提交
  2. 28 4月, 2016 1 次提交
    • M
      qom: -object error messages lost location, restore it · 51b9b478
      Markus Armbruster 提交于
      qemu_opts_foreach() runs its callback with the error location set to
      the option's location.  Any errors the callback reports use the
      option's location automatically.
      
      Commit 90998d58 moved the actual error reporting from "inside"
      qemu_opts_foreach() to after it.  Here's a typical hunk:
      
      	 if (qemu_opts_foreach(qemu_find_opts("object"),
          -                          object_create,
          -                          object_create_initial, NULL)) {
          +                          user_creatable_add_opts_foreach,
          +                          object_create_initial, &err)) {
          +        error_report_err(err);
      	     exit(1);
      	 }
      
      Before, object_create() reports from within qemu_opts_foreach(), using
      the option's location.  Afterwards, we do it after
      qemu_opts_foreach(), using whatever location happens to be current
      there.  Commonly a "none" location.
      
      This is because Error objects don't have location information.
      Problematic.
      
      Reproducer:
      
          $ qemu-system-x86_64 -nodefaults -display none -object secret,id=foo,foo=bar
          qemu-system-x86_64: Property '.foo' not found
      
      Note no location.  This commit restores it:
      
          qemu-system-x86_64: -object secret,id=foo,foo=bar: Property '.foo' not found
      
      Note that the qemu_opts_foreach() bug just fixed could mask the bug
      here: if the location it leaves dangling hasn't been clobbered, yet,
      it's the correct one.
      Reported-by: NEric Blake <eblake@redhat.com>
      Cc: Daniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1461767349-15329-4-git-send-email-armbru@redhat.com>
      Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      [Paragraph on Error added to commit message]
      51b9b478
  3. 13 4月, 2016 2 次提交
  4. 30 3月, 2016 6 次提交
    • M
      qemu-img: Fix preallocation with -S 0 for convert · aad15de4
      Max Reitz 提交于
      When passing -S 0 to qemu-img convert, the target image is supposed to
      be fully allocated. Right now, this is not the case if the source image
      contains areas which bdrv_get_block_status() reports as being zero.
      
      This patch changes a zeroed area's status from BLK_ZERO to BLK_DATA
      before invoking convert_write() if -S 0 has been specified. In addition,
      the check whether convert_read() actually needs to do anything
      (basically only if the current area is a BLK_DATA area) is pulled out of
      that function to the caller.
      
      If -S 0 has been specified, zeroed areas need to be written as data to
      the output, thus they then have to be accounted when calculating the
      progress made.
      
      This patch changes the reference output for iotest 122; contrary to what
      it assumed, -S 0 really should allocate everything in the output, not
      just areas that are filled with zeros (as opposed to being zeroed).
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      aad15de4
    • K
      block: Remove BDRV_O_CACHE_WB · 61de4c68
      Kevin Wolf 提交于
      The previous patches have successively made blk->enable_write_cache the
      true source for the information whether a writethrough mode must be
      implemented. The corresponding BDRV_O_CACHE_WB is only useless baggage
      we're carrying around, so now's the time to remove it.
      
      At the same time, we remove the 'cache.writeback' option parsing on the
      BDS level as the only effect was setting the BDRV_O_CACHE_WB flag.
      
      This change requires test cases that explicitly enabled the option to
      drop it. Other than that and the change of the error message when
      writethrough is enabled on the BDS level (from "Can't set writethrough
      mode" to "doesn't support the option"), there should be no change in
      behaviour.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      61de4c68
    • K
      qemu-img: Call blk_set_enable_write_cache() explicitly · ce099547
      Kevin Wolf 提交于
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      ce099547
    • K
      qemu-img: Expand all BDRV_O_FLAGS uses · e6996143
      Kevin Wolf 提交于
      It always only set the BDRV_O_CACHE_WB flag, which is going to go away.
      In order to make the next changes more local for better reviewability
      this patches expands the macro.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      e6996143
    • D
      qemu-img/qemu-io: don't prompt for passwords if not required · 4ef130fc
      Daniel P. Berrange 提交于
      The qemu-img/qemu-io tools prompt for disk encryption passwords
      regardless of whether any are actually required. Adding a check
      on bdrv_key_required() avoids this prompt for disk formats which
      have been converted to the QCryptoSecret APIs.
      
      This is just a temporary hack to ensure the block I/O tests
      continue to work after each patch, since the last patch will
      completely delete all the password prompting code.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      4ef130fc
    • D
      block: add flag to indicate that no I/O will be performed · abb06c5a
      Daniel P. Berrange 提交于
      When opening an image it is useful to know whether the caller
      intends to perform I/O on the image or not. In the case of
      encrypted images this will allow the block driver to avoid
      having to prompt for decryption keys when we merely want to
      query header metadata about the image. eg qemu-img info
      
      This flag is enforced at the top level only, since even if
      we don't want todo I/O on the 'qcow2' file payload, the
      underlying 'file' driver will still need todo I/O to read
      the qcow2 header, for example.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      abb06c5a
  5. 23 3月, 2016 2 次提交
    • V
      util: move declarations out of qemu-common.h · f348b6d1
      Veronia Bahaa 提交于
      Move declarations out of qemu-common.h for functions declared in
      utils/ files: e.g. include/qemu/path.h for utils/path.c.
      Move inline functions out of qemu-common.h and into new files (e.g.
      include/qemu/bcd.h)
      Signed-off-by: NVeronia Bahaa <veroniabahaa@gmail.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f348b6d1
    • M
      include/qemu/osdep.h: Don't include qapi/error.h · da34e65c
      Markus Armbruster 提交于
      Commit 57cb38b3 included qapi/error.h into qemu/osdep.h to get the
      Error typedef.  Since then, we've moved to include qemu/osdep.h
      everywhere.  Its file comment explains: "To avoid getting into
      possible circular include dependencies, this file should not include
      any other QEMU headers, with the exceptions of config-host.h,
      compiler.h, os-posix.h and os-win32.h, all of which are doing a
      similar job to this file and are under similar constraints."
      qapi/error.h doesn't do a similar job, and it doesn't adhere to
      similar constraints: it includes qapi-types.h.  That's in excess of
      100KiB of crap most .c files don't actually need.
      
      Add the typedef to qemu/typedefs.h, and include that instead of
      qapi/error.h.  Include qapi/error.h in .c files that need it and don't
      get it now.  Include qapi-types.h in qom/object.h for uint16List.
      
      Update scripts/clean-includes accordingly.  Update it further to match
      reality: replace config.h by config-target.h, add sysemu/os-posix.h,
      sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
      comment quoted above similarly.
      
      This reduces the number of objects depending on qapi/error.h from "all
      of them" to less than a third.  Unfortunately, the number depending on
      qapi-types.h shrinks only a little.  More work is needed for that one.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      [Fix compilation without the spice devel packages. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      da34e65c
  6. 17 3月, 2016 1 次提交
    • M
      blockdev: Split monitor reference from BB creation · efaa7c4e
      Max Reitz 提交于
      Before this patch, blk_new() automatically assigned a name to the new
      BlockBackend and considered it referenced by the monitor. This patch
      removes the implicit monitor_add_blk() call from blk_new() (and
      consequently the monitor_remove_blk() call from blk_delete(), too) and
      thus blk_new() (and related functions) no longer take a BB name
      argument.
      
      In fact, there is only a single point where blk_new()/blk_new_open() is
      called and the new BB is monitor-owned, and that is in blockdev_init().
      Besides thus relieving us from having to invent names for all of the BBs
      we use in qemu-img, this fixes a bug where qemu cannot create a new
      image if there already is a monitor-owned BB named "image".
      
      If a BB and its BDS tree are created in a single operation, as of this
      patch the BDS tree will be created before the BB is given a name
      (whereas it was the other way around before). This results in minor
      change to the output of iotest 087, whose reference output is amended
      accordingly.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      efaa7c4e
  7. 14 3月, 2016 1 次提交
  8. 22 2月, 2016 3 次提交
  9. 17 2月, 2016 1 次提交
    • D
      nbd: convert block client to use I/O channels for connection setup · 064097d9
      Daniel P. Berrange 提交于
      This converts the NBD block driver client to use the QIOChannelSocket
      class for initial connection setup. The NbdClientSession struct has
      two pointers, one to the master QIOChannelSocket providing the raw
      data channel, and one to a QIOChannel which is the current channel
      used for I/O. Initially the two point to the same object, but when
      TLS support is added, they will point to different objects.
      
      The qemu-img & qemu-io tools now need to use MODULE_INIT_QOM to
      ensure the QIOChannel object classes are registered. The qemu-nbd
      tool already did this.
      
      In this initial conversion though, all I/O is still actually done
      using the raw POSIX sockets APIs.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1455129674-17255-4-git-send-email-berrange@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      064097d9
  10. 09 2月, 2016 1 次提交
    • E
      qapi: Swap visit_* arguments for consistent 'name' placement · 51e72bc1
      Eric Blake 提交于
      JSON uses "name":value, but many of our visitor interfaces were
      called with visit_type_FOO(v, &value, name, errp).  This can be
      a bit confusing to have to mentally swap the parameter order to
      match JSON order.  It's particularly bad for visit_start_struct(),
      where the 'name' parameter is smack in the middle of the
      otherwise-related group of 'obj, kind, size' parameters! It's
      time to do a global swap of the parameter ordering, so that the
      'name' parameter is always immediately after the Visitor argument.
      
      Additional reason in favor of the swap: the existing include/qjson.h
      prefers listing 'name' first in json_prop_*(), and I have plans to
      unify that file with the qapi visitors; listing 'name' first in
      qapi will minimize churn to the (admittedly few) qjson.h clients.
      
      Later patches will then fix docs, object.h, visitor-impl.h, and
      those clients to match.
      
      Done by first patching scripts/qapi*.py by hand to make generated
      files do what I want, then by running the following Coccinelle
      script to affect the rest of the code base:
       $ spatch --sp-file script `git grep -l '\bvisit_' -- '**/*.[ch]'`
      I then had to apply some touchups (Coccinelle insisted on TAB
      indentation in visitor.h, and botched the signature of
      visit_type_enum() by rewriting 'const char *const strings[]' to
      the syntactically invalid 'const char*const[] strings').  The
      movement of parameters is sufficient to provoke compiler errors
      if any callers were missed.
      
          // Part 1: Swap declaration order
          @@
          type TV, TErr, TObj, T1, T2;
          identifier OBJ, ARG1, ARG2;
          @@
           void visit_start_struct
          -(TV v, TObj OBJ, T1 ARG1, const char *name, T2 ARG2, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
           { ... }
      
          @@
          type bool, TV, T1;
          identifier ARG1;
          @@
           bool visit_optional
          -(TV v, T1 ARG1, const char *name)
          +(TV v, const char *name, T1 ARG1)
           { ... }
      
          @@
          type TV, TErr, TObj, T1;
          identifier OBJ, ARG1;
          @@
           void visit_get_next_type
          -(TV v, TObj OBJ, T1 ARG1, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, TErr errp)
           { ... }
      
          @@
          type TV, TErr, TObj, T1, T2;
          identifier OBJ, ARG1, ARG2;
          @@
           void visit_type_enum
          -(TV v, TObj OBJ, T1 ARG1, T2 ARG2, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, T1 ARG1, T2 ARG2, TErr errp)
           { ... }
      
          @@
          type TV, TErr, TObj;
          identifier OBJ;
          identifier VISIT_TYPE =~ "^visit_type_";
          @@
           void VISIT_TYPE
          -(TV v, TObj OBJ, const char *name, TErr errp)
          +(TV v, const char *name, TObj OBJ, TErr errp)
           { ... }
      
          // Part 2: swap caller order
          @@
          expression V, NAME, OBJ, ARG1, ARG2, ERR;
          identifier VISIT_TYPE =~ "^visit_type_";
          @@
          (
          -visit_start_struct(V, OBJ, ARG1, NAME, ARG2, ERR)
          +visit_start_struct(V, NAME, OBJ, ARG1, ARG2, ERR)
          |
          -visit_optional(V, ARG1, NAME)
          +visit_optional(V, NAME, ARG1)
          |
          -visit_get_next_type(V, OBJ, ARG1, NAME, ERR)
          +visit_get_next_type(V, NAME, OBJ, ARG1, ERR)
          |
          -visit_type_enum(V, OBJ, ARG1, ARG2, NAME, ERR)
          +visit_type_enum(V, NAME, OBJ, ARG1, ARG2, ERR)
          |
          -VISIT_TYPE(V, OBJ, NAME, ERR)
          +VISIT_TYPE(V, NAME, OBJ, ERR)
          )
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <1454075341-13658-19-git-send-email-eblake@redhat.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      51e72bc1
  11. 03 2月, 2016 3 次提交
  12. 20 1月, 2016 2 次提交
  13. 13 1月, 2016 2 次提交
  14. 18 12月, 2015 2 次提交
  15. 12 11月, 2015 1 次提交
  16. 11 11月, 2015 1 次提交
  17. 16 10月, 2015 2 次提交
  18. 25 9月, 2015 1 次提交
  19. 05 9月, 2015 1 次提交
  20. 23 6月, 2015 3 次提交
  21. 22 5月, 2015 1 次提交