[RFC PATCH 38/41] qemublocktest: Add 'snapshots' tests for block commit bitmap handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simulate commit between all the combinations of layers in the
'snapshots' case to see whether the code merges the correct bitmaps with
the correct depth of temporary bitmaps.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/qemublocktest.c                         |  14 ++
 .../bitmapblockcommit/snapshots-1-2           |  37 +++++
 .../bitmapblockcommit/snapshots-1-3           |  70 +++++++++
 .../bitmapblockcommit/snapshots-1-4           | 141 ++++++++++++++++++
 .../bitmapblockcommit/snapshots-1-5           | 141 ++++++++++++++++++
 .../bitmapblockcommit/snapshots-2-3           |  26 ++++
 .../bitmapblockcommit/snapshots-2-4           |  82 ++++++++++
 .../bitmapblockcommit/snapshots-2-5           |  82 ++++++++++
 .../bitmapblockcommit/snapshots-3-4           |  49 ++++++
 .../bitmapblockcommit/snapshots-3-5           |  49 ++++++
 .../bitmapblockcommit/snapshots-4-5           |   1 +
 11 files changed, 692 insertions(+)
 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-2
 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-3
 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-4
 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-5
 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-2-3
 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-2-4
 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-2-5
 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-3-4
 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-3-5
 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-4-5

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index d1148ec02e..8706f1a5ec 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -1369,6 +1369,20 @@ mymain(void)
     TEST_BITMAP_BLOCKCOMMIT("basic-1-3", 1, 3, "basic");
     TEST_BITMAP_BLOCKCOMMIT("basic-2-3", 2, 3, "basic");

