[libvirt] [PATCH 18/24] tests: qemumonitorjson: Add data and fix 'same-backing' node detection case

Peter Krempa pkrempa at redhat.com
Wed Jul 26 10:00:48 UTC 2017


With the new approach we are actually able to correctly detect node
names for the two instances of the same backing file.
---
 ...nitorjson-nodename-same-backing-blockstats.json | 221 +++++++++++++++++++++
 ...itorjson-nodename-same-backing-named-nodes.json |  16 +-
 .../qemumonitorjson-nodename-same-backing.result   |  28 ++-
 tests/qemumonitorjsontest.c                        |   2 +-
 4 files changed, 252 insertions(+), 15 deletions(-)
 create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-blockstats.json

diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-blockstats.json
new file mode 100644
index 000000000..7fd238301
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-blockstats.json
@@ -0,0 +1,221 @@
+[
+    {
+      "device": "drive-sata0-0-0",
+      "parent": {
+        "stats": {
+          "flush_total_time_ns": 0,
+          "wr_highest_offset": 0,
+          "wr_total_time_ns": 0,
+          "failed_wr_operations": 0,
+          "failed_rd_operations": 0,
+          "wr_merged": 0,
+          "wr_bytes": 0,
+          "timed_stats": [
+
+          ],
+          "failed_flush_operations": 0,
+          "account_invalid": false,
+          "rd_total_time_ns": 0,
+          "flush_operations": 0,
+          "wr_operations": 0,
+          "rd_merged": 0,
+          "rd_bytes": 0,
+          "invalid_flush_operations": 0,
+          "account_failed": false,
+          "rd_operations": 0,
+          "invalid_wr_operations": 0,
+          "invalid_rd_operations": 0
+        },
+        "node-name": "#block020"
+      },
+      "stats": {
+        "flush_total_time_ns": 0,
+        "wr_highest_offset": 0,
+        "wr_total_time_ns": 0,
+        "failed_wr_operations": 0,
+        "failed_rd_operations": 0,
+        "wr_merged": 0,
+        "wr_bytes": 0,
+        "timed_stats": [
+
+        ],
+        "failed_flush_operations": 0,
+        "account_invalid": true,
+        "rd_total_time_ns": 290083,
+        "flush_operations": 0,
+        "wr_operations": 0,
+        "rd_merged": 0,
+        "rd_bytes": 512,
+        "invalid_flush_operations": 0,
+        "account_failed": true,
+        "idle_time_ns": 74812730779,
+        "rd_operations": 1,
+        "invalid_wr_operations": 0,
+        "invalid_rd_operations": 0
+      },
+      "backing": {
+        "parent": {
+          "stats": {
+            "flush_total_time_ns": 0,
+            "wr_highest_offset": 0,
+            "wr_total_time_ns": 0,
+            "failed_wr_operations": 0,
+            "failed_rd_operations": 0,
+            "wr_merged": 0,
+            "wr_bytes": 0,
+            "timed_stats": [
+
+            ],
+            "failed_flush_operations": 0,
+            "account_invalid": false,
+            "rd_total_time_ns": 0,
+            "flush_operations": 0,
+            "wr_operations": 0,
+            "rd_merged": 0,
+            "rd_bytes": 0,
+            "invalid_flush_operations": 0,
+            "account_failed": false,
+            "rd_operations": 0,
+            "invalid_wr_operations": 0,
+            "invalid_rd_operations": 0
+          },
+          "node-name": "#block224"
+        },
+        "stats": {
+          "flush_total_time_ns": 0,
+          "wr_highest_offset": 0,
+          "wr_total_time_ns": 0,
+          "failed_wr_operations": 0,
+          "failed_rd_operations": 0,
+          "wr_merged": 0,
+          "wr_bytes": 0,
+          "timed_stats": [
+
+          ],
+          "failed_flush_operations": 0,
+          "account_invalid": false,
+          "rd_total_time_ns": 0,
+          "flush_operations": 0,
+          "wr_operations": 0,
+          "rd_merged": 0,
+          "rd_bytes": 0,
+          "invalid_flush_operations": 0,
+          "account_failed": false,
+          "rd_operations": 0,
+          "invalid_wr_operations": 0,
+          "invalid_rd_operations": 0
+        },
+        "node-name": "#block320"
+      },
+      "node-name": "#block132"
+    },
+    {
+      "device": "drive-sata0-0-1",
+      "parent": {
+        "stats": {
+          "flush_total_time_ns": 0,
+          "wr_highest_offset": 0,
+          "wr_total_time_ns": 0,
+          "failed_wr_operations": 0,
+          "failed_rd_operations": 0,
+          "wr_merged": 0,
+          "wr_bytes": 0,
+          "timed_stats": [
+
+          ],
+          "failed_flush_operations": 0,
+          "account_invalid": false,
+          "rd_total_time_ns": 0,
+          "flush_operations": 0,
+          "wr_operations": 0,
+          "rd_merged": 0,
+          "rd_bytes": 0,
+          "invalid_flush_operations": 0,
+          "account_failed": false,
+          "rd_operations": 0,
+          "invalid_wr_operations": 0,
+          "invalid_rd_operations": 0
+        },
+        "node-name": "#block487"
+      },
+      "stats": {
+        "flush_total_time_ns": 0,
+        "wr_highest_offset": 0,
+        "wr_total_time_ns": 0,
+        "failed_wr_operations": 0,
+        "failed_rd_operations": 0,
+        "wr_merged": 0,
+        "wr_bytes": 0,
+        "timed_stats": [
+
+        ],
+        "failed_flush_operations": 0,
+        "account_invalid": true,
+        "rd_total_time_ns": 0,
+        "flush_operations": 0,
+        "wr_operations": 0,
+        "rd_merged": 0,
+        "rd_bytes": 0,
+        "invalid_flush_operations": 0,
+        "account_failed": true,
+        "rd_operations": 0,
+        "invalid_wr_operations": 0,
+        "invalid_rd_operations": 0
+      },
+      "backing": {
+        "parent": {
+          "stats": {
+            "flush_total_time_ns": 0,
+            "wr_highest_offset": 0,
+            "wr_total_time_ns": 0,
+            "failed_wr_operations": 0,
+            "failed_rd_operations": 0,
+            "wr_merged": 0,
+            "wr_bytes": 0,
+            "timed_stats": [
+
+            ],
+            "failed_flush_operations": 0,
+            "account_invalid": false,
+            "rd_total_time_ns": 0,
+            "flush_operations": 0,
+            "wr_operations": 0,
+            "rd_merged": 0,
+            "rd_bytes": 0,
+            "invalid_flush_operations": 0,
+            "account_failed": false,
+            "rd_operations": 0,
+            "invalid_wr_operations": 0,
+            "invalid_rd_operations": 0
+          },
+          "node-name": "#block692"
+        },
+        "stats": {
+          "flush_total_time_ns": 0,
+          "wr_highest_offset": 0,
+          "wr_total_time_ns": 0,
+          "failed_wr_operations": 0,
+          "failed_rd_operations": 0,
+          "wr_merged": 0,
+          "wr_bytes": 0,
+          "timed_stats": [
+
+          ],
+          "failed_flush_operations": 0,
+          "account_invalid": false,
+          "rd_total_time_ns": 0,
+          "flush_operations": 0,
+          "wr_operations": 0,
+          "rd_merged": 0,
+          "rd_bytes": 0,
+          "invalid_flush_operations": 0,
+          "account_failed": false,
+          "rd_operations": 0,
+          "invalid_wr_operations": 0,
+          "invalid_rd_operations": 0
+        },
+        "node-name": "#block771"
+      },
+      "node-name": "#block548"
+    }
+  ]
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-named-nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-named-nodes.json
index 78954bb25..3945ff5ed 100644
--- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-named-nodes.json
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-named-nodes.json
@@ -21,7 +21,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block729",
+      "node-name": "#block771",
       "backing_file_depth": 0,
       "drv": "qcow2",
       "iops": 0,
