render / rpms / libvirt

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