]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: qemublock: Add checkpoint deletion tests for some special cases
authorPeter Krempa <pkrempa@redhat.com>
Thu, 9 Jan 2020 15:37:43 +0000 (16:37 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 4 Feb 2020 12:45:32 +0000 (13:45 +0100)
Use the synthetic test data to verify that the algorithm correctly picks
bitmaps to merge when the bitmap is changed along with the image itself.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemublocktest.c
tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-current-out.json [new file with mode: 0644]
tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate1-out.json [new file with mode: 0644]
tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate2-out.json [new file with mode: 0644]
tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate3-out.json [new file with mode: 0644]
tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-noparent-out.json [new file with mode: 0644]

index bd5982878499d87d759ab5f3d248923981556da9..8f290452062ff81c7959506eed397a61e7c95f91 100644 (file)
@@ -1025,6 +1025,13 @@ mymain(void)
     TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate3", "d", "c", "snapshots");
     TEST_CHECKPOINT_DELETE_MERGE("snapshots-current", "current", "d", "snapshots");
 
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-noparent", "a", NULL, "snapshots-synthetic-checkpoint");
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-intermediate1", "b", "a", "snapshots-synthetic-checkpoint");
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-intermediate2", "c", "b", "snapshots-synthetic-checkpoint");
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-intermediate3", "d", "c", "snapshots-synthetic-checkpoint");
+    TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-current", "current", "d", "snapshots-synthetic-checkpoint");
+
+
  cleanup:
     virHashFree(diskxmljsondata.schema);
     qemuTestDriverFree(&driver);
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-current-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-current-out.json
new file mode 100644 (file)
index 0000000..1b60756
--- /dev/null
@@ -0,0 +1,29 @@
+[
+  {
+    "type": "block-dirty-bitmap-enable",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "d"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-1-format",
+      "target": "d",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "current"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "current"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate1-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate1-out.json
new file mode 100644 (file)
index 0000000..e979691
--- /dev/null
@@ -0,0 +1,29 @@
+[
+  {
+    "type": "block-dirty-bitmap-enable",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "a"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-3-format",
+      "target": "a",
+      "bitmaps": [
+        {
+          "node": "libvirt-3-format",
+          "name": "b"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "b"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate2-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate2-out.json
new file mode 100644 (file)
index 0000000..e820989
--- /dev/null
@@ -0,0 +1,32 @@
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "b",
+      "persistent": true,
+      "disabled": true,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-2-format",
+      "target": "b",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "c"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "c"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate3-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-intermediate3-out.json
new file mode 100644 (file)
index 0000000..dc87dd6
--- /dev/null
@@ -0,0 +1,59 @@
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "c",
+      "persistent": true,
+      "disabled": true,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-1-format",
+      "target": "c",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "d"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-1-format",
+      "name": "d"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-enable",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "c"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-2-format",
+      "target": "c",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "d"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "d"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-noparent-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoint-noparent-out.json
new file mode 100644 (file)
index 0000000..45a84b4
--- /dev/null
@@ -0,0 +1,23 @@
+[
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "a"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "a"
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "a"
+    }
+  }
+]