Blob Blame History Raw
From 5694a24b527b812e7236a7316271f4ae316e4caa Mon Sep 17 00:00:00 2001
Message-Id: <5694a24b527b812e7236a7316271f4ae316e4caa@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 4 Feb 2020 15:08:13 +0100
Subject: [PATCH] tests: qemublock: Add checkpoint deletion test for deep
 backing chain
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add test cases for merging various pairs of bitmaps when snapshots were
created together with checkpoints.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 3c1c35bada75052b73d224d80fb5c3747a664823)

https://bugzilla.redhat.com/show_bug.cgi?id=1207659
Message-Id: <06d3c8ebd023583de6c9d5033fc38a2757ecf8e2.1580824112.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 tests/qemublocktest.c                         |  6 ++
 .../snapshots-current-out.json                | 29 +++++++++
 .../snapshots-intermediate1-out.json          | 22 +++++++
 .../snapshots-intermediate2-out.json          | 59 +++++++++++++++++++
 .../snapshots-intermediate3-out.json          | 59 +++++++++++++++++++
 .../snapshots-noparent-out.json               | 23 ++++++++
 6 files changed, 198 insertions(+)
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.json
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index e56f813424..897b86f970 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -1015,6 +1015,12 @@ mymain(void)
     TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate3", "d", "c", "basic");
     TEST_CHECKPOINT_DELETE_MERGE("basic-current", "current", "d", "basic");
 
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-noparent", "a", NULL, "snapshots");
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate1", "b", "a", "snapshots");
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate2", "c", "b", "snapshots");
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate3", "d", "c", "snapshots");
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-current", "current", "d", "snapshots");
+
  cleanup:
     virHashFree(diskxmljsondata.schema);
     qemuTestDriverFree(&driver);
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json
new file mode 100644
index 0000000000..1b607567e8
--- /dev/null
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json
@@ -0,0 +1,29 @@
+[
+  {
+    "type": "block-dirty-bitmap-enable",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "d"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-1-format",
+      "target": "d",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "current"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "current"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.json
new file mode 100644
index 0000000000..29fefeea63
--- /dev/null
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.json
@@ -0,0 +1,22 @@
+[
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-3-format",
+      "target": "a",
+      "bitmaps": [
+        {
+          "node": "libvirt-3-format",
+          "name": "b"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "b"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.json
new file mode 100644
index 0000000000..4da21a9df7
--- /dev/null
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.json
@@ -0,0 +1,59 @@
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "b",
+      "persistent": true,
+      "disabled": true,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-2-format",
+      "target": "b",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "c"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "c"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-enable",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "b"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-3-format",
+      "target": "b",
+      "bitmaps": [
+        {
+          "node": "libvirt-3-format",
+          "name": "c"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "c"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.json
new file mode 100644
index 0000000000..dc87dd60b8
--- /dev/null
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.json
@@ -0,0 +1,59 @@
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "c",
+      "persistent": true,
+      "disabled": true,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-1-format",
+      "target": "c",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "d"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "d"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-enable",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "c"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-2-format",
+      "target": "c",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "d"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "d"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json
new file mode 100644
index 0000000000..45a84b47c2
--- /dev/null
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json
@@ -0,0 +1,23 @@
+[
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "a"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "a"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "a"
+    }
+  }
+]
-- 
2.25.0