libvirt/SOURCES/libvirt-qemublocktest-Add-snapshots-tests-for-backup-bitmap-handling.patch
2021-09-10 11:57:33 +00:00

162 lines
4.9 KiB
Diff

From 8528b76210e54f664f2098e0127dac811f12800a Mon Sep 17 00:00:00 2001
Message-Id: <8528b76210e54f664f2098e0127dac811f12800a@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 23 Jun 2020 12:23:59 +0200
Subject: [PATCH] qemublocktest: Add 'snapshots' tests for backup bitmap
handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit b630cf4c0d8446a301fd23e87c9e8d60d547b5e8)
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
Message-Id: <3ef354322f829f47c91738060dd6557462e6d6d5.1592906423.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
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 7a0159f659..8ce878f15b 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -1266,6 +1266,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"
+ }
+ ]
+ }
+ }
+]
--
2.27.0