render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
b971b8
From 747e726988e43451139b3113e7b5f60b2f50e17e Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <747e726988e43451139b3113e7b5f60b2f50e17e@dist-git>
b971b8
From: Peter Krempa <pkrempa@redhat.com>
b971b8
Date: Tue, 23 Jun 2020 12:23:58 +0200
b971b8
Subject: [PATCH] qemublocktest: Add 'basic' tests for backup bitmap handling
b971b8
MIME-Version: 1.0
b971b8
Content-Type: text/plain; charset=UTF-8
b971b8
Content-Transfer-Encoding: 8bit
b971b8
b971b8
The 'basic' case is just a single backing store layer containing the
b971b8
bitmaps so we just copy the bitmaps over to the backup bitmap.
b971b8
b971b8
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
b971b8
Reviewed-by: Eric Blake <eblake@redhat.com>
b971b8
(cherry picked from commit 8c6e2da25e55081164cb5eb02ddece38500c5cff)
b971b8
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
b971b8
Message-Id: <94d168ffd27a6da8ffec1dfb37268e79c395c21e.1592906423.git.pkrempa@redhat.com>
b971b8
Reviewed-by: Ján Tomko <jtomko@redhat.com>
b971b8
---
b971b8
 tests/qemublocktest.c                         |  4 +++
b971b8
 .../backupmerge/basic-deep-out.json           | 25 +++++++++++++++++++
b971b8
 .../backupmerge/basic-flat-out.json           | 25 +++++++++++++++++++
b971b8
 .../backupmerge/basic-intermediate-out.json   | 25 +++++++++++++++++++
b971b8
 4 files changed, 79 insertions(+)
b971b8
 create mode 100644 tests/qemublocktestdata/backupmerge/basic-deep-out.json
b971b8
 create mode 100644 tests/qemublocktestdata/backupmerge/basic-flat-out.json
b971b8
 create mode 100644 tests/qemublocktestdata/backupmerge/basic-intermediate-out.json
b971b8
b971b8
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
b971b8
index dcdc9eade0..7a0159f659 100644
b971b8
--- a/tests/qemublocktest.c
b971b8
+++ b/tests/qemublocktest.c
b971b8
@@ -1262,6 +1262,10 @@ mymain(void)
b971b8
 
b971b8
     TEST_BACKUP_BITMAP_CALCULATE("empty", bitmapSourceChain, "a", "empty");
b971b8
 
b971b8
+    TEST_BACKUP_BITMAP_CALCULATE("basic-flat", bitmapSourceChain, "current", "basic");
b971b8
+    TEST_BACKUP_BITMAP_CALCULATE("basic-intermediate", bitmapSourceChain, "d", "basic");
b971b8
+    TEST_BACKUP_BITMAP_CALCULATE("basic-deep", bitmapSourceChain, "a", "basic");
b971b8
+
b971b8
 #define TEST_CHECKPOINT_DELETE(testname, delbmp, named) \
b971b8
     do { \
b971b8
         checkpointdeletedata.name = testname; \
b971b8
diff --git a/tests/qemublocktestdata/backupmerge/basic-deep-out.json b/tests/qemublocktestdata/backupmerge/basic-deep-out.json
b971b8
new file mode 100644
b971b8
index 0000000000..ff77af789b
b971b8
--- /dev/null
b971b8
+++ b/tests/qemublocktestdata/backupmerge/basic-deep-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": "a"
b971b8
+        }
b971b8
+      ]
b971b8
+    }
b971b8
+  }
b971b8
+]
b971b8
diff --git a/tests/qemublocktestdata/backupmerge/basic-flat-out.json b/tests/qemublocktestdata/backupmerge/basic-flat-out.json
b971b8
new file mode 100644
b971b8
index 0000000000..4637bbc377
b971b8
--- /dev/null
b971b8
+++ b/tests/qemublocktestdata/backupmerge/basic-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/basic-intermediate-out.json b/tests/qemublocktestdata/backupmerge/basic-intermediate-out.json
b971b8
new file mode 100644
b971b8
index 0000000000..f2f3b3f568
b971b8
--- /dev/null
b971b8
+++ b/tests/qemublocktestdata/backupmerge/basic-intermediate-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": "d"
b971b8
+        }
b971b8
+      ]
b971b8
+    }
b971b8
+  }
b971b8
+]
b971b8
-- 
b971b8
2.27.0
b971b8