Skip to content

qemu-img compare --stat

Vladimir Sementsov-Ogievskiy qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 8 repliesIn review
  2. v24 patches 9 repliesSuperseded
  3. v14 patches 4 repliesSuperseded

Changes in v3 from the cover letter

qemu-img: implement compare --stat
fix wording
fix option numbers
allocate ImgCmpStat dynamically
fix exit statuses
restrict using strict mode together with --stat

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4qemu-img: implement compare --statdocs/tools/qemu-img.rst qemu-img-cmds.hx qemu-img.c+216 -162 replies
2/4qemu-img: make --block-size optional for compare --statdocs/tools/qemu-img.rst qemu-img-cmds.hx qemu-img.c+72 -104 replies
3/4qemu-img: add --shallow option for qemu-img comparedocs/tools/qemu-img.rst qemu-img-cmds.hx qemu-img.c+16 -52 replies
4/4iotests: add qemu-img-compare-stat testtests/qemu-iotests/tests/qemu-img-compare-stat tests/qemu-iotests/tests/qemu-img-compare-stat.out+194 -00 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchHanna ReitzEric Blake
1/4
2/4R-b R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/4] qemu-img compare --stat

Hi all!

Recently we faced the following task:

Customer comes and say: incremental backup images are too fat. Does you incremental backup works correct?

What to answer? We should check something. At least check that incremental images doesn't store same data twice. And we don't have a tool for it. I just wrote a simple python script to compare raw files cluster-by-cluster. Then we've mounted the qcow2 images with help of qemu-nbd, the resulting /dev/nbd* were compared and we proved that incremental backups don't store same data.

But that leads to idea that some kind of that script would be good to have at hand.

So, here is a new option for qemu-img compare, that is a lot more powerful and effective than original script, and allows to compare and calculate statistics, i.e. how many clusters differs, how many clusters changed from unallocated to data, and so on.

For examples of output look at the test in patch 04.

v3:
qemu-img: implement compare --stat
fix wording
fix option numbers
allocate ImgCmpStat dynamically
fix exit statuses
restrict using strict mode together with --stat

qemu-img: make --block-size optional for compare --stat
fix wording

qemu-img: add --shallow option for qemu-img compare
fix option number(rebase on previous fix) add Hanna's r-b

iotests: add qemu-img-compare-stat test
add Hanna's r-b
s/Agenda/Key/ in test output

Vladimir Sementsov-Ogievskiy (4):
qemu-img: implement compare --stat
qemu-img: make --block-size optional for compare --stat
qemu-img: add --shallow option for qemu-img compare
iotests: add qemu-img-compare-stat test

 docs/tools/qemu-img.rst                       |  30 +-
 qemu-img.c                                    | 275 +++++++++++++++++-
 qemu-img-cmds.hx                              |   4 +-
 .../qemu-iotests/tests/qemu-img-compare-stat  |  88 ++++++
 .../tests/qemu-img-compare-stat.out           | 106 +++++++
 5 files changed, 485 insertions(+), 18 deletions(-)
 create mode 100755 tests/qemu-iotests/tests/qemu-img-compare-stat
 create mode 100644 tests/qemu-iotests/tests/qemu-img-compare-stat.out
Signature · 1 line
2.31.1