[PATCH 25/32] qemublocktest: Add 'snapshots' tests for backup bitmap handling

Peter Krempa posted 32 patches 5 years, 6 months ago
[PATCH 25/32] qemublocktest: Add 'snapshots' tests for backup bitmap handling
Posted by Peter Krempa 5 years, 6 months ago
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>
---
 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"
+        }
+      ]
+    }
+  }
+]
-- 
2.26.2

Re: [PATCH 25/32] qemublocktest: Add 'snapshots' tests for backup bitmap handling
Posted by Eric Blake 5 years, 6 months ago
On 6/15/20 12:10 PM, Peter Krempa wrote:
> 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>
> ---
>   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
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

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