[RFC PATCH 35/41] qemublocktest: Add 'snapshots' tests for backup bitmap handling

Peter Krempa pkrempa at redhat.com
Tue Jun 9 15:00:42 UTC 2020


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 at redhat.com>
---
 tests/qemublocktest.c                         |  4 ++
 .../backupmerge/snapshots-deep-out.json       | 46 +++++++++++++++++++
 .../backupmerge/snapshots-flat-out.json       | 25 ++++++++++
 .../snapshots-intermediate-out.json           | 31 +++++++++++++
 4 files changed, 106 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 5cdc4d4be6..a04719b2df 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -1271,6 +1271,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..0cd4ec2b8a
--- /dev/null
+++ b/tests/qemublocktestdata/backupmerge/snapshots-deep-out.json
@@ -0,0 +1,46 @@
+[
+  {
+    "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": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-2-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-3-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-4-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-5-format",
+          "name": "a"
+        }
+      ]
+    }
+  }
+]
+allocation bitmap:
+libvirt-4-format
+libvirt-3-format
+libvirt-2-format
+libvirt-1-format
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..d6cf4e3a17
--- /dev/null
+++ b/tests/qemublocktestdata/backupmerge/snapshots-intermediate-out.json
@@ -0,0 +1,31 @@
+[
+  {
+    "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": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-2-format",
+          "name": "d"
+        }
+      ]
+    }
+  }
+]
+allocation bitmap:
+libvirt-1-format
-- 
2.26.2




More information about the libvir-list mailing list