libvirt/SOURCES/libvirt-qemublocktest-Add-t...

686 lines
16 KiB
Diff

From 98ac7cbfb11dd6e5eadc88698f762cd9a48b4789 Mon Sep 17 00:00:00 2001
Message-Id: <98ac7cbfb11dd6e5eadc88698f762cd9a48b4789@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 23 Jun 2020 12:24:05 +0200
Subject: [PATCH] qemublocktest: Add test cases for handling bitmaps during
block-copy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Test both 'basic' and 'snapshots' cases on shallow and deep copy modes.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 5f2fdcc867a08baa3d931cde895761bcbb45b7f6)
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
Message-Id: <1f77aeac4a968c1115893226589b8d97f8a90838.1592906423.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
tests/qemublocktest.c | 5 +
.../bitmapblockcopy/basic-deep-out.json | 144 ++++++++++++++
.../bitmapblockcopy/basic-shallow-out.json | 144 ++++++++++++++
.../bitmapblockcopy/snapshots-deep-out.json | 180 ++++++++++++++++++
.../snapshots-shallow-out.json | 144 ++++++++++++++
5 files changed, 617 insertions(+)
create mode 100644 tests/qemublocktestdata/bitmapblockcopy/basic-deep-out.json
create mode 100644 tests/qemublocktestdata/bitmapblockcopy/basic-shallow-out.json
create mode 100644 tests/qemublocktestdata/bitmapblockcopy/snapshots-deep-out.json
create mode 100644 tests/qemublocktestdata/bitmapblockcopy/snapshots-shallow-out.json
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 193b4aaed0..758a7c1db0 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -1345,6 +1345,11 @@ mymain(void)
TEST_BITMAP_BLOCKCOPY("empty-shallow", true, "empty");
TEST_BITMAP_BLOCKCOPY("empty-deep", false, "empty");
+ TEST_BITMAP_BLOCKCOPY("basic-shallow", true, "basic");
+ TEST_BITMAP_BLOCKCOPY("basic-deep", false, "basic");
+
+ TEST_BITMAP_BLOCKCOPY("snapshots-shallow", true, "snapshots");
+ TEST_BITMAP_BLOCKCOPY("snapshots-deep", false, "snapshots");
#define TEST_BITMAP_BLOCKCOMMIT(testname, topimg, baseimg, ndf) \
do {\
diff --git a/tests/qemublocktestdata/bitmapblockcopy/basic-deep-out.json b/tests/qemublocktestdata/bitmapblockcopy/basic-deep-out.json
new file mode 100644
index 0000000000..a8c2749879
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcopy/basic-deep-out.json
@@ -0,0 +1,144 @@
+[
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "a",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "a",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "a"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "b",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "b",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "b"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "c",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "c",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "c"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "d",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "d",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "d"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "current",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "current",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "current"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-remove",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ }
+]
diff --git a/tests/qemublocktestdata/bitmapblockcopy/basic-shallow-out.json b/tests/qemublocktestdata/bitmapblockcopy/basic-shallow-out.json
new file mode 100644
index 0000000000..a8c2749879
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcopy/basic-shallow-out.json
@@ -0,0 +1,144 @@
+[
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "a",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "a",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "a"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "b",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "b",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "b"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "c",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "c",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "c"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "d",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "d",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "d"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "current",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "current",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "current"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-remove",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ }
+]
diff --git a/tests/qemublocktestdata/bitmapblockcopy/snapshots-deep-out.json b/tests/qemublocktestdata/bitmapblockcopy/snapshots-deep-out.json
new file mode 100644
index 0000000000..ac2ffb4ce2
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcopy/snapshots-deep-out.json
@@ -0,0 +1,180 @@
+[
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "current",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "current",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "current"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "c",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "c",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "c"
+ },
+ {
+ "node": "libvirt-2-format",
+ "name": "c"
+ },
+ {
+ "node": "libvirt-3-format",
+ "name": "c"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "b",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "b",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "b"
+ },
+ {
+ "node": "libvirt-2-format",
+ "name": "b"
+ },
+ {
+ "node": "libvirt-3-format",
+ "name": "b"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "a",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "a",
+ "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"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "d",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "d",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "d"
+ },
+ {
+ "node": "libvirt-2-format",
+ "name": "d"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-remove",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ }
+]
diff --git a/tests/qemublocktestdata/bitmapblockcopy/snapshots-shallow-out.json b/tests/qemublocktestdata/bitmapblockcopy/snapshots-shallow-out.json
new file mode 100644
index 0000000000..3a9942569a
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcopy/snapshots-shallow-out.json
@@ -0,0 +1,144 @@
+[
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "current",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "current",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "current"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "c",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "c",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "c"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "b",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "b",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "b"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "a",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "a",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "a"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "d",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "mirror-format-node",
+ "target": "d",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "d"
+ },
+ {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-remove",
+ "data": {
+ "node": "mirror-format-node",
+ "name": "libvirt-tmp-activewrite"
+ }
+ }
+]
--
2.27.0