render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
b971b8
From 8528b76210e54f664f2098e0127dac811f12800a Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <8528b76210e54f664f2098e0127dac811f12800a@dist-git>
b971b8
From: Peter Krempa <pkrempa@redhat.com>
b971b8
Date: Tue, 23 Jun 2020 12:23:59 +0200
b971b8
Subject: [PATCH] qemublocktest: Add 'snapshots' tests for backup bitmap
b971b8
 handling
b971b8
MIME-Version: 1.0
b971b8
Content-Type: text/plain; charset=UTF-8
b971b8
Content-Transfer-Encoding: 8bit
b971b8
b971b8
The 'snapshots' case has multiple layers so we need to make sure that
b971b8
the bitmaps are merged with the appropriate temporary bitmaps formatted
b971b8
from the allocation bitmap for any backing chain layer above.
b971b8
b971b8
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
b971b8
Reviewed-by: Eric Blake <eblake@redhat.com>
b971b8
(cherry picked from commit b630cf4c0d8446a301fd23e87c9e8d60d547b5e8)
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
b971b8
Message-Id: <3ef354322f829f47c91738060dd6557462e6d6d5.1592906423.git.pkrempa@redhat.com>
b971b8
Reviewed-by: Ján Tomko <jtomko@redhat.com>
b971b8
---
b971b8
 tests/qemublocktest.c                         |  4 ++
b971b8
 .../backupmerge/snapshots-deep-out.json       | 41 +++++++++++++++++++
b971b8
 .../backupmerge/snapshots-flat-out.json       | 25 +++++++++++
b971b8
 .../snapshots-intermediate-out.json           | 29 +++++++++++++
b971b8
 4 files changed, 99 insertions(+)
b971b8
 create mode 100644 tests/qemublocktestdata/backupmerge/snapshots-deep-out.json
b971b8
 create mode 100644 tests/qemublocktestdata/backupmerge/snapshots-flat-out.json
b971b8
 create mode 100644 tests/qemublocktestdata/backupmerge/snapshots-intermediate-out.json
b971b8
b971b8
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
b971b8
index 7a0159f659..8ce878f15b 100644
b971b8
--- a/tests/qemublocktest.c
b971b8
+++ b/tests/qemublocktest.c
b971b8
@@ -1266,6 +1266,10 @@ mymain(void)
b971b8
     TEST_BACKUP_BITMAP_CALCULATE("basic-intermediate", bitmapSourceChain, "d", "basic");
b971b8
     TEST_BACKUP_BITMAP_CALCULATE("basic-deep", bitmapSourceChain, "a", "basic");
b971b8
 
b971b8
+    TEST_BACKUP_BITMAP_CALCULATE("snapshots-flat", bitmapSourceChain, "current", "snapshots");
b971b8
+    TEST_BACKUP_BITMAP_CALCULATE("snapshots-intermediate", bitmapSourceChain, "d", "snapshots");
b971b8
+    TEST_BACKUP_BITMAP_CALCULATE("snapshots-deep", bitmapSourceChain, "a", "snapshots");
b971b8
+
b971b8
 #define TEST_CHECKPOINT_DELETE(testname, delbmp, named) \
