render / rpms / libvirt

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