tests: qemumonitorjson: Fix 'relative' node name detection test case

Add the blockstats data and fix the expected output.

Test data was created as:

qemu-img create -f qcow2 img0 10M
qemu-img create -f qcow2 -o "backing_fmt=qcow2,backing_file=img0" img1
qemu-img create -f qcow2 -o "backing_fmt=qcow2,backing_file=img1" img2
...

Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2017-07-26 10:30:18 +02:00
parent 9b03ffc7a4
commit 18c5c93dc0
4 changed files with 374 additions and 31 deletions

View File

@ -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"
}
]

View File

@ -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
}
]
]

View File

@ -1,19 +1,33 @@
filename : '/var/lib/libvirt/images/img3'
format node : '#block153'
storage node: '#block076'
filename : '/var/lib/libvirt/images/img2'
format node : '#block357'
storage node: '#block290'
filename : '/var/lib/libvirt/images/img1'
format node : '#block514'
storage node: '#block481'
filename : '/var/lib/libvirt/images/img0'
format node : '#block709'
storage node: '#block665'
drive-ide0-0-1
filename : '/var/lib/libvirt/images/relsnap.qcow2'
format node : '#block1177'
storage node: '#block1027'
format node : '#block1290'
format drv : 'qcow2'
storage node: '#block1107'
storage drv : 'file'
filename : '/var/lib/libvirt/images/base.qcow2'
format node : '#block957'
storage node: '#block840'
format node : '#block927'
format drv : 'qcow2'
storage node: '#block800'
storage drv : 'file'
drive-ide0-0-0
filename : '/var/lib/libvirt/images/img3'
format node : '#block118'
format drv : 'qcow2'
storage node: '#block092'
storage drv : 'file'
filename : '/var/lib/libvirt/images/img2'
format node : '#block346'
format drv : 'qcow2'
storage node: '#block232'
storage drv : 'file'
filename : '/var/lib/libvirt/images/img1'
format node : '#block548'
format drv : 'qcow2'
storage node: '#block442'
storage drv : 'file'
filename : '/var/lib/libvirt/images/img0'
format node : '#block797'
format drv : 'qcow2'
storage node: '#block614'
storage drv : 'file'

View File

@ -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