+    TEST_BITMAP_BLOCKCOMMIT("snapshots-1-2", 1, 2, "snapshots");
+    TEST_BITMAP_BLOCKCOMMIT("snapshots-1-3", 1, 3, "snapshots");
+    TEST_BITMAP_BLOCKCOMMIT("snapshots-1-4", 1, 4, "snapshots");
+    TEST_BITMAP_BLOCKCOMMIT("snapshots-1-5", 1, 5, "snapshots");
+
+    TEST_BITMAP_BLOCKCOMMIT("snapshots-2-3", 2, 3, "snapshots");
+    TEST_BITMAP_BLOCKCOMMIT("snapshots-2-4", 2, 4, "snapshots");
+    TEST_BITMAP_BLOCKCOMMIT("snapshots-2-5", 2, 5, "snapshots");
+
+    TEST_BITMAP_BLOCKCOMMIT("snapshots-3-4", 3, 4, "snapshots");
+    TEST_BITMAP_BLOCKCOMMIT("snapshots-3-5", 3, 5, "snapshots");
+
+    TEST_BITMAP_BLOCKCOMMIT("snapshots-4-5", 4, 5, "snapshots");
+
  cleanup:
     qemuTestDriverFree(&driver);
     VIR_FREE(capslatest_x86_64);
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-2 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-2
new file mode 100644
index 0000000000..70aa9608c7
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-2
@@ -0,0 +1,37 @@
+merge bitmpas:
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "current",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-2-format",
+      "target": "current",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "current"
+        },
+        {
+          "node": "libvirt-2-format",
+          "name": "libvirt-tmp-activewrite"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-2-format",
+      "name": "libvirt-tmp-activewrite"
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-3 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-3
new file mode 100644
index 0000000000..a223ef998e
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-3
@@ -0,0 +1,70 @@
+merge bitmpas:
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "current",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-3-format",
+      "target": "current",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "current"
+        },
+        {
+          "node": "libvirt-3-format",
+          "name": "libvirt-tmp-activewrite"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "d",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-3-format",
+      "target": "d",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-2-format",
+          "name": "d"
+        },
+        {
+          "node": "libvirt-3-format",
+          "name": "libvirt-tmp-activewrite"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "libvirt-tmp-activewrite"
+    }
+  }
+]
+allocation bitmap:
+libvirt-1-format
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-4 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-4
new file mode 100644
index 0000000000..497dd093d1
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-4
@@ -0,0 +1,141 @@
+merge bitmpas:
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "current",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "current",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "current"
+        },
+        {
+          "node": "libvirt-4-format",
+          "name": "libvirt-tmp-activewrite"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "d",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "d",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-2-format",
+          "name": "d"
+        },
+        {
+          "node": "libvirt-4-format",
+          "name": "libvirt-tmp-activewrite"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "b",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "b",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-2-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-3-format",
+          "name": "b"
+        },
+        {
+          "node": "libvirt-4-format",
+          "name": "libvirt-tmp-activewrite"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "c",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "c",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-2-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-3-format",
+          "name": "c"
+        },
+        {
+          "node": "libvirt-4-format",
+          "name": "libvirt-tmp-activewrite"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "libvirt-tmp-activewrite"
+    }
+  }
+]
+allocation bitmap:
+libvirt-2-format
+libvirt-1-format
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-5
new file mode 100644
index 0000000000..301a814856
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-5
@@ -0,0 +1,141 @@
+merge bitmpas:
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "current",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "current",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "current"
+        },
+        {
+          "node": "libvirt-5-format",
+          "name": "libvirt-tmp-activewrite"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "d",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "d",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-2-format",
+          "name": "d"
+        },
+        {
+          "node": "libvirt-5-format",
+          "name": "libvirt-tmp-activewrite"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "b",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "b",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-2-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-3-format",
+          "name": "b"
+        },
+        {
+          "node": "libvirt-5-format",
+          "name": "libvirt-tmp-activewrite"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "c",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "c",
+      "bitmaps": [
+        {
+          "node": "libvirt-1-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-2-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-3-format",
+          "name": "c"
+        },
+        {
+          "node": "libvirt-5-format",
+          "name": "libvirt-tmp-activewrite"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-remove",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "libvirt-tmp-activewrite"
+    }
+  }
+]
+allocation bitmap:
+libvirt-2-format
+libvirt-1-format
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-3 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-3
new file mode 100644
index 0000000000..e20c5aa2e9
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-3
@@ -0,0 +1,26 @@
+merge bitmpas:
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-3-format",
+      "name": "d",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-3-format",
+      "target": "d",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "d"
+        }
+      ]
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-4 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-4
new file mode 100644
index 0000000000..73a86d2e5d
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-4
@@ -0,0 +1,82 @@
+merge bitmpas:
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "d",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "d",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "d"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "b",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "b",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-3-format",
+          "name": "b"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "c",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "c",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-3-format",
+          "name": "c"
+        }
+      ]
+    }
+  }
+]
+allocation bitmap:
+libvirt-2-format
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-5
new file mode 100644
index 0000000000..9b68cca2c8
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-5
@@ -0,0 +1,82 @@
+merge bitmpas:
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "d",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "d",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "d"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "b",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "b",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-3-format",
+          "name": "b"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "c",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "c",
+      "bitmaps": [
+        {
+          "node": "libvirt-2-format",
+          "name": "libvirt-tmp-allocation"
+        },
+        {
+          "node": "libvirt-3-format",
+          "name": "c"
+        }
+      ]
+    }
+  }
+]
+allocation bitmap:
+libvirt-2-format
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-4 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-4
new file mode 100644
index 0000000000..237b659429
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-4
@@ -0,0 +1,49 @@
+merge bitmpas:
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "b",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "b",
+      "bitmaps": [
+        {
+          "node": "libvirt-3-format",
+          "name": "b"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-4-format",
+      "name": "c",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-4-format",
+      "target": "c",
+      "bitmaps": [
+        {
+          "node": "libvirt-3-format",
+          "name": "c"
+        }
+      ]
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-5
new file mode 100644
index 0000000000..827b26e36f
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-5
@@ -0,0 +1,49 @@
+merge bitmpas:
+[
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "b",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "b",
+      "bitmaps": [
+        {
+          "node": "libvirt-3-format",
+          "name": "b"
+        }
+      ]
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-add",
+    "data": {
+      "node": "libvirt-5-format",
+      "name": "c",
+      "persistent": true,
+      "disabled": false,
+      "granularity": 65536
+    }
+  },
+  {
+    "type": "block-dirty-bitmap-merge",
+    "data": {
+      "node": "libvirt-5-format",
+      "target": "c",
+      "bitmaps": [
+        {
+          "node": "libvirt-3-format",
+          "name": "c"
+        }
+      ]
+    }
+  }
+]
diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-4-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-4-5
new file mode 100644
index 0000000000..9260011852
--- /dev/null
+++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-4-5
@@ -0,0 +1 @@
+merge bitmpas:
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux