Skip to content
Snippets Groups Projects
  1. Jun 14, 2021
  2. Jun 02, 2021
  3. Mar 18, 2021
  4. Feb 02, 2021
    • Kevin Wolf's avatar
      block: Fix VM size column width in bdrv_snapshot_dump() · 26513a01
      Kevin Wolf authored
      
      size_to_str() can return a size like "4.24 MiB", with a single digit
      integer part and two fractional digits. This is eight characters, but
      commit b39847a5 changed the format string to only reserve seven
      characters for the column.
      
      This can result in unaligned columns, which in turn changes the output of
      iotests case 267 because exceeding the column size defeats the attempt
      to filter the size out of the output (observed with the ppc64 emulator).
      The resulting change is only a whitespace change, but since commit
      f203080b this is enough for iotests to consider the test failed.
      
      Taking a character away from the tag name column and adding it to the VM
      size column doesn't change anything in the common case (the tag name is
      left justified, the VM size is right justified), but fixes this case.
      
      Fixes: b39847a5
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Message-Id: <20210202155911.179865-1-kwolf@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      26513a01
  5. Jan 28, 2021
  6. Dec 19, 2020
    • Eric Blake's avatar
      qapi: Use QAPI_LIST_PREPEND() where possible · 54aa3de7
      Eric Blake authored
      
      Anywhere we create a list of just one item or by prepending items
      (typically because order doesn't matter), we can use
      QAPI_LIST_PREPEND().  But places where we must keep the list in order
      by appending remain open-coded until later patches.
      
      Note that as a side effect, this also performs a cleanup of two minor
      issues in qga/commands-posix.c: the old code was performing
       new = g_malloc0(sizeof(*ret));
      which 1) is confusing because you have to verify whether 'new' and
      'ret' are variables with the same type, and 2) would conflict with C++
      compilation (not an actual problem for this file, but makes
      copy-and-paste harder).
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <20201113011340.463563-5-eblake@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Acked-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      [Straightforward conflicts due to commit a8aa94b5 "qga: update
      schema for guest-get-disks 'dependents' field" and commit a10b453a
      "target/mips: Move mips_cpu_add_definition() from helper.c to cpu.c"
      resolved.  Commit message tweaked.]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      54aa3de7
  7. Oct 06, 2020
    • Pavel Dovgalyuk's avatar
      migration: introduce icount field for snapshots · b39847a5
      Pavel Dovgalyuk authored
      
      Saving icount as a parameters of the snapshot allows navigation between
      them in the execution replay scenario.
      This information can be used for finding a specific snapshot for proceeding
      the recorded execution to the specific moment of the time.
      E.g., 'reverse step' action (introduced in one of the following patches)
      needs to load the nearest snapshot which is prior to the current moment
      of time.
      This patch also updates snapshot test which verifies qemu monitor output.
      
      Signed-off-by: default avatarPavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
      Acked-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Acked-by: default avatarKevin Wolf <kwolf@redhat.com>
      
      --
      
      v4 changes:
       - squashed format update with test output update
      v7 changes:
       - introduced the spaces between the fields in snapshot info output
       - updated the test to match new field widths
      Message-Id: <160174518865.12451.14327573383978752463.stgit@pasha-ThinkPad-X280>
      
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b39847a5
  8. Sep 07, 2020
    • Hanna Reitz's avatar
      block: Leave BDS.backing_{file,format} constant · 0b877d09
      Hanna Reitz authored
      
      Parts of the block layer treat BDS.backing_file as if it were whatever
      the image header says (i.e., if it is a relative path, it is relative to
      the overlay), other parts treat it like a cache for
      bs->backing->bs->filename (relative paths are relative to the CWD).
      Considering bs->backing->bs->filename exists, let us make it mean the
      former.
      
      Among other things, this now allows the user to specify a base when
      using qemu-img to commit an image file in a directory that is not the
      CWD (assuming, everything uses relative filenames).
      
      Before this patch:
      
      $ ./qemu-img create -f qcow2 foo/bot.qcow2 1M
      $ ./qemu-img create -f qcow2 -b bot.qcow2 foo/mid.qcow2
      $ ./qemu-img create -f qcow2 -b mid.qcow2 foo/top.qcow2
      $ ./qemu-img commit -b mid.qcow2 foo/top.qcow2
      qemu-img: Did not find 'mid.qcow2' in the backing chain of 'foo/top.qcow2'
      $ ./qemu-img commit -b foo/mid.qcow2 foo/top.qcow2
      qemu-img: Did not find 'foo/mid.qcow2' in the backing chain of 'foo/top.qcow2'
      $ ./qemu-img commit -b $PWD/foo/mid.qcow2 foo/top.qcow2
      qemu-img: Did not find '[...]/foo/mid.qcow2' in the backing chain of 'foo/top.qcow2'
      
      After this patch:
      
      $ ./qemu-img commit -b mid.qcow2 foo/top.qcow2
      Image committed.
      $ ./qemu-img commit -b foo/mid.qcow2 foo/top.qcow2
      qemu-img: Did not find 'foo/mid.qcow2' in the backing chain of 'foo/top.qcow2'
      $ ./qemu-img commit -b $PWD/foo/mid.qcow2 foo/top.qcow2
      Image committed.
      
      With this change, bdrv_find_backing_image() must look at whether the
      user has overridden a BDS's backing file.  If so, it can no longer use
      bs->backing_file, but must instead compare the given filename against
      the backing node's filename directly.
      
      Note that this changes the QAPI output for a node's backing_file.  We
      had very inconsistent output there (sometimes what the image header
      said, sometimes the actual filename of the backing image).  This
      inconsistent output was effectively useless, so we have to decide one
      way or the other.  Considering that bs->backing_file usually at runtime
      contained the path to the image relative to qemu's CWD (or absolute),
      this patch changes QAPI's backing_file to always report the
      bs->backing->bs->filename from now on.  If you want to receive the image
      header information, you have to refer to full-backing-filename.
      
      This necessitates a change to iotest 228.  The interesting information
      it really wanted is the image header, and it can get that now, but it
      has to use full-backing-filename instead of backing_file.  Because of
      this patch's changes to bs->backing_file's behavior, we also need some
      reference output changes.
      
      Along with the changes to bs->backing_file, stop updating
      BDS.backing_format in bdrv_backing_attach() as well.  This way,
      ImageInfo's backing-filename and backing-filename-format fields will
      represent what the image header says and nothing else.
      
      iotest 245 changes in behavior: With the backing node no longer
      overriding the parent node's backing_file string, you can now omit the
      @backing option when reopening a node with neither a default nor a
      current backing file even if it used to have a backing node at some
      point.
      
      273 also changes: The base image is opened without a format layer, so
      ImageInfo.backing-filename-format used to report "file" for the base
      image's overlay after blockdev-snapshot.  However, the image header
      never says "file" anywhere, so it now reports $IMGFMT.
      
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      0b877d09
    • Hanna Reitz's avatar
      block: Use child access functions for QAPI queries · 0a7585db
      Hanna Reitz authored
      
      query-block, query-named-block-nodes, and query-blockstats now return
      any filtered child under "backing", not just bs->backing or COW
      children.  This is so that filters do not interrupt the reported backing
      chain.  This changes the output for iotest 184, as the throttled node
      now appears as a backing child.
      
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>
      Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
      0a7585db
    • Hanna Reitz's avatar
      block: Report data child for query-blockstats · 3f26191c
      Hanna Reitz authored
      
      It makes no sense to report the block stats of a purely metadata-storing
      child in query-blockstats.  So if the primary child does not have any
      data, try to find a unique data-storing child.
      
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>
      Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
      3f26191c
    • Hanna Reitz's avatar
      block: Drop bdrv_is_encrypted() · 8b8277cd
      Hanna Reitz authored
      
      The original purpose of bdrv_is_encrypted() was to inquire whether a BDS
      can be used without the user entering a password or not.  It has not
      been used for that purpose for quite some time.
      
      Actually, it is not even fit for that purpose, because to answer that
      question, it would have recursively query all of the given node's
      children.
      
      So now we have to decide in which direction we want to fix
      bdrv_is_encrypted(): Recursively query all children, or drop it and just
      use bs->encrypted to get the current node's status?
      
      Nowadays, its only purpose is to report through bdrv_query_image_info()
      whether the given image is encrypted or not.  For this purpose, it is
      probably more interesting to see whether a given node itself is
      encrypted or not (otherwise, a management application cannot discern for
      certain which nodes are really encrypted and which just have encrypted
      children).
      
      Suggested-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>
      Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
      8b8277cd
  9. Feb 20, 2020
  10. Oct 10, 2019
  11. Sep 19, 2019
  12. Aug 16, 2019
  13. Jun 12, 2019
    • Markus Armbruster's avatar
      Include qemu-common.h exactly where needed · a8d25326
      Markus Armbruster authored
      
      No header includes qemu-common.h after this commit, as prescribed by
      qemu-common.h's file comment.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190523143508.25387-5-armbru@redhat.com>
      [Rebased with conflicts resolved automatically, except for
      include/hw/arm/xlnx-zynqmp.h hw/arm/nrf51_soc.c hw/arm/msf2-soc.c
      block/qcow2-refcount.c block/qcow2-cluster.c block/qcow2-cache.c
      target/arm/cpu.h target/lm32/cpu.h target/m68k/cpu.h target/mips/cpu.h
      target/moxie/cpu.h target/nios2/cpu.h target/openrisc/cpu.h
      target/riscv/cpu.h target/tilegx/cpu.h target/tricore/cpu.h
      target/unicore32/cpu.h target/xtensa/cpu.h; bsd-user/main.c and
      net/tap-bsd.c fixed up]
      a8d25326
  14. Apr 30, 2019
  15. Apr 18, 2019
  16. Mar 12, 2019
  17. Feb 25, 2019
    • Hanna Reitz's avatar
      block: bdrv_get_full_backing_filename's ret. val. · 6b6833c1
      Hanna Reitz authored
      
      Make bdrv_get_full_backing_filename() return an allocated string instead
      of placing the result in a caller-provided buffer.
      
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarAlberto Garcia <berto@igalia.com>
      Message-id: 20190201192935.18394-12-mreitz@redhat.com
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      6b6833c1
    • Hanna Reitz's avatar
      block: Use bdrv_refresh_filename() to pull · f30c66ba
      Hanna Reitz authored
      
      Before this patch, bdrv_refresh_filename() is used in a pushing manner:
      Whenever the BDS graph is modified, the parents of the modified edges
      are supposed to be updated (recursively upwards).  However, that is
      nonviable, considering that we want child changes not to concern
      parents.
      
      Also, in the long run we want a pull model anyway: Here, we would have a
      bdrv_filename() function which returns a BDS's filename, freshly
      constructed.
      
      This patch is an intermediate step.  It adds bdrv_refresh_filename()
      calls before every place a BDS.filename value is used.  The only
      exceptions are protocol drivers that use their own filename, which
      clearly would not profit from refreshing that filename before.
      
      Also, bdrv_get_encrypted_filename() is removed along the way (as a user
      of BDS.filename), since it is completely unused.
      
      In turn, all of the calls to bdrv_refresh_filename() before this patch
      are removed, because we no longer have to call this function on graph
      changes.
      
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Message-id: 20190201192935.18394-2-mreitz@redhat.com
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      f30c66ba
  18. Feb 11, 2019
  19. Aug 15, 2018
  20. Jul 30, 2018
  21. May 04, 2018
  22. Mar 19, 2018
  23. Mar 02, 2018
  24. Feb 09, 2018
  25. Nov 17, 2017
    • Hanna Reitz's avatar
      block: Guard against NULL bs->drv · d470ad42
      Hanna Reitz authored
      
      We currently do not guard everywhere against a NULL bs->drv where we
      should be doing so.  Most of the places fixed here just do not care
      about that case at all.
      
      Some care implicitly, e.g. through a prior function call to
      bdrv_getlength() which would always fail for an ejected BDS.  Add an
      assert there to make it more obvious.
      
      Other places seem to care, but do so insufficiently: Freeing clusters in
      a qcow2 image is an error-free operation, but it may leave the image in
      an unusable state anyway.  Giving qcow2_free_clusters() an error code is
      not really viable, it is much easier to note that bs->drv may be NULL
      even after a successful driver call.  This concerns bdrv_co_flush(), and
      the way the check is added to bdrv_co_pdiscard() (in every iteration
      instead of only once).
      
      Finally, some places employ at least an assert(bs->drv); somewhere, that
      may be reasonable (such as in the reopen code), but in
      bdrv_has_zero_init(), it is definitely not.  Returning 0 there in case
      of an ejected BDS saves us much headache instead.
      
      Reported-by: default avatarR. Nageswara Sastry <nasastry@in.ibm.com>
      Buglink: https://bugs.launchpad.net/qemu/+bug/1728660
      
      
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      Message-id: 20171110203111.7666-4-mreitz@redhat.com
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
      d470ad42
  26. Sep 05, 2017
Loading