[libvirt] [PATCH 19/24] tests: qemumonitorjson: Fix 'relative' node name detection test case

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


Add the blockstats data and fix the expected output.
---
 ...mumonitorjson-nodename-relative-blockstats.json | 329 +++++++++++++++++++++
 ...umonitorjson-nodename-relative-named-nodes.json |  26 +-
 .../qemumonitorjson-nodename-relative.result       |  44 ++-
 tests/qemumonitorjsontest.c                        |   2 +-
 4 files changed, 372 insertions(+), 29 deletions(-)
 create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-blockstats.json

diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-blockstats.json
new file mode 100644
index 000000000..9838ad1a7
--- /dev/null
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-blockstats.json
@@ -0,0 +1,329 @@
+[
+    {
+      "device": "drive-ide0-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": "#block092"
+      },
+      "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": 61904,
+        "flush_operations": 0,
+        "wr_operations": 0,
+        "rd_merged": 0,
+        "rd_bytes": 512,
+        "invalid_flush_operations": 0,
+        "account_failed": true,
+        "idle_time_ns": 309814663943,
+        "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": "#block232"
+        },
+        "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
+        },
+        "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": "#block442"
+          },
+          "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
+          },
+          "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": "#block614"
+            },
+            "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": "#block797"
+          },
+          "node-name": "#block548"
+        },
+        "node-name": "#block346"
+      },
+      "node-name": "#block118"
+    },
+    {
+      "device": "drive-ide0-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": "#block1107"
+      },
+      "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": "#block800"
+        },
+        "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": "#block927"
+      },
+      "node-name": "#block1290"
+    }
+]
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-named-nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-named-nodes.json
index 1fee149ac..2fcc3b47e 100644
--- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-named-nodes.json
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-named-nodes.json
@@ -41,7 +41,7 @@
       },
       "iops_wr": 0,
       "ro": false,
-      "node-name": "#block1177",
+      "node-name": "#block1290",
       "backing_file_depth": 1,
       "drv": "qcow2",
       "iops": 0,
@@ -71,7 +71,7 @@
       },
       "iops_wr": 0,
       "ro": false,
-      "node-name": "#block1027",
+      "node-name": "#block1107",
       "backing_file_depth": 0,
       "drv": "file",
       "iops": 0,
@@ -110,7 +110,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block957",
+      "node-name": "#block927",
       "backing_file_depth": 0,
       "drv": "qcow2",
       "iops": 0,
@@ -139,7 +139,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block840",
+      "node-name": "#block800",
       "backing_file_depth": 0,
       "drv": "file",
       "iops": 0,
@@ -178,7 +178,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block709",
+      "node-name": "#block797",
       "backing_file_depth": 0,
       "drv": "qcow2",
       "iops": 0,
@@ -207,7 +207,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block665",
+      "node-name": "#block614",
       "backing_file_depth": 0,
       "drv": "file",
       "iops": 0,
@@ -266,7 +266,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block514",
+      "node-name": "#block548",
       "backing_file_depth": 1,
       "drv": "qcow2",
       "iops": 0,
@@ -296,7 +296,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block481",
+      "node-name": "#block442",
       "backing_file_depth": 0,
       "drv": "file",
       "iops": 0,
@@ -375,7 +375,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block357",
+      "node-name": "#block346",
       "backing_file_depth": 2,
       "drv": "qcow2",
       "iops": 0,
@@ -405,7 +405,7 @@
       },
       "iops_wr": 0,
       "ro": true,
-      "node-name": "#block290",
+      "node-name": "#block232",
       "backing_file_depth": 0,
       "drv": "file",
       "iops": 0,
@@ -504,7 +504,7 @@
       },
       "iops_wr": 0,
       "ro": false,
-      "node-name": "#block153",
+      "node-name": "#block118",
       "backing_file_depth": 3,
       "drv": "qcow2",
       "iops": 0,
@@ -534,7 +534,7 @@
       },
       "iops_wr": 0,
       "ro": false,
-      "node-name": "#block076",
+      "node-name": "#block092",
       "backing_file_depth": 0,
       "drv": "file",
       "iops": 0,
@@ -551,4 +551,4 @@
       "file": "/var/lib/libvirt/images/img3",
       "encryption_key_missing": false
     }
-  ]
+]
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result
index 27d9652c6..6c0c77618 100644
--- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result
@@ -1,19 +1,33 @@
+drive-ide0-0-1
+filename    : '/var/lib/libvirt/images/relsnap.qcow2'
+format node : '#block1290'
+format drv  : 'qcow2'
+storage node: '#block1107'
+storage drv : 'file'
+  filename    : '/var/lib/libvirt/images/base.qcow2'
+  format node : '#block927'
+  format drv  : 'qcow2'
+  storage node: '#block800'
+  storage drv : 'file'
+
+drive-ide0-0-0
 filename    : '/var/lib/libvirt/images/img3'
-format node : '#block153'
-storage node: '#block076'
+format node : '#block118'
+format drv  : 'qcow2'
+storage node: '#block092'
+storage drv : 'file'
   filename    : '/var/lib/libvirt/images/img2'
-  format node : '#block357'
-  storage node: '#block290'
+  format node : '#block346'
+  format drv  : 'qcow2'
+  storage node: '#block232'
+  storage drv : 'file'
     filename    : '/var/lib/libvirt/images/img1'
-    format node : '#block514'
-    storage node: '#block481'
+    format node : '#block548'
+    format drv  : 'qcow2'
+    storage node: '#block442'
+    storage drv : 'file'
       filename    : '/var/lib/libvirt/images/img0'
-      format node : '#block709'
-      storage node: '#block665'
-
-filename    : '/var/lib/libvirt/images/relsnap.qcow2'
-format node : '#block1177'
-storage node: '#block1027'
-  filename    : '/var/lib/libvirt/images/base.qcow2'
-  format node : '#block957'
-  storage node: '#block840'
+      format node : '#block797'
+      format drv  : 'qcow2'
+      storage node: '#block614'
+      storage drv : 'file'
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index e85cf7b24..2b10a75cd 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2928,7 +2928,7 @@ mymain(void)

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

 #undef DO_TEST_BLOCK_NODE_DETECT
-- 
2.13.2




More information about the libvir-list mailing list