qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v5 00/12] qemu-img: Implement commit like QMP


From: Max Reitz
Subject: [Qemu-devel] [PATCH v5 00/12] qemu-img: Implement commit like QMP
Date: Thu, 17 Apr 2014 23:59:40 +0200

qemu-img should use QMP commands whenever possible in order to ensure
feature completeness of both online and offline image operations. For
the "commit" command, this is relatively easy, so implement it first
(in the hope that indeed others will follow).

As qemu-img does not have access to QMP (due to QMP being intertwined
with basically everything in qemu), we cannot directly use QMP, but at
least use the functions the corresponding QMP commands are using (which
would be "block-commit", in this case).


Intra-series dependencies (to make clear why there are suddenly so many
patches in this version):
- Patches 1 and 2 in this series are required so that patch 7 actually
  does something for qcow2
- Patches 3 and 4 are required for patch 6 (to make it simpler and, in
  the case of patch 4, actually work in the first place)
- Patch 5 is required for patch 8
- Patch 10 is required for patch 11

Also note that patch 7 is ready for emptying multiple images in the
backing chain, although this case is impossible before patch 9. However,
I wanted to have 7 directly after 6 to restore the old functionality
(empty the top image) and instead of doing it bad then and fixing it up
after 9 again, patch 7 immediately includes everything needed.
Therefore, most of patch 7 may seem useless at first, but is necessary
after patch 9.


v5: Various fixes and support for emptying images after they have been
committed:
- Patches 1 and 2 have been introduced for patch 7; adding a general
  bdrv_make_empty() using bdrv_discard() did not work, as the latter
  tries to make discarded sectors read back as zero (which is not what
  bdrv_make_empty() should do). On the other hand, the bdrv_make_empty()
  implementation for qcow2 introduced here does reuse qcow2's discard
  functions.
- Patch 3 (previously 2):
  - Renamed BlockCancelData to BlockFinishData and block_job_cancel_cb
    to block_job_finish_cb [Kevin]
  - also, if the function used to finish the block job fails,
    block_job_finish_sync() should return and not go into an infinite loop
- Patch 4: Relying on the block job's progress offset to reach the block
  job's length as the readiness condition is wrong. This patch is the
  basis for fixing patch 6 in this regard.
- Patch 5: Added as proposed by Kevin (hopefully)
- Patch 6 (previously 3):
  - block_job_query() is actually useless here [Kevin]
  - use the new "ready" field from patch 5 to determine when the block
    job may be completed
  - don't force any granularity and rather just use the default [Kevin]
  - drop the block job's reference in the common block job CB;
    otherwise, test 039 will fail because the image is "leaked" and not
    closed properly
  - don't define CommonBlockJobCBInfo cbi in the middle of the function
- Patch 7: Added, as it now makes sense with qcow2 supporting it
- Patch 8 (previously 4):
  - hugely simplified, thanks to patch 5 [Kevin]
  - force output of "100 %" after the block job has completed
- Patch 9 (previously 5): Unmodified
- Patch 10: Introduced, as using my local paths for everyone else to
  test against does not seem too clever
- Patch 11: Replaces the old patch 10 - as this test only works for
  images with support for bdrv_make_empty(), it may no longer be part of
  020
- Patch 12: Adjusts existing tests in regard to patch 5

The old patch 1 has been dropped as patch 5 has made it unnecessary,
concerning patch 8.


Max Reitz (12):
  qcow2: Allow "full" discard
  qcow2: Implement bdrv_make_empty()
  blockjob: Introduce block_job_complete_sync()
  blockjob: Add "ready" field
  block/mirror: Improve progress report
  qemu-img: Implement commit like QMP
  qemu-img: Empty images after commit
  qemu-img: Enable progress output for commit
  qemu-img: Specify backing file for commit
  iotests: Add _filter_qemu_img_map
  iotests: Add test for backing-chain commits
  iotests: Omit length/offset test in 040 and 041

 block/Makefile.objs              |   2 +-
 block/mirror.c                   |  32 ++++---
 block/qcow2-cluster.c            |  26 +++--
 block/qcow2-snapshot.c           |   2 +-
 block/qcow2.c                    |  24 ++++-
 block/qcow2.h                    |   2 +-
 blockjob.c                       |  46 +++++++--
 include/block/blockjob.h         |  20 ++++
 qapi-schema.json                 |   4 +-
 qemu-img-cmds.hx                 |   4 +-
 qemu-img.c                       | 198 ++++++++++++++++++++++++++++++++++-----
 qemu-img.texi                    |   8 +-
 tests/qemu-iotests/040           |   3 -
 tests/qemu-iotests/041           |   2 -
 tests/qemu-iotests/089           | 103 ++++++++++++++++++++
 tests/qemu-iotests/089.out       |  56 +++++++++++
 tests/qemu-iotests/common.filter |   7 ++
 tests/qemu-iotests/group         |   1 +
 tests/qemu-iotests/iotests.py    |   2 -
 19 files changed, 475 insertions(+), 67 deletions(-)
 create mode 100755 tests/qemu-iotests/089
 create mode 100644 tests/qemu-iotests/089.out

-- 
1.9.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]