@@ -50,7 +50,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block628",
+      "node-name": "#block692",
       "backing_file_depth": 0,
       "drv": "file",
       "iops": 0,
@@ -109,7 +109,7 @@
       },
       "iops_wr": 0,
       "ro": false,
-      "node-name": "#block574",
+      "node-name": "#block548",
       "backing_file_depth": 1,
       "drv": "qcow2",
       "iops": 0,
@@ -139,7 +139,7 @@
       },
       "iops_wr": 0,
       "ro": false,
-      "node-name": "#block405",
+      "node-name": "#block487",
       "backing_file_depth": 0,
       "drv": "file",
       "iops": 0,
@@ -178,7 +178,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block399",
+      "node-name": "#block320",
       "backing_file_depth": 0,
       "drv": "qcow2",
       "iops": 0,
@@ -207,7 +207,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block257",
+      "node-name": "#block224",
       "backing_file_depth": 0,
       "drv": "file",
       "iops": 0,
@@ -266,7 +266,7 @@
       },
       "iops_wr": 0,
       "ro": false,
-      "node-name": "#block170",
+      "node-name": "#block132",
       "backing_file_depth": 1,
       "drv": "qcow2",
       "iops": 0,
@@ -296,7 +296,7 @@
       },
       "iops_wr": 0,
       "ro": false,
-      "node-name": "#block057",
+      "node-name": "#block020",
       "backing_file_depth": 0,
       "drv": "file",
       "iops": 0,
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result
index 3ad8423a3..87431f7ca 100644
--- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result
@@ -1,7 +1,23 @@
-filename    : '/var/lib/libvirt/images/a.qcow2'
-format node : '#block170'
-storage node: '#block057'
-
+drive-sata0-0-1
 filename    : '/var/lib/libvirt/images/b.qcow2'
-format node : '#block574'
-storage node: '#block405'
+format node : '#block548'
+format drv  : 'qcow2'
+storage node: '#block487'
+storage drv : 'file'
+  filename    : '/var/lib/libvirt/images/base.qcow2'
+  format node : '#block771'
+  format drv  : 'qcow2'
+  storage node: '#block692'
+  storage drv : 'file'
+
+drive-sata0-0-0
+filename    : '/var/lib/libvirt/images/a.qcow2'
+format node : '#block132'
+format drv  : 'qcow2'
+storage node: '#block020'
+storage drv : 'file'
+  filename    : '/var/lib/libvirt/images/base.qcow2'
+  format node : '#block320'
+  format drv  : 'qcow2'
+  storage node: '#block224'
+  storage drv : 'file'
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 346d5c401..e85cf7b24 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2927,7 +2927,7 @@ mymain(void)
     } while (0)

     DO_TEST_BLOCK_NODE_DETECT("basic");
-/*    DO_TEST_BLOCK_NODE_DETECT("same-backing"); */
+    DO_TEST_BLOCK_NODE_DETECT("same-backing");
 /*    DO_TEST_BLOCK_NODE_DETECT("relative"); */
 /*    DO_TEST_BLOCK_NODE_DETECT("gluster"); */

-- 
2.13.2




More information about the libvir-list mailing list