b971b8
     do { \
b971b8
         checkpointdeletedata.name = testname; \
b971b8
diff --git a/tests/qemublocktestdata/backupmerge/snapshots-deep-out.json b/tests/qemublocktestdata/backupmerge/snapshots-deep-out.json
b971b8
new file mode 100644
b971b8
index 0000000000..d678507b85
b971b8
--- /dev/null
b971b8
+++ b/tests/qemublocktestdata/backupmerge/snapshots-deep-out.json
b971b8
@@ -0,0 +1,41 @@
b971b8
+[
b971b8
+  {
b971b8
+    "type": "block-dirty-bitmap-add",
b971b8
+    "data": {
b971b8
+      "node": "target_node",
b971b8
+      "name": "target-bitmap-name",
b971b8
+      "persistent": false,
b971b8
+      "disabled": true,
b971b8
+      "granularity": 65536
b971b8
+    }
b971b8
+  },
b971b8
+  {
b971b8
+    "type": "block-dirty-bitmap-merge",
b971b8
+    "data": {
b971b8
+      "node": "target_node",
b971b8
+      "target": "target-bitmap-name",
b971b8
+      "bitmaps": [
b971b8
+        {
b971b8
+          "node": "libvirt-1-format",
b971b8
+          "name": "a"
b971b8
+        },
b971b8
+        {
b971b8
+          "node": "libvirt-2-format",
b971b8
+          "name": "a"
b971b8
+        },
b971b8
+        {
b971b8
+          "node": "libvirt-3-format",
b971b8
+          "name": "a"
b971b8
+        },
b971b8
+        {
b971b8
+          "node": "libvirt-4-format",
b971b8
+          "name": "a"
b971b8
+        },
b971b8
+        {
b971b8
+          "node": "libvirt-5-format",
b971b8
+          "name": "a"
b971b8
+        }
b971b8
+      ]
b971b8
+    }
b971b8
+  }
b971b8
+]
b971b8
diff --git a/tests/qemublocktestdata/backupmerge/snapshots-flat-out.json b/tests/qemublocktestdata/backupmerge/snapshots-flat-out.json
b971b8
new file mode 100644
b971b8
index 0000000000..4637bbc377
b971b8
--- /dev/null
b971b8
+++ b/tests/qemublocktestdata/backupmerge/snapshots-flat-out.json
b971b8
@@ -0,0 +1,25 @@
b971b8
+[
b971b8
+  {
b971b8
+    "type": "block-dirty-bitmap-add",
b971b8
+    "data": {
b971b8
+      "node": "target_node",
b971b8
+      "name": "target-bitmap-name",
b971b8
+      "persistent": false,
b971b8
+      "disabled": true,
b971b8
+      "granularity": 65536
b971b8
+    }
b971b8
+  },
b971b8
+  {
b971b8
+    "type": "block-dirty-bitmap-merge",
b971b8
+    "data": {
b971b8
+      "node": "target_node",
b971b8
+      "target": "target-bitmap-name",
b971b8
+      "bitmaps": [
b971b8
+        {
b971b8
+          "node": "libvirt-1-format",
b971b8
+          "name": "current"
b971b8
+        }
b971b8
+      ]
b971b8
+    }
b971b8
+  }
b971b8
+]
b971b8
diff --git a/tests/qemublocktestdata/backupmerge/snapshots-intermediate-out.json b/tests/qemublocktestdata/backupmerge/snapshots-intermediate-out.json
b971b8
new file mode 100644
b971b8
index 0000000000..30d8bcd8b7
b971b8
--- /dev/null
b971b8
+++ b/tests/qemublocktestdata/backupmerge/snapshots-intermediate-out.json
b971b8
@@ -0,0 +1,29 @@
b971b8
+[
b971b8
+  {
b971b8
+    "type": "block-dirty-bitmap-add",
b971b8
+    "data": {
b971b8
+      "node": "target_node",
b971b8
+      "name": "target-bitmap-name",
b971b8
+      "persistent": false,
b971b8
+      "disabled": true,
b971b8
+      "granularity": 65536
b971b8
+    }
b971b8
+  },
b971b8
+  {
b971b8
+    "type": "block-dirty-bitmap-merge",
b971b8
+    "data": {
b971b8
+      "node": "target_node",
b971b8
+      "target": "target-bitmap-name",
b971b8
+      "bitmaps": [
b971b8
+        {
b971b8
+          "node": "libvirt-1-format",
b971b8
+          "name": "d"
b971b8
+        },
b971b8
+        {
b971b8
+          "node": "libvirt-2-format",
b971b8
+          "name": "d"
b971b8
+        }
b971b8
+      ]
b971b8
+    }
b971b8
+  }
b971b8
+]
b971b8
-- 
b971b8
2.27.0
b971b8