libvirt/SOURCES/libvirt-qemublocktest-Add-b...

356 lines
8.4 KiB
Diff

From 433f551418c9b40b5da9bf36abb5f9eba0662369 Mon Sep 17 00:00:00 2001
Message-Id: <433f551418c9b40b5da9bf36abb5f9eba0662369@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 23 Jun 2020 12:24:01 +0200
Subject: [PATCH] qemublocktest: Add 'basic' tests for commit bitmap handling
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In the 'basic' case we have few bitmaps in only the top layer. Simulate
commit into the backing of the top layer and also 2 levels deep.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit 79bc7c1828212c165d8b71bd6166ca24695a8ecd)
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
Message-Id: <9973a947b47bb20fa2e3f03e1a36541c2f1f3018.1592906423.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
tests/qemublocktest.c | 4 +
.../bitmapblockcommit/basic-1-2 | 145 ++++++++++++++++++
.../bitmapblockcommit/basic-1-3 | 145 ++++++++++++++++++
.../bitmapblockcommit/basic-2-3 | 1 +
4 files changed, 295 insertions(+)
create mode 100644 tests/qemublocktestdata/bitmapblockcommit/basic-1-2
create mode 100644 tests/qemublocktestdata/bitmapblockcommit/basic-1-3
create mode 100644 tests/qemublocktestdata/bitmapblockcommit/basic-2-3
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index f0e80a0738..43abc49534 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -1357,6 +1357,10 @@ mymain(void)
TEST_BITMAP_BLOCKCOMMIT("empty", 1, 2, "empty");
+ TEST_BITMAP_BLOCKCOMMIT("basic-1-2", 1, 2, "basic");
+ TEST_BITMAP_BLOCKCOMMIT("basic-1-3", 1, 3, "basic");
+ TEST_BITMAP_BLOCKCOMMIT("basic-2-3", 2, 3, "basic");
+
cleanup:
qemuTestDriverFree(&driver);
VIR_FREE(capslatest_x86_64);
diff --git a/tests/qemublocktestdata/bitmapblockcommit/basic-1-2 b/tests/qemublocktestdata/bitmapblockcommit/basic-1-2
new file mode 100644
index 0000000000..d393d31044
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/basic-1-2
@@ -0,0 +1,145 @@
+merge bitmpas:
+[
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "libvirt-2-format",
+ "name": "a",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "libvirt-2-format",
+ "target": "a",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "a"
+ },
+ {
+ "node": "libvirt-2-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "libvirt-2-format",
+ "name": "b",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "libvirt-2-format",
+ "target": "b",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "b"
+ },
+ {
+ "node": "libvirt-2-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "libvirt-2-format",
+ "name": "c",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "libvirt-2-format",
+ "target": "c",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "c"
+ },
+ {
+ "node": "libvirt-2-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "libvirt-2-format",
+ "name": "d",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "libvirt-2-format",
+ "target": "d",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "d"
+ },
+ {
+ "node": "libvirt-2-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "libvirt-2-format",
+ "name": "current",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "libvirt-2-format",
+ "target": "current",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "current"
+ },
+ {
+ "node": "libvirt-2-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-remove",
+ "data": {
+ "node": "libvirt-2-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ }
+]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/basic-1-3 b/tests/qemublocktestdata/bitmapblockcommit/basic-1-3
new file mode 100644
index 0000000000..3fa902c354
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/basic-1-3
@@ -0,0 +1,145 @@
+merge bitmpas:
+[
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "libvirt-3-format",
+ "name": "a",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "libvirt-3-format",
+ "target": "a",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "a"
+ },
+ {
+ "node": "libvirt-3-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "libvirt-3-format",
+ "name": "b",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "libvirt-3-format",
+ "target": "b",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "b"
+ },
+ {
+ "node": "libvirt-3-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "libvirt-3-format",
+ "name": "c",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "libvirt-3-format",
+ "target": "c",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "c"
+ },
+ {
+ "node": "libvirt-3-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "libvirt-3-format",
+ "name": "d",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "libvirt-3-format",
+ "target": "d",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "d"
+ },
+ {
+ "node": "libvirt-3-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-add",
+ "data": {
+ "node": "libvirt-3-format",
+ "name": "current",
+ "persistent": true,
+ "disabled": false,
+ "granularity": 65536
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-merge",
+ "data": {
+ "node": "libvirt-3-format",
+ "target": "current",
+ "bitmaps": [
+ {
+ "node": "libvirt-1-format",
+ "name": "current"
+ },
+ {
+ "node": "libvirt-3-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ ]
+ }
+ },
+ {
+ "type": "block-dirty-bitmap-remove",
+ "data": {
+ "node": "libvirt-3-format",
+ "name": "libvirt-tmp-activewrite"
+ }
+ }
+]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/basic-2-3 b/tests/qemublocktestdata/bitmapblockcommit/basic-2-3
new file mode 100644
index 0000000000..9260011852
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/basic-2-3
@@ -0,0 +1 @@
+merge bitmpas:
--
2.27.0