render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
d76c62
From 686c7592b99c1e2c4831f14c4e101a4ab039c45e Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <686c7592b99c1e2c4831f14c4e101a4ab039c45e@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Tue, 4 Feb 2020 15:08:14 +0100
d76c62
Subject: [PATCH] tests: qemublock: Add checkpoint deletion tests for some
d76c62
 special cases
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Use the synthetic test data to verify that the algorithm correctly picks
d76c62
bitmaps to merge when the bitmap is changed along with the image itself.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
(cherry picked from commit 065e548ebf0e39c8f9d30d0637ecfa84803d8f98)
d76c62
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1207659
d76c62
Message-Id: <c34b7a28b9943b6cf7546eb2ac4d4bf95a164f11.1580824112.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 tests/qemublocktest.c                         |  7 +++
d76c62
 ...hots-synthetic-checkpoint-current-out.json | 29 +++++++++
d76c62
 ...ynthetic-checkpoint-intermediate1-out.json | 29 +++++++++
d76c62
 ...ynthetic-checkpoint-intermediate2-out.json | 32 ++++++++++
d76c62
 ...ynthetic-checkpoint-intermediate3-out.json | 59 +++++++++++++++++++
d76c62
 ...ots-synthetic-checkpoint-noparent-out.json | 23 ++++++++
d76c62
 6 files changed, 179 insertions(+)
d76c62
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-current-out.json
d76c62
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate1-out.json
d76c62
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate2-out.json
d76c62
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate3-out.json
d76c62
 create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-noparent-out.json
d76c62
d76c62
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
d76c62
index 897b86f970..2e5927f3c1 100644
d76c62
--- a/tests/qemublocktest.c
d76c62
+++ b/tests/qemublocktest.c
d76c62
@@ -1021,6 +1021,13 @@ mymain(void)
d76c62
     TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate3", "d", "c", "snapshots");
d76c62
     TEST_CHECKPOINT_DELETE_MERGE("snapshots-current", "current", "d", "snapshots");
d76c62
 
d76c62
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-noparent", "a", NULL, "snapshots-synthetic-checkpoint");
d76c62
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-intermediate1", "b", "a", "snapshots-synthetic-checkpoint");
d76c62
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-intermediate2", "c", "b", "snapshots-synthetic-checkpoint");
d76c62
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-intermediate3", "d", "c", "snapshots-synthetic-checkpoint");
d76c62
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-current", "current", "d", "snapshots-synthetic-checkpoint");
d76c62
+
d76c62
+
d76c62
  cleanup:
d76c62
     virHashFree(diskxmljsondata.schema);
d76c62
     qemuTestDriverFree(&driver);
d76c62
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-current-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-current-out.json
d76c62
new file mode 100644
d76c62
index 0000000000..1b607567e8
d76c62
--- /dev/null
d76c62
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-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-synthetic-checkpoint-intermediate1-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate1-out.json
d76c62
new file mode 100644
d76c62
index 0000000000..e979691e6f
d76c62
--- /dev/null
d76c62
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate1-out.json
d76c62
@@ -0,0 +1,29 @@
d76c62
+[
d76c62
+  {
d76c62
+    "type": "block-dirty-bitmap-enable",
d76c62
+    "data": {
d76c62
+      "node": "libvirt-3-format",
d76c62
+      "name": "a"
d76c62
+    }
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-synthetic-checkpoint-intermediate2-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate2-out.json
d76c62
new file mode 100644
d76c62
index 0000000000..e82098918a
d76c62
--- /dev/null
d76c62
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate2-out.json
d76c62
@@ -0,0 +1,32 @@
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
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate3-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate3-out.json
d76c62
new file mode 100644
d76c62
index 0000000000..dc87dd60b8
d76c62
--- /dev/null
d76c62
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-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-synthetic-checkpoint-noparent-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-noparent-out.json
d76c62
new file mode 100644
d76c62
index 0000000000..45a84b47c2
d76c62
--- /dev/null
d76c62
+++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-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