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 <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2017-07-26 10:27:57 +02:00
parent c03e52af57
commit 9b03ffc7a4
4 changed files with 252 additions and 15 deletions

View File

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

View File

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

View File

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

View File

@ -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"); */