From 9b03ffc7a48f15627651a179b7a71d228d05b685 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 26 Jul 2017 10:27:57 +0200 Subject: [PATCH] tests: qemumonitorjson: Add data and fix 'same-backing' node detection case With the new approach we are actually able to correctly detect node names for the two instances of the same backing file. Test images were created as: qemu-img create -f qcow2 /var/lib/libvirt/images/base.qcow2 10M qemu-img create -f qcow2 \ -o "backing_fmt=qcow2,backing_file=/var/lib/libvirt/images/base.qcow2 \ /var/lib/libvirt/images/a.qcow2 qemu-img create -f qcow2 \ -o "backing_fmt=qcow2,backing_file=/var/lib/libvirt/images/base.qcow2 \ /var/lib/libvirt/images/b.qcow2 and then used for two separate disks. Reviewed-by: Eric Blake --- ...json-nodename-same-backing-blockstats.json | 221 ++++++++++++++++++ ...son-nodename-same-backing-named-nodes.json | 16 +- ...mumonitorjson-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 0000000000..7fd2383013 --- /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 78954bb253..3945ff5ed8 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 3ad8423a3f..87431f7ca2 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 346d5c401e..e85cf7b249 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"); */