render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
a41c76
From 5694a24b527b812e7236a7316271f4ae316e4caa Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <5694a24b527b812e7236a7316271f4ae316e4caa@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 4 Feb 2020 15:08:13 +0100
a41c76
Subject: [PATCH] tests: qemublock: Add checkpoint deletion test for deep
a41c76
 backing chain
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Add test cases for merging various pairs of bitmaps when snapshots were
a41c76
created together with checkpoints.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 3c1c35bada75052b73d224d80fb5c3747a664823)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1207659
a41c76
Message-Id: <06d3c8ebd023583de6c9d5033fc38a2757ecf8e2.1580824112.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 tests/qemublocktest.c                         |  6 ++
a41c76
 .../snapshots-current-out.json                | 29 +++++++++
a41c76
 .../snapshots-intermediate1-out.json          | 22 +++++++
a41c76
 .../snapshots-intermediate2-out.json          | 59 +++++++++++++++++++
a41c76
 .../snapshots-intermediate3-out.json          | 59 +++++++++++++++++++
a41c76
 .../snapshots-noparent-out.json               | 23 ++++++++
a41c76
 6 files changed, 198 insertions(+)
a41c76
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json
a41c76
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.json
a41c76
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.json
a41c76
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.json
a41c76
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json
a41c76
a41c76
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
a41c76
index e56f813424..897b86f970 100644
a41c76
--- a/tests/qemublocktest.c
a41c76
+++ b/tests/qemublocktest.c
a41c76
@@ -1015,6 +1015,12 @@ mymain(void)
a41c76
     TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate3", "d", "c", "basic");
a41c76
     TEST_CHECKPOINT_DELETE_MERGE("basic-current", "current", "d", "basic");
a41c76
 
a41c76
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-noparent", "a", NULL, "snapshots");
a41c76
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate1", "b", "a", "snapshots");
a41c76
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate2", "c", "b", "snapshots");
a41c76
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate3", "d", "c", "snapshots");
a41c76
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-current", "current", "d", "snapshots");
a41c76
+
a41c76
  cleanup:
a41c76
     virHashFree(diskxmljsondata.schema);
a41c76
     qemuTestDriverFree(&driver);
a41c76
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json
a41c76
new file mode 100644
a41c76
index 0000000000..1b607567e8
a41c76
--- /dev/null
a41c76
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json
a41c76
@@ -0,0 +1,29 @@
a41c76
+[
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-enable",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-1-format",
a41c76
+      "name": "d"
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-merge",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-1-format",
a41c76
+      "target": "d",
a41c76
+      "bitmaps": [
a41c76
+        {
a41c76
+          "node": "libvirt-1-format",
a41c76
+          "name": "current"
a41c76
+        }
a41c76
+      ]
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-remove",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-1-format",
a41c76
+      "name": "current"
a41c76
+    }
a41c76
+  }
a41c76
+]
a41c76
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.json
a41c76
new file mode 100644
a41c76
index 0000000000..29fefeea63
a41c76
--- /dev/null
a41c76
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.json
a41c76
@@ -0,0 +1,22 @@
a41c76
+[
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-merge",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-3-format",
a41c76
+      "target": "a",
a41c76
+      "bitmaps": [
a41c76
+        {
a41c76
+          "node": "libvirt-3-format",
a41c76
+          "name": "b"
a41c76
+        }
a41c76
+      ]
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-remove",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-3-format",
a41c76
+      "name": "b"
a41c76
+    }
a41c76
+  }
a41c76
+]
a41c76
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.json
a41c76
new file mode 100644
a41c76
index 0000000000..4da21a9df7
a41c76
--- /dev/null
a41c76
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.json
a41c76
@@ -0,0 +1,59 @@
a41c76
+[
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-add",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-2-format",
a41c76
+      "name": "b",
a41c76
+      "persistent": true,
a41c76
+      "disabled": true,
a41c76
+      "granularity": 65536
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-merge",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-2-format",
a41c76
+      "target": "b",
a41c76
+      "bitmaps": [
a41c76
+        {
a41c76
+          "node": "libvirt-2-format",
a41c76
+          "name": "c"
a41c76
+        }
a41c76
+      ]
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-remove",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-2-format",
a41c76
+      "name": "c"
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-enable",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-3-format",
a41c76
+      "name": "b"
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-merge",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-3-format",
a41c76
+      "target": "b",
a41c76
+      "bitmaps": [
a41c76
+        {
a41c76
+          "node": "libvirt-3-format",
a41c76
+          "name": "c"
a41c76
+        }
a41c76
+      ]
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-remove",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-3-format",
a41c76
+      "name": "c"
a41c76
+    }
a41c76
+  }
a41c76
+]
a41c76
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.json
a41c76
new file mode 100644
a41c76
index 0000000000..dc87dd60b8
a41c76
--- /dev/null
a41c76
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.json
a41c76
@@ -0,0 +1,59 @@
a41c76
+[
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-add",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-1-format",
a41c76
+      "name": "c",
a41c76
+      "persistent": true,
a41c76
+      "disabled": true,
a41c76
+      "granularity": 65536
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-merge",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-1-format",
a41c76
+      "target": "c",
a41c76
+      "bitmaps": [
a41c76
+        {
a41c76
+          "node": "libvirt-1-format",
a41c76
+          "name": "d"
a41c76
+        }
a41c76
+      ]
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-remove",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-1-format",
a41c76
+      "name": "d"
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-enable",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-2-format",
a41c76
+      "name": "c"
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-merge",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-2-format",
a41c76
+      "target": "c",
a41c76
+      "bitmaps": [
a41c76
+        {
a41c76
+          "node": "libvirt-2-format",
a41c76
+          "name": "d"
a41c76
+        }
a41c76
+      ]
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-remove",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-2-format",
a41c76
+      "name": "d"
a41c76
+    }
a41c76
+  }
a41c76
+]
a41c76
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json
a41c76
new file mode 100644
a41c76
index 0000000000..45a84b47c2
a41c76
--- /dev/null
a41c76
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json
a41c76
@@ -0,0 +1,23 @@
a41c76
+[
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-remove",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-3-format",
a41c76
+      "name": "a"
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-remove",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-4-format",
a41c76
+      "name": "a"
a41c76
+    }
a41c76
+  },
a41c76
+  {
a41c76
+    "type": "block-dirty-bitmap-remove",
a41c76
+    "data": {
a41c76
+      "node": "libvirt-5-format",
a41c76
+      "name": "a"
a41c76
+    }
a41c76
+  }
a41c76
+]
a41c76
-- 
a41c76
2.25.0
a41c76