]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemublocktest: Add 'snapshots' tests for backup bitmap handling
authorPeter Krempa <pkrempa@redhat.com>
Fri, 29 May 2020 10:55:02 +0000 (12:55 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 22 Jun 2020 14:04:30 +0000 (16:04 +0200)
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>
tests/qemublocktest.c
tests/qemublocktestdata/backupmerge/snapshots-deep-out.json [new file with mode: 0644]
tests/qemublocktestdata/backupmerge/snapshots-flat-out.json [new file with mode: 0644]
tests/qemublocktestdata/backupmerge/snapshots-intermediate-out.json [new file with mode: 0644]

index 1300e0cbe9b341ae8bda9352772cc8d53b959bfb..fd6dff82f94822506a54f0a36054fb95c9761afe 100644 (file)
@@ -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 (file)
index 0000000..d678507
--- /dev/null
@@ -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 (file)
index 0000000..4637bbc
--- /dev/null
@@ -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 (file)
index 0000000..30d8bcd
--- /dev/null
@@ -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"
+        }
+      ]
+    }
+  }
+]