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