libvirt/SOURCES/libvirt-qemublocktest-Add-new-synthetic-bitmap-detection-and-validation-test-case.patch
2021-10-08 13:11:20 +00:00

594 lines
16 KiB
Diff

From 3afb35cc6b6dabd52fe508766d5a914d74135f69 Mon Sep 17 00:00:00 2001
Message-Id: <3afb35cc6b6dabd52fe508766d5a914d74135f69@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 23 Jun 2020 12:23:52 +0200
Subject: [PATCH] qemublocktest: Add new 'synthetic' bitmap detection and
validation test case
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Based on the 'snapshots' example with manual tweaks to introduce
inactive, transient, inconsistent and duplicate bitmaps in various parts
of the chain to exercise detection and new validation code.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit b3845f0e3d0ec58b25274cb6b70906f44333069f)
https://bugzilla.redhat.com/show_bug.cgi?id=1804593
Message-Id: <6e6222a085da03ad17af728db3bdb9027c0d8b0e.1592906423.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
tests/qemublocktest.c | 11 +
tests/qemublocktestdata/bitmap/synthetic.json | 506 ++++++++++++++++++
tests/qemublocktestdata/bitmap/synthetic.out | 15 +
3 files changed, 532 insertions(+)
create mode 100644 tests/qemublocktestdata/bitmap/synthetic.json
create mode 100644 tests/qemublocktestdata/bitmap/synthetic.out
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index af81f1b77a..2f675d7e03 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -1302,6 +1302,7 @@ mymain(void)
TEST_BITMAP_DETECT("basic");
TEST_BITMAP_DETECT("snapshots");
+ TEST_BITMAP_DETECT("synthetic");
#define TEST_BACKUP_BITMAP_CALCULATE(testname, source, incrbackup, named) \
do { \
@@ -1357,6 +1358,16 @@ mymain(void)
TEST_BITMAP_VALIDATE("snapshots", "d", true);
TEST_BITMAP_VALIDATE("snapshots", "current", true);
+ TEST_BITMAP_VALIDATE("synthetic", "a", false);
+ TEST_BITMAP_VALIDATE("synthetic", "b", false);
+ TEST_BITMAP_VALIDATE("synthetic", "c", false);
+ TEST_BITMAP_VALIDATE("synthetic", "d", false);
+ TEST_BITMAP_VALIDATE("synthetic", "current", false);
+ TEST_BITMAP_VALIDATE("synthetic", "top-ok", true);
+ TEST_BITMAP_VALIDATE("synthetic", "top-inactive", false);
+ TEST_BITMAP_VALIDATE("synthetic", "top-transient", false);
+ TEST_BITMAP_VALIDATE("synthetic", "top-inactive-transient", false);
+
#define TEST_BITMAP_BLOCKCOPY(testname, shllw, ndf) \
do { \
blockbitmapblockcopydata.name = testname; \
diff --git a/tests/qemublocktestdata/bitmap/synthetic.json b/tests/qemublocktestdata/bitmap/synthetic.json
new file mode 100644
index 0000000000..3712c8e5fc
--- /dev/null
+++ b/tests/qemublocktestdata/bitmap/synthetic.json
@@ -0,0 +1,506 @@
+[
+ {
+ "iops_rd": 0,
+ "detect_zeroes": "off",
+ "image": {
+ "backing-filename-format": "qcow2",
+ "virtual-size": 10485760,
+ "filename": "/tmp/bitmaps.1590749073",
+ "cluster-size": 65536,
+ "format": "qcow2",
+ "actual-size": 208896,
+ "format-specific": {
+ "type": "qcow2",
+ "data": {
+ "compat": "1.1",
+ "compression-type": "zlib",
+ "lazy-refcounts": false,
+ "bitmaps": [
+ {
+ "flags": [
+ "in-use",
+ "auto"
+ ],
+ "name": "current",
+ "granularity": 65536
+ }
+ ],
+ "refcount-bits": 16,
+ "corrupt": false
+ }
+ },
+ "full-backing-filename": "/tmp/bitmaps.1590749012",
+ "backing-filename": "/tmp/bitmaps.1590749012",
+ "dirty-flag": false
+ },
+ "iops_wr": 0,
+ "ro": false,
+ "node-name": "libvirt-1-format",
+ "backing_file_depth": 0,
+ "drv": "qcow2",
+ "iops": 0,
+ "bps_wr": 0,
+ "write_threshold": 0,
+ "backing_file": "/tmp/bitmaps.1590749012",
+ "dirty-bitmaps": [
+ {
+ "name": "current",
+ "recording": true,
+ "persistent": true,
+ "busy": false,
+ "status": "active",
+ "inconsistent": true,
+ "granularity": 65536,
+ "count": 0
+ },
+ {
+ "name": "top-ok",
+ "recording": true,
+ "persistent": true,
+ "busy": false,
+ "status": "active",
+ "granularity": 65536,
+ "count": 0
+ },
+ {
+ "name": "top-inactive",
+ "recording": false,
+ "persistent": true,
+ "busy": false,
+ "status": "active",
+ "granularity": 65536,
+ "count": 0
+ },
+ {
+ "name": "top-transient",
+ "recording": true,
+ "persistent": false,
+ "busy": false,
+ "status": "active",
+ "granularity": 65536,
+ "count": 0
+ },
+ {
+ "name": "top-transient-inactive",
+ "recording": false,
+ "persistent": false,
+ "busy": false,
+ "status": "active",
+ "granularity": 65536,
+ "count": 0
+ }
+ ],
+ "encrypted": false,
+ "bps": 0,
+ "bps_rd": 0,
+ "cache": {
+ "no-flush": false,
+ "direct": false,
+ "writeback": true
+ },
+ "file": "/tmp/bitmaps.1590749073",
+ "encryption_key_missing": false
+ },
+ {
+ "iops_rd": 0,
+ "detect_zeroes": "off",
+ "image": {
+ "virtual-size": 328192,
+ "filename": "/tmp/bitmaps.1590749073",
+ "format": "file",
+ "actual-size": 208896,
+ "dirty-flag": false
+ },
+ "iops_wr": 0,
+ "ro": false,
+ "node-name": "libvirt-1-storage",
+ "backing_file_depth": 0,
+ "drv": "file",
+ "iops": 0,
+ "bps_wr": 0,
+ "write_threshold": 0,
+ "encrypted": false,
+ "bps": 0,
+ "bps_rd": 0,
+ "cache": {
+ "no-flush": false,
+ "direct": false,
+ "writeback": true
+ },
+ "file": "/tmp/bitmaps.1590749073",
+ "encryption_key_missing": false
+ },
+ {
+ "iops_rd": 0,
+ "detect_zeroes": "off",
+ "image": {
+ "backing-filename-format": "qcow2",
+ "virtual-size": 10485760,
+ "filename": "/tmp/bitmaps.1590749012",
+ "cluster-size": 65536,
+ "format": "qcow2",
+ "actual-size": 208896,
+ "format-specific": {
+ "type": "qcow2",
+ "data": {
+ "compat": "1.1",
+ "compression-type": "zlib",
+ "lazy-refcounts": false,
+ "bitmaps": [
+ {
+ "flags": [
+ "auto"
+ ],
+ "name": "d",
+ "granularity": 65536
+ }
+ ],
+ "refcount-bits": 16,
+ "corrupt": false
+ }
+ },
+ "full-backing-filename": "/tmp/bitmaps.1590748995",
+ "backing-filename": "/tmp/bitmaps.1590748995",
+ "dirty-flag": false
+ },
+ "iops_wr": 0,
+ "ro": true,
+ "node-name": "libvirt-2-format",
+ "backing_file_depth": 0,
+ "drv": "qcow2",
+ "iops": 0,
+ "bps_wr": 0,
+ "write_threshold": 0,
+ "backing_file": "/tmp/bitmaps.1590748995",
+ "dirty-bitmaps": [
+ {
+ "name": "d",
+ "recording": true,
+ "persistent": true,
+ "busy": false,
+ "status": "active",
+ "granularity": 65536,
+ "count": 0
+ }
+ ],
+ "encrypted": false,
+ "bps": 0,
+ "bps_rd": 0,
+ "cache": {
+ "no-flush": false,
+ "direct": false,
+ "writeback": true
+ },
+ "file": "/tmp/bitmaps.1590749012",
+ "encryption_key_missing": false
+ },
+ {
+ "iops_rd": 0,
+ "detect_zeroes": "off",
+ "image": {
+ "virtual-size": 328192,
+ "filename": "/tmp/bitmaps.1590749012",
+ "format": "file",
+ "actual-size": 208896,
+ "dirty-flag": false
+ },
+ "iops_wr": 0,
+ "ro": false,
+ "node-name": "libvirt-2-storage",
+ "backing_file_depth": 0,
+ "drv": "file",
+ "iops": 0,
+ "bps_wr": 0,
+ "write_threshold": 0,
+ "encrypted": false,
+ "bps": 0,
+ "bps_rd": 0,
+ "cache": {
+ "no-flush": false,
+ "direct": false,
+ "writeback": true
+ },
+ "file": "/tmp/bitmaps.1590749012",
+ "encryption_key_missing": false
+ },
+ {
+ "iops_rd": 0,
+ "detect_zeroes": "off",
+ "image": {
+ "backing-filename-format": "qcow2",
+ "virtual-size": 10485760,
+ "filename": "/tmp/bitmaps.1590748995",
+ "cluster-size": 65536,
+ "format": "qcow2",
+ "actual-size": 212992,
+ "format-specific": {
+ "type": "qcow2",
+ "data": {
+ "compat": "1.1",
+ "compression-type": "zlib",
+ "lazy-refcounts": false,
+ "bitmaps": [
+ {
+ "flags": [
+ "auto"
+ ],
+ "name": "c",
+ "granularity": 65536
+ },
+ {
+ "flags": [
+ "auto"
+ ],
+ "name": "b",
+ "granularity": 65536
+ }
+ ],
+ "refcount-bits": 16,
+ "corrupt": false
+ }
+ },
+ "full-backing-filename": "/tmp/bitmaps.1590748992",
+ "backing-filename": "/tmp/bitmaps.1590748992",
+ "dirty-flag": false
+ },
+ "iops_wr": 0,
+ "ro": true,
+ "node-name": "libvirt-3-format",
+ "backing_file_depth": 0,
+ "drv": "qcow2",
+ "iops": 0,
+ "bps_wr": 0,
+ "write_threshold": 0,
+ "backing_file": "/tmp/bitmaps.1590748992",
+ "dirty-bitmaps": [
+ {
+ "name": "b",
+ "recording": true,
+ "persistent": false,
+ "busy": false,
+ "status": "active",
+ "granularity": 65536,
+ "count": 0
+ },
+ {
+ "name": "c",
+ "recording": false,
+ "persistent": true,
+ "busy": false,
+ "status": "active",
+ "granularity": 65536,
+ "count": 0
+ },
+ {
+ "name": "d",
+ "recording": true,
+ "persistent": true,
+ "busy": false,
+ "status": "active",
+ "granularity": 65536,
+ "count": 0
+ }
+ ],
+ "encrypted": false,
+ "bps": 0,
+ "bps_rd": 0,
+ "cache": {
+ "no-flush": false,
+ "direct": false,
+ "writeback": true
+ },
+ "file": "/tmp/bitmaps.1590748995",
+ "encryption_key_missing": false
+ },
+ {
+ "iops_rd": 0,
+ "detect_zeroes": "off",
+ "image": {
+ "virtual-size": 393728,
+ "filename": "/tmp/bitmaps.1590748995",
+ "format": "file",
+ "actual-size": 212992,
+ "dirty-flag": false
+ },
+ "iops_wr": 0,
+ "ro": false,
+ "node-name": "libvirt-3-storage",
+ "backing_file_depth": 0,
+ "drv": "file",
+ "iops": 0,
+ "bps_wr": 0,
+ "write_threshold": 0,
+ "encrypted": false,
+ "bps": 0,
+ "bps_rd": 0,
+ "cache": {
+ "no-flush": false,
+ "direct": false,
+ "writeback": true
+ },
+ "file": "/tmp/bitmaps.1590748995",
+ "encryption_key_missing": false
+ },
+ {
+ "iops_rd": 0,
+ "detect_zeroes": "off",
+ "image": {
+ "backing-filename-format": "qcow2",
+ "virtual-size": 10485760,
+ "filename": "/tmp/bitmaps.1590748992",
+ "cluster-size": 65536,
+ "format": "qcow2",
+ "actual-size": 200704,
+ "format-specific": {
+ "type": "qcow2",
+ "data": {
+ "compat": "1.1",
+ "compression-type": "zlib",
+ "lazy-refcounts": false,
+ "refcount-bits": 16,
+ "corrupt": false
+ }
+ },
+ "full-backing-filename": "/tmp/bitmaps.qcow2",
+ "backing-filename": "/tmp/bitmaps.qcow2",
+ "dirty-flag": false
+ },
+ "iops_wr": 0,
+ "ro": true,
+ "node-name": "libvirt-4-format",
+ "backing_file_depth": 0,
+ "drv": "qcow2",
+ "iops": 0,
+ "bps_wr": 0,
+ "write_threshold": 0,
+ "backing_file": "/tmp/bitmaps.qcow2",
+ "encrypted": false,
+ "bps": 0,
+ "bps_rd": 0,
+ "cache": {
+ "no-flush": false,
+ "direct": false,
+ "writeback": true
+ },
+ "file": "/tmp/bitmaps.1590748992",
+ "encryption_key_missing": false
+ },
+ {
+ "iops_rd": 0,
+ "detect_zeroes": "off",
+ "image": {
+ "virtual-size": 197120,
+ "filename": "/tmp/bitmaps.1590748992",
+ "format": "file",
+ "actual-size": 200704,
+ "dirty-flag": false
+ },
+ "iops_wr": 0,
+ "ro": false,
+ "node-name": "libvirt-4-storage",
+ "backing_file_depth": 0,
+ "drv": "file",
+ "iops": 0,
+ "bps_wr": 0,
+ "write_threshold": 0,
+ "encrypted": false,
+ "bps": 0,
+ "bps_rd": 0,
+ "cache": {
+ "no-flush": false,
+ "direct": false,
+ "writeback": true
+ },
+ "file": "/tmp/bitmaps.1590748992",
+ "encryption_key_missing": false
+ },
+ {
+ "iops_rd": 0,
+ "detect_zeroes": "off",
+ "image": {
+ "virtual-size": 10485760,
+ "filename": "/tmp/bitmaps.qcow2",
+ "cluster-size": 65536,
+ "format": "qcow2",
+ "actual-size": 208896,
+ "format-specific": {
+ "type": "qcow2",
+ "data": {
+ "compat": "1.1",
+ "compression-type": "zlib",
+ "lazy-refcounts": false,
+ "bitmaps": [
+ {
+ "flags": [
+ "auto"
+ ],
+ "name": "a",
+ "granularity": 65536
+ }
+ ],
+ "refcount-bits": 16,
+ "corrupt": false
+ }
+ },
+ "dirty-flag": false
+ },
+ "iops_wr": 0,
+ "ro": true,
+ "node-name": "libvirt-5-format",
+ "backing_file_depth": 0,
+ "drv": "qcow2",
+ "iops": 0,
+ "bps_wr": 0,
+ "write_threshold": 0,
+ "dirty-bitmaps": [
+ {
+ "name": "a",
+ "recording": true,
+ "persistent": true,
+ "busy": false,
+ "status": "active",
+ "granularity": 65536,
+ "count": 0
+ }
+ ],
+ "encrypted": false,
+ "bps": 0,
+ "bps_rd": 0,
+ "cache": {
+ "no-flush": false,
+ "direct": false,
+ "writeback": true
+ },
+ "file": "/tmp/bitmaps.qcow2",
+ "encryption_key_missing": false
+ },
+ {
+ "iops_rd": 0,
+ "detect_zeroes": "off",
+ "image": {
+ "virtual-size": 328192,
+ "filename": "/tmp/bitmaps.qcow2",
+ "format": "file",
+ "actual-size": 208896,
+ "dirty-flag": false
+ },
+ "iops_wr": 0,
+ "ro": false,
+ "node-name": "libvirt-5-storage",
+ "backing_file_depth": 0,
+ "drv": "file",
+ "iops": 0,
+ "bps_wr": 0,
+ "write_threshold": 0,
+ "encrypted": false,
+ "bps": 0,
+ "bps_rd": 0,
+ "cache": {
+ "no-flush": false,
+ "direct": false,
+ "writeback": true
+ },
+ "file": "/tmp/bitmaps.qcow2",
+ "encryption_key_missing": false
+ }
+]
diff --git a/tests/qemublocktestdata/bitmap/synthetic.out b/tests/qemublocktestdata/bitmap/synthetic.out
new file mode 100644
index 0000000000..cde7228e01
--- /dev/null
+++ b/tests/qemublocktestdata/bitmap/synthetic.out
@@ -0,0 +1,15 @@
+libvirt-1-format:
+ current: record:1 busy:0 persist:1 inconsist:1 gran:65536 dirty:0
+ top-ok: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
+ top-inactive: record:0 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
+ top-transient: record:1 busy:0 persist:0 inconsist:0 gran:65536 dirty:0
+ top-transient-inactive: record:0 busy:0 persist:0 inconsist:0 gran:65536 dirty:0
+libvirt-2-format:
+ d: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
+libvirt-3-format:
+ b: record:1 busy:0 persist:0 inconsist:0 gran:65536 dirty:0
+ c: record:0 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
+ d: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
+libvirt-4-format:
+libvirt-5-format:
+ a: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0
--
2.27.0