render / rpms / libvirt

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