From b630cf4c0d8446a301fd23e87c9e8d60d547b5e8 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 29 May 2020 12:55:02 +0200 Subject: [PATCH] qemublocktest: Add 'snapshots' tests for backup bitmap handling The 'snapshots' case has multiple layers so we need to make sure that the bitmaps are merged with the appropriate temporary bitmaps formatted from the allocation bitmap for any backing chain layer above. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 4 ++ .../backupmerge/snapshots-deep-out.json | 41 +++++++++++++++++++ .../backupmerge/snapshots-flat-out.json | 25 +++++++++++ .../snapshots-intermediate-out.json | 29 +++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 tests/qemublocktestdata/backupmerge/snapshots-deep-out.json create mode 100644 tests/qemublocktestdata/backupmerge/snapshots-flat-out.json create mode 100644 tests/qemublocktestdata/backupmerge/snapshots-intermediate-out.json diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 1300e0cbe9..fd6dff82f9 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -1267,6 +1267,10 @@ mymain(void) TEST_BACKUP_BITMAP_CALCULATE("basic-intermediate", bitmapSourceChain, "d", "basic"); TEST_BACKUP_BITMAP_CALCULATE("basic-deep", bitmapSourceChain, "a", "basic"); + TEST_BACKUP_BITMAP_CALCULATE("snapshots-flat", bitmapSourceChain, "current", "snapshots"); + TEST_BACKUP_BITMAP_CALCULATE("snapshots-intermediate", bitmapSourceChain, "d", "snapshots"); + TEST_BACKUP_BITMAP_CALCULATE("snapshots-deep", bitmapSourceChain, "a", "snapshots"); + #define TEST_CHECKPOINT_DELETE(testname, delbmp, named) \ do { \ checkpointdeletedata.name = testname; \ diff --git a/tests/qemublocktestdata/backupmerge/snapshots-deep-out.json b/tests/qemublocktestdata/backupmerge/snapshots-deep-out.json new file mode 100644 index 0000000000..d678507b85 --- /dev/null +++ b/tests/qemublocktestdata/backupmerge/snapshots-deep-out.json @@ -0,0 +1,41 @@ +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "target_node", + "name": "target-bitmap-name", + "persistent": false, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "target_node", + "target": "target-bitmap-name", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "a" + }, + { + "node": "libvirt-2-format", + "name": "a" + }, + { + "node": "libvirt-3-format", + "name": "a" + }, + { + "node": "libvirt-4-format", + "name": "a" + }, + { + "node": "libvirt-5-format", + "name": "a" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/backupmerge/snapshots-flat-out.json b/tests/qemublocktestdata/backupmerge/snapshots-flat-out.json new file mode 100644 index 0000000000..4637bbc377 --- /dev/null +++ b/tests/qemublocktestdata/backupmerge/snapshots-flat-out.json @@ -0,0 +1,25 @@ +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "target_node", + "name": "target-bitmap-name", + "persistent": false, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "target_node", + "target": "target-bitmap-name", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/backupmerge/snapshots-intermediate-out.json b/tests/qemublocktestdata/backupmerge/snapshots-intermediate-out.json new file mode 100644 index 0000000000..30d8bcd8b7 --- /dev/null +++ b/tests/qemublocktestdata/backupmerge/snapshots-intermediate-out.json @@ -0,0 +1,29 @@ +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "target_node", + "name": "target-bitmap-name", + "persistent": false, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "target_node", + "target": "target-bitmap-name", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + }, + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +]