1. 21 5月, 2019 29 次提交
  2. 20 5月, 2019 11 次提交
    • M
      iotests: Make 245 faster and more reliable · c423a6af
      Max Reitz 提交于
      Sometimes, 245 fails for me because some stream job has already finished
      while the test expects it to still be active.  (With -c none, it fails
      basically every time.) The most reliable way to fix this is to simply
      set auto_finalize=false so the job will remain in the block graph as
      long as we need it.  This allows us to drop the rate limiting, too,
      which makes the test faster.
      
      The only problem with this is that there is a single place that yields a
      different error message depending on whether the stream job is still
      copying data (so COR is enabled) or not (COR has been disabled, but the
      job still has the WRITE_UNCHANGED permission on the target node).  We
      can easily address that by expecting either error message.
      
      Note that we do not need auto_finalize=false (or rate limiting) for the
      active commit job, because It never completes without an explicit
      block-job-complete anyway.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c423a6af
    • M
      iotests.py: Fix VM.run_job · 86a4f599
      Max Reitz 提交于
      log() is in the current module, there is no need to prefix it.  In fact,
      doing so may make VM.run_job() unusable in tests that never use
      iotests.log() themselves.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      86a4f599
    • M
      iotests.py: Let assert_qmp() accept an array · a93a42bd
      Max Reitz 提交于
      Sometimes we cannot tell which error message qemu will emit, and we do
      not care.  With this change, we can then just pass an array of all
      possible messages to assert_qmp() and it will choose the right one.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a93a42bd
    • M
      block: Improve "Block node is read-only" message · 481e0eee
      Max Reitz 提交于
      This message does not make any sense when it appears as the response to
      making an R/W node read-only.  We should detect that case and emit a
      different message, then.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NAlberto Garcia <berto@igalia.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      481e0eee
    • M
      qemu-img.texi: Describe human-readable info output · 4db4390e
      Max Reitz 提交于
      Ideally, it should be self-explanatory.  However, keys like "disk size"
      arguably really are not self-explanatory.  In any case, there is no harm
      in going into a some more detail here.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      4db4390e
    • M
      qemu-img.texi: Be specific about JSON object types · 987402c5
      Max Reitz 提交于
      Just writing that --output=json outputs JSON information does not really
      help; we should also make a note of what QAPI type the result object
      has.  (The map subcommand does not emit a QAPI-typed object, but its
      section already describes the object structure well enough.)
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      987402c5
    • M
      iotests: Test unaligned raw images with O_DIRECT · 2fab30c8
      Max Reitz 提交于
      We already have 221 for accesses through the page cache, but it is
      better to create a new file for O_DIRECT instead of integrating those
      test cases into 221.  This way, we can make use of
      _supported_cache_modes (and _default_cache_mode) so the test is
      automatically skipped on filesystems that do not support O_DIRECT.
      
      As part of the split, add _supported_cache_modes to 221.  With that, it
      no longer fails when run with -c none or -c directsync.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      2fab30c8
    • M
      block/file-posix: Unaligned O_DIRECT block-status · 9c3db310
      Max Reitz 提交于
      Currently, qemu crashes whenever someone queries the block status of an
      unaligned image tail of an O_DIRECT image:
      $ echo > foo
      $ qemu-img map --image-opts driver=file,filename=foo,cache.direct=on
      Offset          Length          Mapped to       File
      qemu-img: block/io.c:2093: bdrv_co_block_status: Assertion `*pnum &&
      QEMU_IS_ALIGNED(*pnum, align) && align > offset - aligned_offset'
      failed.
      
      This is because bdrv_co_block_status() checks that the result returned
      by the driver's implementation is aligned to the request_alignment, but
      file-posix can fail to do so, which is actually mentioned in a comment
      there: "[...] possibly including a partial sector at EOF".
      
      Fix this by rounding up those partial sectors.
      
      There are two possible alternative fixes:
      (1) We could refuse to open unaligned image files with O_DIRECT
          altogether.  That sounds reasonable until you realize that qcow2
          does necessarily not fill up its metadata clusters, and that nobody
          runs qemu-img create with O_DIRECT.  Therefore, unpreallocated qcow2
          files usually have an unaligned image tail.
      
      (2) bdrv_co_block_status() could ignore unaligned tails.  It actually
          throws away everything past the EOF already, so that sounds
          reasonable.
          Unfortunately, the block layer knows file lengths only with a
          granularity of BDRV_SECTOR_SIZE, so bdrv_co_block_status() usually
          would have to guess whether its file length information is inexact
          or whether the driver is broken.
      
      Fixing what raw_co_block_status() returns is the safest thing to do.
      
      There seems to be no other block driver that sets request_alignment and
      does not make sure that it always returns aligned values.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      9c3db310
    • K
      012056f4
    • K
      blockjob: Remove AioContext notifiers · 657e1203
      Kevin Wolf 提交于
      The notifiers made sure that the job is quiesced and that the
      job->aio_context field is updated. The first part is unnecessary today
      since bdrv_set_aio_context_ignore() drains the block node, and this
      means drainig the block job, too. The second part can be done in the
      .set_aio_ctx callback of the block job BdrvChildRole.
      
      The notifiers were problematic because they poll the AioContext while
      the graph is in an inconsistent state with some nodes already in the new
      context, but others still in the old context. So removing the notifiers
      not only simplifies the code, but actually makes the code safer.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      657e1203
    • K
      blockjob: Propagate AioContext change to all job nodes · 9ff7f0df
      Kevin Wolf 提交于
      Block jobs require that all of the nodes the job is using are in the
      same AioContext. Therefore all BdrvChild objects of the job propagate
      .(can_)set_aio_context to all other job nodes, so that the switch is
      checked and performed consistently even if both nodes are in different
      subtrees.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      9ff7f0df