render / rpms / libvirt

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