[libvirt] [RFC PATCH 00/16] qemu: checkpoint: Add support for deleting checkpoints accross snapshots

Peter Krempa posted 16 patches 2 weeks ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1578593859.git.pkrempa@redhat.com
src/qemu/qemu_checkpoint.c                    | 329 +++++--
src/qemu/qemu_checkpoint.h                    |   9 +
src/qemu/qemu_domain.c                        |  14 -
src/qemu/qemu_domain.h                        |   3 -
tests/qemublocktest.c                         | 102 +++
.../snapshots-synthetic-checkpoint.json       | 827 ++++++++++++++++++
.../bitmap/snapshots-synthetic-checkpoint.out |  13 +
.../checkpointdelete/basic-current-out.json   |  29 +
.../basic-intermediate1-out.json              |  22 +
.../basic-intermediate2-out.json              |  22 +
.../basic-intermediate3-out.json              |  22 +
.../checkpointdelete/basic-noparent-out.json  |   9 +
.../snapshots-current-out.json                |  29 +
.../snapshots-intermediate1-out.json          |  24 +
.../snapshots-intermediate2-out.json          |  62 ++
.../snapshots-intermediate3-out.json          |  61 ++
.../snapshots-noparent-out.json               |  27 +
...hots-synthetic-checkpoint-current-out.json |  29 +
...ynthetic-checkpoint-intermediate1-out.json |  31 +
...ynthetic-checkpoint-intermediate2-out.json |  34 +
...ynthetic-checkpoint-intermediate3-out.json |  61 ++
...ots-synthetic-checkpoint-noparent-out.json |  27 +
22 files changed, 1680 insertions(+), 106 deletions(-)
create mode 100644 tests/qemublocktestdata/bitmap/snapshots-synthetic-checkpoint.json
create mode 100644 tests/qemublocktestdata/bitmap/snapshots-synthetic-checkpoint.out
create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-current-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate1-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate2-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate3-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-noparent-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-current-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate1-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate2-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate3-out.json
create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-noparent-out.json

[libvirt] [RFC PATCH 00/16] qemu: checkpoint: Add support for deleting checkpoints accross snapshots

Posted by Peter Krempa 2 weeks ago
Posted as RFC because qemu probably doesn't reopen backing images for
bitmap operations resulting in:

 $ virsh checkpoint-delete vm --checkpointname a
 error: Failed to delete checkpoint a
 error: internal error: unable to execute QEMU command 'transaction': Bitmap 'a' is readonly and cannot be modified

Unfortunately this can't be done manually because 'blockdev-reopen' is
still experimental.

Peter Krempa (16):
  qemu: checkpoint: Store whether deleted checkpoint is current in a
    variable
  qemu: checkpoint: split out checkpoint deletion bitmaps
  qemu: checkpoint: rename disk->chkdisk in qemuCheckpointDiscardBitmaps
  qemu: checkpoint: rename disk->chkdisk in qemuCheckpointAddActions
  qemu: checkpoint: Use disk definition directly when creating
    checkpoint
  qemu: checkpoint: tolerate missing disks on checkpoint deletion
  qemu: domain: Remove unused qemuDomainDiskNodeFormatLookup
  qemu: checkpoint: Introduce helper to find checkpoint disk definition
    in parents
  qemu: checkpoint: Extract calculation of bitmap merging for checkpoint
    deletion
  tests: qemublock: Add test for checkpoint deletion bitmap merge
  tests: qemublock: Add few more test cases for checkpoint deletion
  tests: qemublock: Add synthetic snapshot+checkpoint test data
  qemu: checkpoint: Introduce support for deleting checkpoints accross
    snapshots
  tests: qemublock: Add checkpoint deletion test for deep backing chain
  tests: qemublock: Add checkpoint deletion tests for some special cases
  qemu: checkpoint: Track and relabel images for bitmap merging

 src/qemu/qemu_checkpoint.c                    | 329 +++++--
 src/qemu/qemu_checkpoint.h                    |   9 +
 src/qemu/qemu_domain.c                        |  14 -
 src/qemu/qemu_domain.h                        |   3 -
 tests/qemublocktest.c                         | 102 +++
 .../snapshots-synthetic-checkpoint.json       | 827 ++++++++++++++++++
 .../bitmap/snapshots-synthetic-checkpoint.out |  13 +
 .../checkpointdelete/basic-current-out.json   |  29 +
 .../basic-intermediate1-out.json              |  22 +
 .../basic-intermediate2-out.json              |  22 +
 .../basic-intermediate3-out.json              |  22 +
 .../checkpointdelete/basic-noparent-out.json  |   9 +
 .../snapshots-current-out.json                |  29 +
 .../snapshots-intermediate1-out.json          |  24 +
 .../snapshots-intermediate2-out.json          |  62 ++
 .../snapshots-intermediate3-out.json          |  61 ++
 .../snapshots-noparent-out.json               |  27 +
 ...hots-synthetic-checkpoint-current-out.json |  29 +
 ...ynthetic-checkpoint-intermediate1-out.json |  31 +
 ...ynthetic-checkpoint-intermediate2-out.json |  34 +
 ...ynthetic-checkpoint-intermediate3-out.json |  61 ++
 ...ots-synthetic-checkpoint-noparent-out.json |  27 +
 22 files changed, 1680 insertions(+), 106 deletions(-)
 create mode 100644 tests/qemublocktestdata/bitmap/snapshots-synthetic-checkpoint.json
 create mode 100644 tests/qemublocktestdata/bitmap/snapshots-synthetic-checkpoint.out
 create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-current-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate1-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate2-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermediate3-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-noparent-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-current-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate1-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate2-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate3-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-noparent-out.json

-- 
2.24.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [RFC PATCH 00/16] qemu: checkpoint: Add support for deleting checkpoints accross snapshots

Posted by Eric Blake 19 hours ago
On 1/9/20 12:21 PM, Peter Krempa wrote:
> Posted as RFC because qemu probably doesn't reopen backing images for
> bitmap operations resulting in:
> 
>   $ virsh checkpoint-delete vm --checkpointname a
>   error: Failed to delete checkpoint a
>   error: internal error: unable to execute QEMU command 'transaction': Bitmap 'a' is readonly and cannot be modified
> 
> Unfortunately this can't be done manually because 'blockdev-reopen' is
> still experimental.

In the meantime, with existing qemu, can we still at least teach libvirt 
to delete its metadata, and ignore unknown bitmaps leftover in qcow2 
images that we were unable to delete because of the qemu limitation on 
read-only backing files?  Yes, your qcow2 files will get bloated with 
dead bitmaps, but that's not going to interfere with guest operations or 
with future backups that use the bitmaps still tracked by libvirt.  And 
it matches the failure scenario where an attempt at an incremental 
backup fails due to qemu crashing: the active bitmap is corrupt, so all 
older bitmaps are no longer usable, and your only recourse is to resort 
to full backup instead of incremental backup; but full backup is still 
worthwhile, and ignoring the now-useless bitmaps from the earlier backup 
points doesn't interfere with that.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org