render / rpms / libvirt

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