[libvirt] [PATCH 00/24] qemu: refactor node name detection

Since query-blockstats provides full hierarchy of node names without any doubtful matching algorithm, use it to make the node name detector reliable. Unfortunately some of the changes are ugly when viewed as a diff since they delete and rewrite chunks of code. This series can be fetched at: git fetch git://pipo.sk/pipo/libvirt.git node-name-detect-refactor-1 Peter Krempa (24): qemu: monitor: Extract call of 'query-blockstats' and add new API for it tests: qemumonitorjson: Consolidate basic node name detection test cases tests: qemumonitor: Prepare for more test data in testBlockNodeNameDetect tests: qemumonitorjson: Drop redundant data from testBlockNodeNameDetectFormat tests: utils: Don't calculate file size in virTestLoadFile util: buffer: Add virBufferStrcatVArgs tests: utils: Add virTestLoadFilePath helper tests: qemuhelp: convert to virTestLoadFilePath tests: utils: Add virTestLoadFileJSON helper tests: qemumonitorjson: simplify path handling in testBlockNodeNameDetect tests: qemumontitorjson: temporarily disable node name detection tests qemu: block: Rename qemuBlockFillNodeData and move it to the top util: storagefile: rename 'nodebacking' to 'nodestorage' in virStorageSource qemu: block: Refactor node name detection code tests: Extract mock library for making hash table deterministic tests: qemumonitorjson: Simplify node name detection test qemu: block: store and test driver names for detected storage nodes tests: qemumonitorjson: Add data and fix 'same-backing' node detection case tests: qemumonitorjson: Fix 'relative' node name detection test case tests: qemumonitorjson: Fix 'gluster' node name detection test case tests: qemumonitorjson: Add test case for node name detection with blockjob tests: qemumonitorjson: Old and empty test case for node name detection tests: qemumonitorjson: Test extraction of LUKS node names tests: qemumonitorjson: Test extraction of iSCSI device node names src/libvirt_private.syms | 1 + src/qemu/qemu_block.c | 344 ++- src/qemu/qemu_block.h | 12 +- src/qemu/qemu_driver.c | 10 +- src/qemu/qemu_monitor.c | 15 + src/qemu/qemu_monitor.h | 2 + src/qemu/qemu_monitor_json.c | 44 +- src/qemu/qemu_monitor_json.h | 2 + src/util/virbuffer.c | 27 +- src/util/virbuffer.h | 2 + src/util/virstoragefile.c | 6 +- src/util/virstoragefile.h | 2 +- tests/Makefile.am | 17 +- tests/qemuhelptest.c | 14 +- .../qemumonitorjson-nodename-1.result | 15 - .../qemumonitorjson-nodename-2.json | 2270 -------------------- .../qemumonitorjson-nodename-2.result | 60 - .../qemumonitorjson-nodename-basic-blockstats.json | 166 ++ ...emumonitorjson-nodename-basic-named-nodes.json} | 18 +- .../qemumonitorjson-nodename-basic.result | 16 + ...mumonitorjson-nodename-blockjob-blockstats.json | 301 +++ ...umonitorjson-nodename-blockjob-named-nodes.json | 682 ++++++ .../qemumonitorjson-nodename-blockjob.result | 26 + .../qemumonitorjson-nodename-empty-blockstats.json | 2 + ...qemumonitorjson-nodename-empty-named-nodes.json | 2 + .../qemumonitorjson-nodename-empty.result | 1 + ...emumonitorjson-nodename-gluster-blockstats.json | 111 + ...umonitorjson-nodename-gluster-named-nodes.json} | 90 +- .../qemumonitorjson-nodename-gluster.result | 19 +- .../qemumonitorjson-nodename-iscsi-blockstats.json | 113 + ...qemumonitorjson-nodename-iscsi-named-nodes.json | 114 + .../qemumonitorjson-nodename-iscsi.result | 13 + .../qemumonitorjson-nodename-luks-blockstats.json | 58 + .../qemumonitorjson-nodename-luks-named-nodes.json | 109 + .../qemumonitorjson-nodename-luks.result | 6 + .../qemumonitorjson-nodename-old-blockstats.json | 160 ++ .../qemumonitorjson-nodename-old-named-nodes.json | 2 + .../qemumonitorjson-nodename-old.result | 1 + ...mumonitorjson-nodename-relative-blockstats.json | 329 +++ ...monitorjson-nodename-relative-named-nodes.json} | 26 +- .../qemumonitorjson-nodename-relative.result | 56 +- ...nitorjson-nodename-same-backing-blockstats.json | 221 ++ ...torjson-nodename-same-backing-named-nodes.json} | 16 +- .../qemumonitorjson-nodename-same-backing.result | 32 +- tests/qemumonitorjsontest.c | 97 +- tests/testutils.c | 101 +- tests/testutils.h | 6 + ...{virmacmapmock.c => virdeterministichashmock.c} | 0 tests/virmacmaptest.c | 2 +- 49 files changed, 2961 insertions(+), 2778 deletions(-) delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-1.result delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-2.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-2.result create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-blockstats.json rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-1.json => qemumonitorjson-nodename-basic-named-nodes.json} (96%) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob.result create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empty.result create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-gluster.json => qemumonitorjson-nodename-gluster-named-nodes.json} (89%) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks.result create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old.result create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-blockstats.json rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-relative.json => qemumonitorjson-nodename-relative-named-nodes.json} (97%) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-blockstats.json rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-same-backing.json => qemumonitorjson-nodename-same-backing-named-nodes.json} (96%) rename tests/{virmacmapmock.c => virdeterministichashmock.c} (100%) -- 2.13.2

Allow getting the raw data from query-blockstats, so that we can use it to detect the backing chain later on. --- src/qemu/qemu_monitor.c | 15 +++++++++++++++ src/qemu/qemu_monitor.h | 2 ++ src/qemu/qemu_monitor_json.c | 44 +++++++++++++++++++++++++++++--------------- src/qemu/qemu_monitor_json.h | 2 ++ 4 files changed, 48 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 2b0afcc21..19082d8bf 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2242,6 +2242,21 @@ qemuMonitorGetBlockInfo(qemuMonitorPtr mon) /** + * qemuMonitorQueryBlockstats: + * @mon: monitor object + * + * Returns data from a call to 'query-blockstats'. + */ +virJSONValuePtr +qemuMonitorQueryBlockstats(qemuMonitorPtr mon) +{ + QEMU_CHECK_MONITOR_JSON_NULL(mon); + + return qemuMonitorJSONQueryBlockstats(mon); +} + + +/** * qemuMonitorGetAllBlockStatsInfo: * @mon: monitor object * @ret_stats: pointer that is filled with a hash table containing the stats diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 1697db55c..31f7e97ba 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -523,6 +523,8 @@ int qemuMonitorSetMemoryStatsPeriod(qemuMonitorPtr mon, int qemuMonitorBlockIOStatusToError(const char *status); virHashTablePtr qemuMonitorGetBlockInfo(qemuMonitorPtr mon); +virJSONValuePtr qemuMonitorQueryBlockstats(qemuMonitorPtr mon); + typedef struct _qemuBlockStats qemuBlockStats; typedef qemuBlockStats *qemuBlockStatsPtr; struct _qemuBlockStats { diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 65b1fbb8e..b8a68154a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2061,34 +2061,49 @@ qemuMonitorJSONGetOneBlockStatsInfo(virJSONValuePtr dev, } -int -qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr mon, - virHashTablePtr hash, - bool backingChain) +virJSONValuePtr +qemuMonitorJSONQueryBlockstats(qemuMonitorPtr mon) { - int ret = -1; - int nstats = 0; - int rc; - size_t i; virJSONValuePtr cmd; virJSONValuePtr reply = NULL; - virJSONValuePtr devices; + virJSONValuePtr ret = NULL; if (!(cmd = qemuMonitorJSONMakeCommand("query-blockstats", NULL))) - return -1; + return NULL; - if ((rc = qemuMonitorJSONCommand(mon, cmd, &reply)) < 0) + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) goto cleanup; if (qemuMonitorJSONCheckError(cmd, reply) < 0) goto cleanup; - if (!(devices = virJSONValueObjectGetArray(reply, "return"))) { + if (!(ret = virJSONValueObjectStealArray(reply, "return"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats reply was missing device list")); + _("query-blockstats reply was missing device list")); goto cleanup; } + cleanup: + virJSONValueFree(cmd); + virJSONValueFree(reply); + return ret; +} + + +int +qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr mon, + virHashTablePtr hash, + bool backingChain) +{ + int ret = -1; + int nstats = 0; + int rc; + size_t i; + virJSONValuePtr devices; + + if (!(devices = qemuMonitorJSONQueryBlockstats(mon))) + return -1; + for (i = 0; i < virJSONValueArraySize(devices); i++) { virJSONValuePtr dev = virJSONValueArrayGet(devices, i); const char *dev_name; @@ -2120,8 +2135,7 @@ qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr mon, ret = nstats; cleanup: - virJSONValueFree(cmd); - virJSONValueFree(reply); + virJSONValueFree(devices); return ret; } diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index d090d5709..7462967b5 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -81,6 +81,8 @@ int qemuMonitorJSONSetMemoryStatsPeriod(qemuMonitorPtr mon, int period); int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon, virHashTablePtr table); + +virJSONValuePtr qemuMonitorJSONQueryBlockstats(qemuMonitorPtr mon); int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorPtr mon, virHashTablePtr hash, bool backingChain); -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
Allow getting the raw data from query-blockstats, so that we can use it to detect the backing chain later on. --- src/qemu/qemu_monitor.c | 15 +++++++++++++++ src/qemu/qemu_monitor.h | 2 ++ src/qemu/qemu_monitor_json.c | 44 +++++++++++++++++++++++++++++--------------- src/qemu/qemu_monitor_json.h | 2 ++ 4 files changed, 48 insertions(+), 15 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com> Basically, a refactoring that splits out a useful subset of the existing qemuMonitorJSONGetAllBlockStatsInfo() -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

Test cases named '1' and '2' differed only in the length of the backing chain, so remove test case '2' and rename test '1' to 'basic'. --- .../qemumonitorjson-nodename-2.json | 2270 -------------------- .../qemumonitorjson-nodename-2.result | 60 - ...-1.json => qemumonitorjson-nodename-basic.json} | 0 ...esult => qemumonitorjson-nodename-basic.result} | 0 tests/qemumonitorjsontest.c | 3 +- 5 files changed, 1 insertion(+), 2332 deletions(-) delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-2.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-2.result rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-1.json => qemumonitorjson-nodename-basic.json} (100%) rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-1.result => qemumonitorjson-nodename-basic.result} (100%) diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-2.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-2.json deleted file mode 100644 index 452b9d695..000000000 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-2.json +++ /dev/null @@ -1,2270 +0,0 @@ -[ - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block2399", - "backing_file_depth": 0, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.qcow2", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 9665380352, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "format": "file", - "actual-size": 9665384448, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block2281", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.qcow2", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block2157", - "backing_file_depth": 1, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "backing_file": "/var/lib/libvirt/images/rhel7.3.qcow2", - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483536402", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 197120, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "format": "file", - "actual-size": 200704, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block2008", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483536402", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "backing-image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 33099776, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block1979", - "backing_file_depth": 2, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "backing_file": "/var/lib/libvirt/images/rhel7.3.1483536402", - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483545313", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 33161216, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "format": "file", - "actual-size": 33099776, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block1814", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483545313", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "backing-image": { - "backing-image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 33099776, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block1799", - "backing_file_depth": 3, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "backing_file": "/var/lib/libvirt/images/rhel7.3.1483545313", - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483545901", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 197120, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "format": "file", - "actual-size": 200704, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block1690", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483545901", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 33099776, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block1528", - "backing_file_depth": 4, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "backing_file": "/var/lib/libvirt/images/rhel7.3.1483545901", - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483546244", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 197120, - "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "format": "file", - "actual-size": 200704, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block1427", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483546244", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 33099776, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 19472384, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block1350", - "backing_file_depth": 5, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "backing_file": "/var/lib/libvirt/images/rhel7.3.1483546244", - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483605920", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 19529728, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "format": "file", - "actual-size": 19472384, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block1204", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483605920", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 33099776, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 19472384, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "snapshots": [ - { - "vm-clock-nsec": 945245467, - "name": "1483615244", - "date-sec": 1483615244, - "date-nsec": 439285000, - "vm-clock-sec": 4, - "id": "1", - "vm-state-size": 7226413 - } - ], - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 7618560, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block1119", - "backing_file_depth": 6, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "backing_file": "/var/lib/libvirt/images/rhel7.3.1483605920", - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483605924", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 7798784, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "format": "file", - "actual-size": 7618560, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block1075", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483605924", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 33099776, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 19472384, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "snapshots": [ - { - "vm-clock-nsec": 945245467, - "name": "1483615244", - "date-sec": 1483615244, - "date-nsec": 439285000, - "vm-clock-sec": 4, - "id": "1", - "vm-state-size": 7226413 - } - ], - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 7618560, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "snapshots": [ - { - "vm-clock-nsec": 159182365, - "name": "1483615264", - "date-sec": 1483615264, - "date-nsec": 325173000, - "vm-clock-sec": 8, - "id": "1", - "vm-state-size": 151985953 - } - ], - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 163266560, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block998", - "backing_file_depth": 7, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "backing_file": "/var/lib/libvirt/images/rhel7.3.1483605924", - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483615252", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 163446784, - "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "format": "file", - "actual-size": 163266560, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block843", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1483615252", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 33099776, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 19472384, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "snapshots": [ - { - "vm-clock-nsec": 945245467, - "name": "1483615244", - "date-sec": 1483615244, - "date-nsec": 439285000, - "vm-clock-sec": 4, - "id": "1", - "vm-state-size": 7226413 - } - ], - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 7618560, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "snapshots": [ - { - "vm-clock-nsec": 159182365, - "name": "1483615264", - "date-sec": 1483615264, - "date-nsec": 325173000, - "vm-clock-sec": 8, - "id": "1", - "vm-state-size": 151985953 - } - ], - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 163266560, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 4132864, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block717", - "backing_file_depth": 8, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "backing_file": "/var/lib/libvirt/images/rhel7.3.1483615252", - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1484071872", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 4194304, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "format": "file", - "actual-size": 4132864, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block612", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1484071872", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 33099776, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 19472384, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "snapshots": [ - { - "vm-clock-nsec": 945245467, - "name": "1483615244", - "date-sec": 1483615244, - "date-nsec": 439285000, - "vm-clock-sec": 4, - "id": "1", - "vm-state-size": 7226413 - } - ], - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 7618560, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "snapshots": [ - { - "vm-clock-nsec": 159182365, - "name": "1483615264", - "date-sec": 1483615264, - "date-nsec": 325173000, - "vm-clock-sec": 8, - "id": "1", - "vm-state-size": 151985953 - } - ], - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 163266560, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 4132864, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071876", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block560", - "backing_file_depth": 9, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "backing_file": "/var/lib/libvirt/images/rhel7.3.1484071872", - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1484071876", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 197120, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071876", - "format": "file", - "actual-size": 200704, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block430", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1484071876", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 33099776, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 19472384, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "snapshots": [ - { - "vm-clock-nsec": 945245467, - "name": "1483615244", - "date-sec": 1483615244, - "date-nsec": 439285000, - "vm-clock-sec": 4, - "id": "1", - "vm-state-size": 7226413 - } - ], - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 7618560, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "snapshots": [ - { - "vm-clock-nsec": 159182365, - "name": "1483615264", - "date-sec": 1483615264, - "date-nsec": 325173000, - "vm-clock-sec": 8, - "id": "1", - "vm-state-size": 151985953 - } - ], - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 163266560, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 4132864, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071876", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071877", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 2560000, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071876", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071876", - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block316", - "backing_file_depth": 10, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "backing_file": "/var/lib/libvirt/images/rhel7.3.1484071876", - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1484071877", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 2621440, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071877", - "format": "file", - "actual-size": 2560000, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": true, - "node-name": "#block248", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1484071877", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 9665384448, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": true, - "refcount-bits": 16, - "corrupt": false - } - }, - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 33099776, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483536402", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545313", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483545901", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 19472384, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483546244", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "snapshots": [ - { - "vm-clock-nsec": 945245467, - "name": "1483615244", - "date-sec": 1483615244, - "date-nsec": 439285000, - "vm-clock-sec": 4, - "id": "1", - "vm-state-size": 7226413 - } - ], - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 7618560, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605920", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "snapshots": [ - { - "vm-clock-nsec": 159182365, - "name": "1483615264", - "date-sec": 1483615264, - "date-nsec": 325173000, - "vm-clock-sec": 8, - "id": "1", - "vm-state-size": 151985953 - } - ], - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 163266560, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483605924", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 4132864, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1483615252", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071876", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 200704, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071872", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071877", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 2560000, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071876", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071876", - "dirty-flag": false - }, - "backing-filename-format": "qcow2", - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071880", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 17440768, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071877", - "backing-filename": "/var/lib/libvirt/images/rhel7.3.1484071877", - "dirty-flag": false - }, - "iops_wr": 0, - "ro": false, - "node-name": "#block161", - "backing_file_depth": 11, - "drv": "qcow2", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "backing_file": "/var/lib/libvirt/images/rhel7.3.1484071877", - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1484071880", - "encryption_key_missing": false - }, - { - "iops_rd": 0, - "detect_zeroes": "off", - "image": { - "virtual-size": 17498112, - "filename": "/var/lib/libvirt/images/rhel7.3.1484071880", - "format": "file", - "actual-size": 17440768, - "dirty-flag": false - }, - "iops_wr": 0, - "ro": false, - "node-name": "#block013", - "backing_file_depth": 0, - "drv": "file", - "iops": 0, - "bps_wr": 0, - "write_threshold": 0, - "encrypted": false, - "bps": 0, - "bps_rd": 0, - "cache": { - "no-flush": false, - "direct": false, - "writeback": true - }, - "file": "/var/lib/libvirt/images/rhel7.3.1484071880", - "encryption_key_missing": false - } -] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-2.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-2.result deleted file mode 100644 index b6e1e2916..000000000 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-2.result +++ /dev/null @@ -1,60 +0,0 @@ -filename : '/var/lib/libvirt/images/rhel7.3.1484071880' -format node : '#block161' -storage node: '#block013' -backingfile : '/var/lib/libvirt/images/rhel7.3.1484071877' -backing ptr : '#block316' - filename : '/var/lib/libvirt/images/rhel7.3.1484071877' - format node : '#block316' - storage node: '#block248' - backingfile : '/var/lib/libvirt/images/rhel7.3.1484071876' - backing ptr : '#block560' - filename : '/var/lib/libvirt/images/rhel7.3.1484071876' - format node : '#block560' - storage node: '#block430' - backingfile : '/var/lib/libvirt/images/rhel7.3.1484071872' - backing ptr : '#block717' - filename : '/var/lib/libvirt/images/rhel7.3.1484071872' - format node : '#block717' - storage node: '#block612' - backingfile : '/var/lib/libvirt/images/rhel7.3.1483615252' - backing ptr : '#block998' - filename : '/var/lib/libvirt/images/rhel7.3.1483615252' - format node : '#block998' - storage node: '#block843' - backingfile : '/var/lib/libvirt/images/rhel7.3.1483605924' - backing ptr : '#block1119' - filename : '/var/lib/libvirt/images/rhel7.3.1483605924' - format node : '#block1119' - storage node: '#block1075' - backingfile : '/var/lib/libvirt/images/rhel7.3.1483605920' - backing ptr : '#block1350' - filename : '/var/lib/libvirt/images/rhel7.3.1483605920' - format node : '#block1350' - storage node: '#block1204' - backingfile : '/var/lib/libvirt/images/rhel7.3.1483546244' - backing ptr : '#block1528' - filename : '/var/lib/libvirt/images/rhel7.3.1483546244' - format node : '#block1528' - storage node: '#block1427' - backingfile : '/var/lib/libvirt/images/rhel7.3.1483545901' - backing ptr : '#block1799' - filename : '/var/lib/libvirt/images/rhel7.3.1483545901' - format node : '#block1799' - storage node: '#block1690' - backingfile : '/var/lib/libvirt/images/rhel7.3.1483545313' - backing ptr : '#block1979' - filename : '/var/lib/libvirt/images/rhel7.3.1483545313' - format node : '#block1979' - storage node: '#block1814' - backingfile : '/var/lib/libvirt/images/rhel7.3.1483536402' - backing ptr : '#block2157' - filename : '/var/lib/libvirt/images/rhel7.3.1483536402' - format node : '#block2157' - storage node: '#block2008' - backingfile : '/var/lib/libvirt/images/rhel7.3.qcow2' - backing ptr : '#block2399' - filename : '/var/lib/libvirt/images/rhel7.3.qcow2' - format node : '#block2399' - storage node: '#block2281' - backingfile : '<null>' - backing ptr : '<null>' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-1.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.json similarity index 100% rename from tests/qemumonitorjsondata/qemumonitorjson-nodename-1.json rename to tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.json diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-1.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result similarity index 100% rename from tests/qemumonitorjsondata/qemumonitorjson-nodename-1.result rename to tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 243f76469..c343c0d38 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2942,8 +2942,7 @@ mymain(void) ret = -1; \ } while (0) - DO_TEST_BLOCK_NODE_DETECT("1", "#block118"); - DO_TEST_BLOCK_NODE_DETECT("2", "#block161"); + DO_TEST_BLOCK_NODE_DETECT("basic", "#block118"); DO_TEST_BLOCK_NODE_DETECT("same-backing", "#block170,#block574"); DO_TEST_BLOCK_NODE_DETECT("relative", "#block153,#block1177"); DO_TEST_BLOCK_NODE_DETECT("gluster", "#block1008"); -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
Test cases named '1' and '2' differed only in the length of the backing chain, so remove test case '2' and rename test '1' to 'basic'. --- .../qemumonitorjson-nodename-2.json | 2270 -------------------- .../qemumonitorjson-nodename-2.result | 60 - ...-1.json => qemumonitorjson-nodename-basic.json} | 0 ...esult => qemumonitorjson-nodename-basic.result} | 0 tests/qemumonitorjsontest.c | 3 +- 5 files changed, 1 insertion(+), 2332 deletions(-) delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-2.json delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-2.result rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-1.json => qemumonitorjson-nodename-basic.json} (100%) rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-1.result => qemumonitorjson-nodename-basic.result} (100%)
Reviewed-by: Eric Blake <eblake@redhat.com>
- "image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "backing-image": { - "virtual-size": 9663676416, - "filename": "/var/lib/libvirt/images/rhel7.3.qcow2", - "cluster-size": 65536,
That qemu output is rather verbose. Here's hoping Kevin's plan to add a saner interface in 2.11 pans out! -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

Rename 'json' and related variables to 'nodeNameJson'. Also rename the test files along. This is a preparation for modifying how we detect node names which will require also data from 'query-blockstats'. --- ...emumonitorjson-nodename-basic-named-nodes.json} | 0 ...umonitorjson-nodename-gluster-named-nodes.json} | 0 ...monitorjson-nodename-relative-named-nodes.json} | 0 ...torjson-nodename-same-backing-named-nodes.json} | 0 tests/qemumonitorjsontest.c | 22 +++++++++++----------- 5 files changed, 11 insertions(+), 11 deletions(-) rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-basic.json => qemumonitorjson-nodename-basic-named-nodes.json} (100%) rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-gluster.json => qemumonitorjson-nodename-gluster-named-nodes.json} (100%) rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-relative.json => qemumonitorjson-nodename-relative-named-nodes.json} (100%) rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-same-backing.json => qemumonitorjson-nodename-same-backing-named-nodes.json} (100%) diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-named-nodes.json similarity index 100% rename from tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.json rename to tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-named-nodes.json diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-named-nodes.json similarity index 100% rename from tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.json rename to tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-named-nodes.json diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-named-nodes.json similarity index 100% rename from tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.json rename to tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-named-nodes.json diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-named-nodes.json similarity index 100% rename from tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.json rename to tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing-named-nodes.json diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index c343c0d38..5bab9f507 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2740,19 +2740,19 @@ static int testBlockNodeNameDetect(const void *opaque) { const struct testBlockNodeNameDetectData *data = opaque; - char *jsonFile = NULL; - char *jsonStr = NULL; + char *namedNodesFile = NULL; + char *namedNodesStr = NULL; char *resultFile = NULL; char *actual = NULL; char **nodenames = NULL; char **next; - virJSONValuePtr json = NULL; + virJSONValuePtr namedNodesJson = NULL; virHashTablePtr nodedata = NULL; virBuffer buf = VIR_BUFFER_INITIALIZER; int ret = -1; - if (virAsprintf(&jsonFile, - "%s/qemumonitorjsondata/qemumonitorjson-nodename-%s.json", + if (virAsprintf(&namedNodesFile, + "%s/qemumonitorjsondata/qemumonitorjson-nodename-%s-named-nodes.json", abs_srcdir, data->name) < 0 || virAsprintf(&resultFile, "%s/qemumonitorjsondata/qemumonitorjson-nodename-%s.result", @@ -2762,13 +2762,13 @@ testBlockNodeNameDetect(const void *opaque) if (!(nodenames = virStringSplit(data->nodenames, ",", 0))) goto cleanup; - if (virTestLoadFile(jsonFile, &jsonStr) < 0) + if (virTestLoadFile(namedNodesFile, &namedNodesStr) < 0) goto cleanup; - if (!(json = virJSONValueFromString(jsonStr))) + if (!(namedNodesJson = virJSONValueFromString(namedNodesStr))) goto cleanup; - if (!(nodedata = qemuBlockNodeNameGetBackingChain(json))) + if (!(nodedata = qemuBlockNodeNameGetBackingChain(namedNodesJson))) goto cleanup; for (next = nodenames; *next; next++) @@ -2787,13 +2787,13 @@ testBlockNodeNameDetect(const void *opaque) ret = 0; cleanup: - VIR_FREE(jsonFile); + VIR_FREE(namedNodesFile); VIR_FREE(resultFile); - VIR_FREE(jsonStr); + VIR_FREE(namedNodesStr); VIR_FREE(actual); virHashFree(nodedata); virStringListFree(nodenames); - virJSONValueFree(json); + virJSONValueFree(namedNodesJson); return ret; } -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
Rename 'json' and related variables to 'nodeNameJson'. Also rename the test files along. This is a preparation for modifying how we detect node names which will require also data from 'query-blockstats'.
s/require also/also require/
--- ...emumonitorjson-nodename-basic-named-nodes.json} | 0 ...umonitorjson-nodename-gluster-named-nodes.json} | 0 ...monitorjson-nodename-relative-named-nodes.json} | 0 ...torjson-nodename-same-backing-named-nodes.json} | 0 tests/qemumonitorjsontest.c | 22 +++++++++++----------- 5 files changed, 11 insertions(+), 11 deletions(-) rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-basic.json => qemumonitorjson-nodename-basic-named-nodes.json} (100%) rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-gluster.json => qemumonitorjson-nodename-gluster-named-nodes.json} (100%) rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-relative.json => qemumonitorjson-nodename-relative-named-nodes.json} (100%) rename tests/qemumonitorjsondata/{qemumonitorjson-nodename-same-backing.json => qemumonitorjson-nodename-same-backing-named-nodes.json} (100%)
Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

The node name and backing file name can be inferred from the hierarchy. This will also help when converting to detect node names using query-blockstats data. --- .../qemumonitorjson-nodename-basic.result | 6 ------ .../qemumonitorjson-nodename-gluster.result | 4 ---- .../qemumonitorjson-nodename-relative.result | 12 ------------ .../qemumonitorjson-nodename-same-backing.result | 4 ---- tests/qemumonitorjsontest.c | 4 ---- 5 files changed, 30 deletions(-) diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result index e43f3d366..992fc5165 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result @@ -1,15 +1,9 @@ filename : '/var/lib/libvirt/images/rhel7.3.1483545313' format node : '#block118' storage node: '#block078' -backingfile : '/var/lib/libvirt/images/rhel7.3.1483536402' -backing ptr : '#block331' filename : '/var/lib/libvirt/images/rhel7.3.1483536402' format node : '#block331' storage node: '#block281' - backingfile : '/var/lib/libvirt/images/rhel7.3.qcow2' - backing ptr : '#block567' filename : '/var/lib/libvirt/images/rhel7.3.qcow2' format node : '#block567' storage node: '#block424' - backingfile : '<null>' - backing ptr : '<null>' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.result index f38798d4b..d99576202 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.result +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.result @@ -1,10 +1,6 @@ filename : 'gluster://gluster-host/vol0/img1' format node : '#block1008' storage node: '#block981' -backingfile : 'gluster://gluster-host/vol0/img0' -backing ptr : '#block349' filename : 'gluster://gluster-host/vol0/img0' format node : '#block349' storage node: '#block269' - backingfile : '<null>' - backing ptr : '<null>' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result index 2cd908786..27d9652c6 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative.result @@ -1,31 +1,19 @@ filename : '/var/lib/libvirt/images/img3' format node : '#block153' storage node: '#block076' -backingfile : '/var/lib/libvirt/images/img2' -backing ptr : '#block357' filename : '/var/lib/libvirt/images/img2' format node : '#block357' storage node: '#block290' - backingfile : '/var/lib/libvirt/images/img1' - backing ptr : '#block514' filename : '/var/lib/libvirt/images/img1' format node : '#block514' storage node: '#block481' - backingfile : '/var/lib/libvirt/images/img0' - backing ptr : '#block709' filename : '/var/lib/libvirt/images/img0' format node : '#block709' storage node: '#block665' - backingfile : '<null>' - backing ptr : '<null>' filename : '/var/lib/libvirt/images/relsnap.qcow2' format node : '#block1177' storage node: '#block1027' -backingfile : '/var/lib/libvirt/images/base.qcow2' -backing ptr : '#block957' filename : '/var/lib/libvirt/images/base.qcow2' format node : '#block957' storage node: '#block840' - backingfile : '<null>' - backing ptr : '<null>' diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result index 2c774be27..3ad8423a3 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-same-backing.result @@ -1,11 +1,7 @@ filename : '/var/lib/libvirt/images/a.qcow2' format node : '#block170' storage node: '#block057' -backingfile : '/var/lib/libvirt/images/base.qcow2' -backing ptr : '<null>' filename : '/var/lib/libvirt/images/b.qcow2' format node : '#block574' storage node: '#block405' -backingfile : '/var/lib/libvirt/images/base.qcow2' -backing ptr : '<null>' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 5bab9f507..56a0a25e1 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2721,10 +2721,6 @@ testBlockNodeNameDetectFormat(virBufferPtr buf, NULLSTR(entry->nodeformat)); virBufferAsprintf(buf, "storage node: '%s'\n", NULLSTR(entry->nodestorage)); - virBufferAsprintf(buf, "backingfile : '%s'\n", - NULLSTR(entry->backingstore)); - virBufferAsprintf(buf, "backing ptr : '%s'\n", - NULLSTR(entry->nodebacking)); virBufferAdjustIndent(buf, 2); -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
The node name and backing file name can be inferred from the hierarchy. This will also help when converting to detect node names using query-blockstats data. --- .../qemumonitorjson-nodename-basic.result | 6 ------ .../qemumonitorjson-nodename-gluster.result | 4 ---- .../qemumonitorjson-nodename-relative.result | 12 ------------ .../qemumonitorjson-nodename-same-backing.result | 4 ---- tests/qemumonitorjsontest.c | 4 ---- 5 files changed, 30 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

The callers don't use it so don't waste a strlen(). Also fix the comment for the function. --- tests/testutils.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/testutils.c b/tests/testutils.c index ed01136a0..7f1c4672b 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -289,9 +289,17 @@ virTestRun(const char *title, return ret; } -/* Allocate BUF to the size of FILE. Read FILE into buffer BUF. - Upon any failure, diagnose it and return -1, but don't bother trying - to preserve errno. Otherwise, return the number of bytes copied into BUF. */ + +/** + * virTestLoadFile: + * @file: name of the file to load + * @buf: buffer to load the file into + * + * Allocates @buf to the size of FILE. Reads FILE into buffer BUF. + * Upon any failure, error is printed to stderr and -1 is returned. 'errno' is + * not preserved. On success 0 is returned. Caller is responsible for freeing + * @buf. + */ int virTestLoadFile(const char *file, char **buf) { @@ -345,7 +353,7 @@ virTestLoadFile(const char *file, char **buf) } VIR_FORCE_FCLOSE(fp); - return strlen(*buf); + return 0; } #ifndef WIN32 -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
The callers don't use it so don't waste a strlen(). Also fix the comment for the function. --- tests/testutils.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tests/testutils.c b/tests/testutils.c index ed01136a0..7f1c4672b 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -289,9 +289,17 @@ virTestRun(const char *title, return ret; }
-/* Allocate BUF to the size of FILE. Read FILE into buffer BUF. - Upon any failure, diagnose it and return -1, but don't bother trying - to preserve errno. Otherwise, return the number of bytes copied into BUF. */ + +/** + * virTestLoadFile: + * @file: name of the file to load + * @buf: buffer to load the file into + * + * Allocates @buf to the size of FILE. Reads FILE into buffer BUF. + * Upon any failure, error is printed to stderr and -1 is returned. 'errno' is + * not preserved. On success 0 is returned. Caller is responsible for freeing + * @buf. + */
Callers that know the file won't contain NUL bytes don't use the returned length, but if we ever want to parse a file that DOES contain NUL, then it becomes important. Then again, such a file is that much more annoying to store in git (it is treated as binary rather than text), so our testsuite is better off if it avoids files with NUL.
int virTestLoadFile(const char *file, char **buf) { @@ -345,7 +353,7 @@ virTestLoadFile(const char *file, char **buf) }
VIR_FORCE_FCLOSE(fp); - return strlen(*buf); + return 0;
And really, strlen() is wrong if you have embedded NUL bytes anyways, so it's pretty certain we weren't relying on a correct length for a file that contains NUL. So Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

Split out the worker loop into a separate function and export it. --- src/libvirt_private.syms | 1 + src/util/virbuffer.c | 27 +++++++++++++++++++++------ src/util/virbuffer.h | 2 ++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index fa2cd08fe..588b76b43 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1345,6 +1345,7 @@ virBufferFreeAndReset; virBufferGetIndent; virBufferSetIndent; virBufferStrcat; +virBufferStrcatVArgs; virBufferTrim; virBufferURIEncodeString; virBufferUse; diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c index f07b119c0..28a291bb0 100644 --- a/src/util/virbuffer.c +++ b/src/util/virbuffer.c @@ -831,6 +831,26 @@ virBufferEscapeShell(virBufferPtr buf, const char *str) } /** + * virBufferStrcatVArgs: + * @buf: the buffer to append to + * @ap: variable argument structure + * + * See virBufferStrcat. + */ +void +virBufferStrcatVArgs(virBufferPtr buf, + va_list ap) +{ + char *str; + + if (buf->error) + return; + + while ((str = va_arg(ap, char *)) != NULL) + virBufferAdd(buf, str, -1); +} + +/** * virBufferStrcat: * @buf: the buffer to append to * @...: the variable list of strings, the last argument must be NULL @@ -842,14 +862,9 @@ void virBufferStrcat(virBufferPtr buf, ...) { va_list ap; - char *str; - - if (buf->error) - return; va_start(ap, buf); - while ((str = va_arg(ap, char *)) != NULL) - virBufferAdd(buf, str, -1); + virBufferStrcatVArgs(buf, ap); va_end(ap); } diff --git a/src/util/virbuffer.h b/src/util/virbuffer.h index 7a7014aa7..f34217968 100644 --- a/src/util/virbuffer.h +++ b/src/util/virbuffer.h @@ -80,6 +80,8 @@ void virBufferVasprintf(virBufferPtr buf, const char *format, va_list ap) ATTRIBUTE_FMT_PRINTF(2, 0); void virBufferStrcat(virBufferPtr buf, ...) ATTRIBUTE_SENTINEL; +void virBufferStrcatVArgs(virBufferPtr buf, va_list ap); + void virBufferEscape(virBufferPtr buf, char escape, const char *toescape, const char *format, const char *str); void virBufferEscapeN(virBufferPtr buf, const char *format, -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
Split out the worker loop into a separate function and export it. --- src/libvirt_private.syms | 1 + src/util/virbuffer.c | 27 +++++++++++++++++++++------ src/util/virbuffer.h | 2 ++ 3 files changed, 24 insertions(+), 6 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

This new helper loads and returns a file from 'abs_srcdir'. By using variable arguments for the function, it's not necessary to format the path separately in the test cases. --- tests/testutils.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/testutils.h | 2 ++ 2 files changed, 53 insertions(+) diff --git a/tests/testutils.c b/tests/testutils.c index 7f1c4672b..f193cdf8b 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -356,6 +356,57 @@ virTestLoadFile(const char *file, char **buf) return 0; } + +static char * +virTestLoadFileGetPath(const char *p, + va_list ap) +{ + virBuffer buf = VIR_BUFFER_INITIALIZER; + char *path = NULL; + + virBufferAddLit(&buf, abs_srcdir "/"); + + if (p) { + virBufferAdd(&buf, p, -1); + virBufferStrcatVArgs(&buf, ap); + } + + if (!(path = virBufferContentAndReset(&buf))) + VIR_TEST_VERBOSE("failed to format file path"); + + return path; +} + + +/** + * virTestLoadFilePath: + * @...: file name components. + * + * Constructs the test file path from variable arguments and loads the file. + * 'abs_srcdir' is automatically prepended. + */ +char * +virTestLoadFilePath(const char *p, ...) +{ + char *path = NULL; + char *ret = NULL; + va_list ap; + + va_start(ap, p); + + if (!(path = virTestLoadFileGetPath(p, ap))) + goto cleanup; + + ignore_value(virTestLoadFile(path, &ret)); + + cleanup: + va_end(ap); + VIR_FREE(path); + + return ret; +} + + #ifndef WIN32 static void virTestCaptureProgramExecChild(const char *const argv[], diff --git a/tests/testutils.h b/tests/testutils.h index c7f02e468..98dfa990e 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -52,6 +52,8 @@ int virTestRun(const char *title, int (*body)(const void *data), const void *data); int virTestLoadFile(const char *file, char **buf); +char *virTestLoadFilePath(const char *p, ...) + ATTRIBUTE_SENTINEL; int virTestCaptureProgramOutput(const char *const argv[], char **buf, int maxlen); void virTestClearCommandPath(char *cmdset); -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
This new helper loads and returns a file from 'abs_srcdir'. By using variable arguments for the function, it's not necessary to format the path separately in the test cases. --- tests/testutils.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/testutils.h | 2 ++ 2 files changed, 53 insertions(+)
+ +/** + * virTestLoadFilePath: + * @...: file name components.
Mention that it must end in NULL...
+ * + * Constructs the test file path from variable arguments and loads the file. + * 'abs_srcdir' is automatically prepended. + */ +char * +virTestLoadFilePath(const char *p, ...)
and gcc has an attribute to mark vararg functions that require a NULL sentinel, to let the compiler enforce correct usage. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

On 07/26/2017 08:39 AM, Eric Blake wrote:
On 07/26/2017 05:00 AM, Peter Krempa wrote:
This new helper loads and returns a file from 'abs_srcdir'. By using variable arguments for the function, it's not necessary to format the path separately in the test cases. --- tests/testutils.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/testutils.h | 2 ++ 2 files changed, 53 insertions(+)
+ +/** + * virTestLoadFilePath: + * @...: file name components.
Mention that it must end in NULL...
+ * + * Constructs the test file path from variable arguments and loads the file. + * 'abs_srcdir' is automatically prepended. + */ +char * +virTestLoadFilePath(const char *p, ...)
and gcc has an attribute to mark vararg functions that require a NULL sentinel, to let the compiler enforce correct usage.
Looking back at the patch, I see you did use it, but that I missed it because it was must later in the email:
--- a/tests/testutils.h +++ b/tests/testutils.h @@ -52,6 +52,8 @@ int virTestRun(const char *title, int (*body)(const void *data), const void *data); int virTestLoadFile(const char *file, char **buf); +char *virTestLoadFilePath(const char *p, ...) + ATTRIBUTE_SENTINEL;
I like to use git's orderfile directive, so that my patches always list .h changes first (when reviewing, it's nicer to see the interface changes before the implementations); maybe libvirt should copy this idea from qemu: https://lists.gnu.org/archive/html/qemu-devel/2017-07/msg06438.html So I still think the comment should mention that the list must end in NULL, but with that, you can add Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

On Wed, Jul 26, 2017 at 10:46:56 -0500, Eric Blake wrote:
On 07/26/2017 08:39 AM, Eric Blake wrote:
On 07/26/2017 05:00 AM, Peter Krempa wrote:
This new helper loads and returns a file from 'abs_srcdir'. By using variable arguments for the function, it's not necessary to format the path separately in the test cases. --- tests/testutils.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/testutils.h | 2 ++ 2 files changed, 53 insertions(+)
[...]
--- a/tests/testutils.h +++ b/tests/testutils.h @@ -52,6 +52,8 @@ int virTestRun(const char *title, int (*body)(const void *data), const void *data); int virTestLoadFile(const char *file, char **buf); +char *virTestLoadFilePath(const char *p, ...) + ATTRIBUTE_SENTINEL;
I like to use git's orderfile directive, so that my patches always list .h changes first (when reviewing, it's nicer to see the interface changes before the implementations); maybe libvirt should copy this idea from qemu: https://lists.gnu.org/archive/html/qemu-devel/2017-07/msg06438.html
That is indeed useful. We can also de-prioritize utils and testsuite changes so that the driver changes pop out first.

As a sample usage of the new helper convert the calls in qemuhelptest to the new helper. --- tests/qemuhelptest.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index 7485d2dcd..1a6e7092f 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -44,7 +44,6 @@ static void printMismatchedFlags(virQEMUCapsPtr got, static int testHelpStrParsing(const void *data) { const struct testInfo *info = data; - char *path = NULL; char *help = NULL; unsigned int version, kvm_version; bool is_kvm; @@ -53,10 +52,7 @@ static int testHelpStrParsing(const void *data) char *got = NULL; char *expected = NULL; - if (virAsprintf(&path, "%s/qemuhelpdata/%s", abs_srcdir, info->name) < 0) - return -1; - - if (virTestLoadFile(path, &help) < 0) + if (!(help = virTestLoadFilePath("qemuhelpdata/", info->name, NULL))) goto cleanup; if (!(flags = virQEMUCapsNew())) @@ -76,13 +72,8 @@ static int testHelpStrParsing(const void *data) virQEMUCapsSet(flags, QEMU_CAPS_MONITOR_JSON); # endif - VIR_FREE(path); VIR_FREE(help); - if (virAsprintf(&path, "%s/qemuhelpdata/%s-device", abs_srcdir, - info->name) < 0) - goto cleanup; - - if (virTestLoadFile(path, &help) < 0) + if (!(help = virTestLoadFilePath("qemuhelpdata/", info->name, "-device", NULL))) goto cleanup; if (virQEMUCapsParseDeviceStr(flags, help) < 0) @@ -125,7 +116,6 @@ static int testHelpStrParsing(const void *data) ret = 0; cleanup: - VIR_FREE(path); VIR_FREE(help); virObjectUnref(flags); VIR_FREE(got); -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
As a sample usage of the new helper convert the calls in qemuhelptest to the new helper. --- tests/qemuhelptest.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
Nice! Reviewed-by: Eric Blake <eblake@redhat.com>
+ if (!(help = virTestLoadFilePath("qemuhelpdata/", info->name, "-device", NULL))) goto cleanup;
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

This new helper loads, parses and returns a JSON file from 'abs_srcdir' By using variable arguments for the function, it's not necessary to format the path separately in the test cases. --- tests/testutils.c | 34 ++++++++++++++++++++++++++++++++++ tests/testutils.h | 4 ++++ 2 files changed, 38 insertions(+) diff --git a/tests/testutils.c b/tests/testutils.c index f193cdf8b..75f69e1c3 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -407,6 +407,40 @@ virTestLoadFilePath(const char *p, ...) } +/** + * virTestLoadFileJSON: + * @...: name components + * + * Constructs the test file path from variable arguments and loads and parses + * the JSON file. 'abs_srcdir' is automatically prepended to the path. + */ +virJSONValuePtr +virTestLoadFileJSON(const char *p, ...) +{ + virJSONValuePtr ret = NULL; + char *jsonstr = NULL; + char *path = NULL; + va_list ap; + + va_start(ap, p); + + if (!(path = virTestLoadFileGetPath(p, ap))) + goto cleanup; + + if (virTestLoadFile(path, &jsonstr) < 0) + goto cleanup; + + if (!(ret = virJSONValueFromString(jsonstr))) + VIR_TEST_VERBOSE("failed to parse json from file '%s'", path); + + cleanup: + va_end(ap); + VIR_FREE(jsonstr); + VIR_FREE(path); + return ret; +} + + #ifndef WIN32 static void virTestCaptureProgramExecChild(const char *const argv[], diff --git a/tests/testutils.h b/tests/testutils.h index 98dfa990e..49649c4f5 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -27,6 +27,7 @@ # include "viralloc.h" # include "virfile.h" # include "virstring.h" +# include "virjson.h" # include "capabilities.h" # include "domain_conf.h" @@ -54,6 +55,9 @@ int virTestRun(const char *title, int virTestLoadFile(const char *file, char **buf); char *virTestLoadFilePath(const char *p, ...) ATTRIBUTE_SENTINEL; +virJSONValuePtr virTestLoadFileJSON(const char *p, ...) + ATTRIBUTE_SENTINEL; + int virTestCaptureProgramOutput(const char *const argv[], char **buf, int maxlen); void virTestClearCommandPath(char *cmdset); -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
This new helper loads, parses and returns a JSON file from 'abs_srcdir' By using variable arguments for the function, it's not necessary to format the path separately in the test cases. --- tests/testutils.c | 34 ++++++++++++++++++++++++++++++++++ tests/testutils.h | 4 ++++ 2 files changed, 38 insertions(+)
diff --git a/tests/testutils.c b/tests/testutils.c index f193cdf8b..75f69e1c3 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -407,6 +407,40 @@ virTestLoadFilePath(const char *p, ...) }
+/** + * virTestLoadFileJSON: + * @...: name components
Same comment as in 7/24: document that it must end in NULL. With that, Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

Extract the test prefix path into a variable and reuse virTestLoadFileJSON to load the sample json files rather than doing it manually. --- tests/qemumonitorjsontest.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 56a0a25e1..268c15f4b 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2736,8 +2736,7 @@ static int testBlockNodeNameDetect(const void *opaque) { const struct testBlockNodeNameDetectData *data = opaque; - char *namedNodesFile = NULL; - char *namedNodesStr = NULL; + const char *pathprefix = "qemumonitorjsondata/qemumonitorjson-nodename-"; char *resultFile = NULL; char *actual = NULL; char **nodenames = NULL; @@ -2747,21 +2746,15 @@ testBlockNodeNameDetect(const void *opaque) virBuffer buf = VIR_BUFFER_INITIALIZER; int ret = -1; - if (virAsprintf(&namedNodesFile, - "%s/qemumonitorjsondata/qemumonitorjson-nodename-%s-named-nodes.json", - abs_srcdir, data->name) < 0 || - virAsprintf(&resultFile, - "%s/qemumonitorjsondata/qemumonitorjson-nodename-%s.result", - abs_srcdir, data->name) < 0) + if (virAsprintf(&resultFile, "%s/%s%s.result", + abs_srcdir, pathprefix, data->name) < 0) goto cleanup; if (!(nodenames = virStringSplit(data->nodenames, ",", 0))) goto cleanup; - if (virTestLoadFile(namedNodesFile, &namedNodesStr) < 0) - goto cleanup; - - if (!(namedNodesJson = virJSONValueFromString(namedNodesStr))) + if (!(namedNodesJson = virTestLoadFileJSON(pathprefix, data->name, + "-named-nodes.json", NULL))) goto cleanup; if (!(nodedata = qemuBlockNodeNameGetBackingChain(namedNodesJson))) @@ -2783,9 +2776,7 @@ testBlockNodeNameDetect(const void *opaque) ret = 0; cleanup: - VIR_FREE(namedNodesFile); VIR_FREE(resultFile); - VIR_FREE(namedNodesStr); VIR_FREE(actual); virHashFree(nodedata); virStringListFree(nodenames); -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
Extract the test prefix path into a variable and reuse virTestLoadFileJSON to load the sample json files rather than doing it manually. --- tests/qemumonitorjsontest.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

To simplify the refactoring patches disable the tests. This will allow to add test data later. --- tests/qemumonitorjsontest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 268c15f4b..c3e86419d 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2930,9 +2930,9 @@ mymain(void) } while (0) DO_TEST_BLOCK_NODE_DETECT("basic", "#block118"); - DO_TEST_BLOCK_NODE_DETECT("same-backing", "#block170,#block574"); - DO_TEST_BLOCK_NODE_DETECT("relative", "#block153,#block1177"); - DO_TEST_BLOCK_NODE_DETECT("gluster", "#block1008"); +/* DO_TEST_BLOCK_NODE_DETECT("same-backing", "#block170,#block574"); */ +/* DO_TEST_BLOCK_NODE_DETECT("relative", "#block153,#block1177"); */ +/* DO_TEST_BLOCK_NODE_DETECT("gluster", "#block1008"); */ #undef DO_TEST_BLOCK_NODE_DETECT -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
To simplify the refactoring patches disable the tests. This will allow to add test data later.
s/to add/adding/ ("allow to VERB" is not idiomatic English; it's either "allow WHO to VERB", or the shorter "allow VERBing")
--- tests/qemumonitorjsontest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 268c15f4b..c3e86419d 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2930,9 +2930,9 @@ mymain(void) } while (0)
DO_TEST_BLOCK_NODE_DETECT("basic", "#block118"); - DO_TEST_BLOCK_NODE_DETECT("same-backing", "#block170,#block574"); - DO_TEST_BLOCK_NODE_DETECT("relative", "#block153,#block1177"); - DO_TEST_BLOCK_NODE_DETECT("gluster", "#block1008"); +/* DO_TEST_BLOCK_NODE_DETECT("same-backing", "#block170,#block574"); */ +/* DO_TEST_BLOCK_NODE_DETECT("relative", "#block153,#block1177"); */ +/* DO_TEST_BLOCK_NODE_DETECT("gluster", "#block1008"); */
#undef DO_TEST_BLOCK_NODE_DETECT
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

The same operation will become useful in other places so rename the function to be more generic and move it to the top so that it can be reused earlier in the file. --- src/qemu/qemu_block.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 22de70657..3afcbde94 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -27,6 +27,24 @@ #define VIR_FROM_THIS VIR_FROM_QEMU +static int +qemuBlockNamedNodesArrayToHash(size_t pos ATTRIBUTE_UNUSED, + virJSONValuePtr item, + void *opaque) +{ + virHashTablePtr table = opaque; + const char *name; + + if (!(name = virJSONValueObjectGetString(item, "node-name"))) + return 1; + + if (virHashAddEntry(table, name, item) < 0) + return -1; + + return 0; +} + + static void qemuBlockNodeNameBackingChainDataFree(qemuBlockNodeNameBackingChainDataPtr data) { @@ -384,24 +402,6 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, } -static int -qemuBlockFillNodeData(size_t pos ATTRIBUTE_UNUSED, - virJSONValuePtr item, - void *opaque) -{ - virHashTablePtr table = opaque; - const char *name; - - if (!(name = virJSONValueObjectGetString(item, "node-name"))) - return 1; - - if (virHashAddEntry(table, name, item) < 0) - return -1; - - return 0; -} - - /** * qemuBlockGetNodeData: * @data: JSON object returned from query-named-block-nodes @@ -419,7 +419,7 @@ qemuBlockGetNodeData(virJSONValuePtr data) if (!(ret = virHashCreate(50, virJSONValueHashFree))) return NULL; - if (virJSONValueArrayForeachSteal(data, qemuBlockFillNodeData, ret) < 0) + if (virJSONValueArrayForeachSteal(data, qemuBlockNamedNodesArrayToHash, ret) < 0) goto error; return ret; -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
The same operation will become useful in other places so rename the function to be more generic and move it to the top so that it can be reused earlier in the file. --- src/qemu/qemu_block.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 22de70657..3afcbde94 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -27,6 +27,24 @@ #define VIR_FROM_THIS VIR_FROM_QEMU
@@ -419,7 +419,7 @@ qemuBlockGetNodeData(virJSONValuePtr data) if (!(ret = virHashCreate(50, virJSONValueHashFree))) return NULL;
- if (virJSONValueArrayForeachSteal(data, qemuBlockFillNodeData, ret) < 0) + if (virJSONValueArrayForeachSteal(data, qemuBlockNamedNodesArrayToHash, ret) < 0)
Long line; worth wrapping? Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

Make it less confusing by naming the field which refers to the storage object as 'nodestorage'. --- src/qemu/qemu_block.c | 10 +++++----- src/qemu/qemu_driver.c | 10 +++++----- src/util/virstoragefile.c | 6 +++--- src/util/virstoragefile.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 3afcbde94..dc96a43e1 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -305,7 +305,7 @@ qemuBlockDiskClearDetectedNodes(virDomainDiskDefPtr disk) while (next) { VIR_FREE(next->nodeformat); - VIR_FREE(next->nodebacking); + VIR_FREE(next->nodestorage); next = next->backingStore; } @@ -321,22 +321,22 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk, virStorageSourcePtr src = disk->src; /* don't attempt the detection if the top level already has node names */ - if (!parentnode || src->nodeformat || src->nodebacking) + if (!parentnode || src->nodeformat || src->nodestorage) return 0; while (src && parentnode) { if (!(entry = virHashLookup(table, parentnode))) break; - if (src->nodeformat || src->nodebacking) { + if (src->nodeformat || src->nodestorage) { if (STRNEQ_NULLABLE(src->nodeformat, entry->nodeformat) || - STRNEQ_NULLABLE(src->nodebacking, entry->nodestorage)) + STRNEQ_NULLABLE(src->nodestorage, entry->nodestorage)) goto error; break; } else { if (VIR_STRDUP(src->nodeformat, entry->nodeformat) < 0 || - VIR_STRDUP(src->nodebacking, entry->nodestorage) < 0) + VIR_STRDUP(src->nodestorage, entry->nodestorage) < 0) goto error; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9c54571cf..fe65b5776 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19492,8 +19492,8 @@ qemuDomainGetStatsOneBlockNode(virDomainStatsRecordPtr record, unsigned long long tmp; int ret = -1; - if (src->nodebacking && - (data = virHashLookup(nodedata, src->nodebacking))) { + if (src->nodestorage && + (data = virHashLookup(nodedata, src->nodestorage))) { if (virJSONValueObjectGetNumberUlong(data, "write_threshold", &tmp) == 0 && tmp > 0) QEMU_ADD_BLOCK_PARAM_ULL(record, maxparams, block_idx, @@ -20676,18 +20676,18 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, if (!(src = qemuDomainGetStorageSourceByDevstr(dev, vm->def))) goto endjob; - if (!src->nodebacking && + if (!src->nodestorage && qemuBlockNodeNamesDetect(driver, vm, QEMU_ASYNC_JOB_NONE) < 0) goto endjob; - if (!src->nodebacking) { + if (!src->nodestorage) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("threshold currently can't be set for block device '%s'"), dev); goto endjob; } - if (VIR_STRDUP(nodename, src->nodebacking) < 0) + if (VIR_STRDUP(nodename, src->nodestorage) < 0) goto endjob; qemuDomainObjEnterMonitor(driver, vm); diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 0add4c146..fbc8245f3 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2050,7 +2050,7 @@ virStorageSourceCopy(const virStorageSource *src, VIR_STRDUP(ret->snapshot, src->snapshot) < 0 || VIR_STRDUP(ret->configFile, src->configFile) < 0 || VIR_STRDUP(ret->nodeformat, src->nodeformat) < 0 || - VIR_STRDUP(ret->nodebacking, src->nodebacking) < 0 || + VIR_STRDUP(ret->nodestorage, src->nodestorage) < 0 || VIR_STRDUP(ret->compat, src->compat) < 0) goto error; @@ -2271,7 +2271,7 @@ virStorageSourceClear(virStorageSourcePtr def) virStorageNetHostDefFree(def->nhosts, def->hosts); virStorageAuthDefFree(def->auth); - VIR_FREE(def->nodebacking); + VIR_FREE(def->nodestorage); VIR_FREE(def->nodeformat); virStorageSourceBackingStoreClear(def); @@ -3941,7 +3941,7 @@ virStorageSourceFindByNodeName(virStorageSourcePtr top, for (tmp = top; tmp; tmp = tmp->backingStore) { if ((tmp->nodeformat && STREQ(tmp->nodeformat, nodeName)) || - (tmp->nodebacking && STREQ(tmp->nodebacking, nodeName))) + (tmp->nodestorage && STREQ(tmp->nodestorage, nodeName))) return tmp; if (idx) diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index d1e8ffe07..6c388b1a5 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -279,7 +279,7 @@ struct _virStorageSource { /* metadata that allows identifying given storage source */ char *nodeformat; /* name of the format handler object */ - char *nodebacking; /* name of the backing storage object */ + char *nodestorage; /* name of the storage object */ }; -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
Make it less confusing by naming the field which refers to the storage object as 'nodestorage'. --- src/qemu/qemu_block.c | 10 +++++----- src/qemu/qemu_driver.c | 10 +++++----- src/util/virstoragefile.c | 6 +++--- src/util/virstoragefile.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-)
Yes, that's better. Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

Remove the complex and unreliable code which inferred the node name hierarchy only from data returned by 'query-named-block-nodes'. It turns out that query-blockstats contain the full hierarchy of nodes as perceived by qemu so the inference code is not necessary. In query blockstats, the 'parent' object corresponds to the storage behind a storage volume and 'backing' corresponds to the lower level of backing chain. Since all have node names this data can be really easily used to detect node names. In addition to the code refactoring the one remaining test case needed to be fixed along. --- src/qemu/qemu_block.c | 290 ++++++++------------- src/qemu/qemu_block.h | 10 +- .../qemumonitorjson-nodename-basic-blockstats.json | 166 ++++++++++++ ...qemumonitorjson-nodename-basic-named-nodes.json | 18 +- .../qemumonitorjson-nodename-basic.result | 12 +- tests/qemumonitorjsontest.c | 22 +- 6 files changed, 313 insertions(+), 205 deletions(-) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-blockstats.json diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index dc96a43e1..bca6965fa 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -48,20 +48,15 @@ qemuBlockNamedNodesArrayToHash(size_t pos ATTRIBUTE_UNUSED, static void qemuBlockNodeNameBackingChainDataFree(qemuBlockNodeNameBackingChainDataPtr data) { - size_t i; - if (!data) return; - for (i = 0; i < data->nelems; i++) - virJSONValueFree(data->elems[i]); - VIR_FREE(data->nodeformat); VIR_FREE(data->nodestorage); - VIR_FREE(data->nodebacking); VIR_FREE(data->qemufilename); - VIR_FREE(data->backingstore); + + qemuBlockNodeNameBackingChainDataFree(data->backing); VIR_FREE(data); } @@ -75,55 +70,10 @@ qemuBlockNodeNameBackingChainDataHashEntryFree(void *opaque, } -struct qemuBlockNodeNameGetBackingChainData { - virHashTablePtr table; - qemuBlockNodeNameBackingChainDataPtr *entries; - size_t nentries; -}; - - -static int -qemuBlockNodeNameDetectProcessByFilename(size_t pos ATTRIBUTE_UNUSED, - virJSONValuePtr item, - void *opaque) -{ - struct qemuBlockNodeNameGetBackingChainData *data = opaque; - qemuBlockNodeNameBackingChainDataPtr entry; - const char *file; - - if (!(file = virJSONValueObjectGetString(item, "file"))) - return 1; - - if (!(entry = virHashLookup(data->table, file))) { - if (VIR_ALLOC(entry) < 0) - return -1; - - if (VIR_APPEND_ELEMENT_COPY(data->entries, data->nentries, entry) < 0) { - VIR_FREE(entry); - return -1; - } - - if (VIR_STRDUP(entry->qemufilename, file) < 0) - return -1; - - if (virHashAddEntry(data->table, file, entry) < 0) - return -1; - } - - if (VIR_APPEND_ELEMENT(entry->elems, entry->nelems, item) < 0) - return -1; - - return 0; -} - - -static const char *qemuBlockDriversFormat[] = { - "qcow2", "raw", "qcow", "luks", "qed", "bochs", "cloop", "dmg", "parallels", - "vdi", "vhdx", "vmdk", "vpc", "vvfat", NULL}; -static const char *qemuBlockDriversStorage[] = { - "file", "iscsi", "nbd", "host_cdrom", "host_device", "ftp", "ftps", - "gluster", "http", "https", "nfs", "rbd", "sheepdog", "ssh", "tftp", NULL}; - +/* list of driver names of layers that qemu automatically adds into the + * backing chain */ +static const char *qemuBlockDriversBlockjob[] = { + "mirror_top", "commit_top", NULL }; static bool qemuBlockDriverMatch(const char *drvname, @@ -140,86 +90,110 @@ qemuBlockDriverMatch(const char *drvname, } +struct qemuBlockNodeNameGetBackingChainData { + virHashTablePtr nodenamestable; + virHashTablePtr disks; +}; + + static int -qemuBlockNodeNameDetectProcessExtract(qemuBlockNodeNameBackingChainDataPtr data) +qemuBlockNodeNameGetBackingChainBacking(virJSONValuePtr next, + virHashTablePtr nodenamestable, + qemuBlockNodeNameBackingChainDataPtr *nodenamedata) { - const char *drv; - const char *nodename; - const char *backingstore; - size_t i; + qemuBlockNodeNameBackingChainDataPtr data = NULL; + qemuBlockNodeNameBackingChainDataPtr backingdata = NULL; + virJSONValuePtr backing = virJSONValueObjectGetObject(next, "backing"); + virJSONValuePtr parent = virJSONValueObjectGetObject(next, "parent"); + virJSONValuePtr parentnodedata; + virJSONValuePtr nodedata; + const char *nodename = virJSONValueObjectGetString(next, "node-name"); + const char *drvname; + const char *parentnodename = NULL; + const char *filename = NULL; + int ret = -1; - /* Since the only way to construct the backing chain is to look up the files - * by file name, if two disks share a backing image we can't know which node - * belongs to which backing chain. Refuse to detect such chains. */ - if (data->nelems > 2) + if (!nodename) return 0; - for (i = 0; i < data->nelems; i++) { - drv = virJSONValueObjectGetString(data->elems[i], "drv"); - nodename = virJSONValueObjectGetString(data->elems[i], "node-name"); - backingstore = virJSONValueObjectGetString(data->elems[i], "backing_file"); + if ((nodedata = virHashLookup(nodenamestable, nodename)) && + (drvname = virJSONValueObjectGetString(nodedata, "drv"))) { + + /* qemu 2.9 reports layers in the backing chain which don't correspond + * to files. skip them */ + if (qemuBlockDriverMatch(drvname, qemuBlockDriversBlockjob)) { + if (backing) { + return qemuBlockNodeNameGetBackingChainBacking(backing, + nodenamestable, + nodenamedata); + } else { + return 0; + } + } + } - if (!drv || !nodename) - continue; + if (parent && + (parentnodename = virJSONValueObjectGetString(parent, "node-name"))) { + if ((parentnodedata = virHashLookup(nodenamestable, parentnodename))) + filename = virJSONValueObjectGetString(parentnodedata, "file"); + } - if (qemuBlockDriverMatch(drv, qemuBlockDriversFormat)) { - if (data->nodeformat) - continue; + if (VIR_ALLOC(data) < 0) + goto cleanup; - if (VIR_STRDUP(data->nodeformat, nodename) < 0) - return -1; + if (VIR_STRDUP(data->nodeformat, nodename) < 0 || + VIR_STRDUP(data->nodestorage, parentnodename) < 0 || + VIR_STRDUP(data->qemufilename, filename) < 0) + goto cleanup; - /* extract the backing store file name for the protocol layer */ - if (VIR_STRDUP(data->backingstore, backingstore) < 0) - return -1; - } else if (qemuBlockDriverMatch(drv, qemuBlockDriversStorage)) { - if (data->nodestorage) - continue; + if (backing && + qemuBlockNodeNameGetBackingChainBacking(backing, nodenamestable, + &backingdata) < 0) + goto cleanup; - if (VIR_STRDUP(data->nodestorage, nodename) < 0) - return -1; - } - } + VIR_STEAL_PTR(data->backing, backingdata); + VIR_STEAL_PTR(*nodenamedata, data); - return 0; + ret = 0; + + cleanup: + qemuBlockNodeNameBackingChainDataFree(data); + return ret; } static int -qemuBlockNodeNameDetectProcessLinkBacking(qemuBlockNodeNameBackingChainDataPtr data, - virHashTablePtr table) +qemuBlockNodeNameGetBackingChainDisk(size_t pos ATTRIBUTE_UNUSED, + virJSONValuePtr item, + void *opaque) { - qemuBlockNodeNameBackingChainDataPtr backing; - - if (!data->backingstore) - return 0; - - if (!(backing = virHashLookup(table, data->backingstore))) - return 0; - - if (VIR_STRDUP(data->nodebacking, backing->nodeformat) < 0) - return -1; + struct qemuBlockNodeNameGetBackingChainData *data = opaque; + const char *device = virJSONValueObjectGetString(item, "device"); + qemuBlockNodeNameBackingChainDataPtr devicedata = NULL; + int ret = -1; - return 0; -} + if (qemuBlockNodeNameGetBackingChainBacking(item, data->nodenamestable, + &devicedata) < 0) + goto cleanup; + if (devicedata && + virHashAddEntry(data->disks, device, devicedata) < 0) + goto cleanup; -static void -qemuBlockNodeNameGetBackingChainDataClearLookup(qemuBlockNodeNameBackingChainDataPtr data) -{ - size_t i; + devicedata = NULL; + ret = 1; /* we don't really want to steal @item */ - for (i = 0; i < data->nelems; i++) - virJSONValueFree(data->elems[i]); + cleanup: + qemuBlockNodeNameBackingChainDataFree(devicedata); - VIR_FREE(data->elems); - data->nelems = 0; + return ret; } /** * qemuBlockNodeNameGetBackingChain: - * @json: JSON array of data returned from 'query-named-block-nodes' + * @namednodes: JSON array of data returned from 'query-named-block-nodes' + * @blockstats: JSON array of data returned from 'query-blockstats' * * Tries to reconstruct the backing chain from @json to allow detection of * node names that were auto-assigned by qemu. This is a best-effort operation @@ -230,69 +204,40 @@ qemuBlockNodeNameGetBackingChainDataClearLookup(qemuBlockNodeNameBackingChainDat * Returns a hash table on success and NULL on failure. */ virHashTablePtr -qemuBlockNodeNameGetBackingChain(virJSONValuePtr json) +qemuBlockNodeNameGetBackingChain(virJSONValuePtr namednodes, + virJSONValuePtr blockstats) { struct qemuBlockNodeNameGetBackingChainData data; - virHashTablePtr nodetable = NULL; + virHashTablePtr namednodestable = NULL; + virHashTablePtr disks = NULL; virHashTablePtr ret = NULL; - size_t i; memset(&data, 0, sizeof(data)); - /* hash table keeps the entries accessible by the 'file' in qemu */ - if (!(data.table = virHashCreate(50, NULL))) + if (!(namednodestable = virHashCreate(50, virJSONValueHashFree))) goto cleanup; - /* first group the named entries by the 'file' field */ - if (virJSONValueArrayForeachSteal(json, - qemuBlockNodeNameDetectProcessByFilename, - &data) < 0) + if (virJSONValueArrayForeachSteal(namednodes, + qemuBlockNamedNodesArrayToHash, + namednodestable) < 0) goto cleanup; - /* extract the node names for the format and storage layer */ - for (i = 0; i < data.nentries; i++) { - if (qemuBlockNodeNameDetectProcessExtract(data.entries[i]) < 0) - goto cleanup; - } - - /* extract the node name for the backing file */ - for (i = 0; i < data.nentries; i++) { - if (qemuBlockNodeNameDetectProcessLinkBacking(data.entries[i], - data.table) < 0) - goto cleanup; - } - - /* clear JSON data necessary only for the lookup procedure */ - for (i = 0; i < data.nentries; i++) - qemuBlockNodeNameGetBackingChainDataClearLookup(data.entries[i]); - - /* create hash table hashed by the format node name */ - if (!(nodetable = virHashCreate(50, - qemuBlockNodeNameBackingChainDataHashEntryFree))) + if (!(disks = virHashCreate(50, qemuBlockNodeNameBackingChainDataHashEntryFree))) goto cleanup; - /* fill the entries */ - for (i = 0; i < data.nentries; i++) { - if (!data.entries[i]->nodeformat) - continue; - - if (virHashAddEntry(nodetable, data.entries[i]->nodeformat, - data.entries[i]) < 0) - goto cleanup; + data.nodenamestable = namednodestable; + data.disks = disks; - /* hash table steals the entry and then frees it by itself */ - data.entries[i] = NULL; - } + if (virJSONValueArrayForeachSteal(blockstats, + qemuBlockNodeNameGetBackingChainDisk, + &data) < 0) + goto cleanup; - VIR_STEAL_PTR(ret, nodetable); + VIR_STEAL_PTR(ret, disks); cleanup: - virHashFree(data.table); - virHashFree(nodetable); - for (i = 0; i < data.nentries; i++) - qemuBlockNodeNameBackingChainDataFree(data.entries[i]); - - VIR_FREE(data.entries); + virHashFree(namednodestable); + virHashFree(disks); return ret; } @@ -314,20 +259,19 @@ qemuBlockDiskClearDetectedNodes(virDomainDiskDefPtr disk) static int qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk, - const char *parentnode, - virHashTablePtr table) + virHashTablePtr disktable) { qemuBlockNodeNameBackingChainDataPtr entry = NULL; virStorageSourcePtr src = disk->src; - /* don't attempt the detection if the top level already has node names */ - if (!parentnode || src->nodeformat || src->nodestorage) + if (!(entry = virHashLookup(disktable, disk->info.alias))) return 0; - while (src && parentnode) { - if (!(entry = virHashLookup(table, parentnode))) - break; + /* don't attempt the detection if the top level already has node names */ + if (src->nodeformat || src->nodestorage) + return 0; + while (src && entry) { if (src->nodeformat || src->nodestorage) { if (STRNEQ_NULLABLE(src->nodeformat, entry->nodeformat) || STRNEQ_NULLABLE(src->nodestorage, entry->nodestorage)) @@ -340,7 +284,7 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk, goto error; } - parentnode = entry->nodebacking; + entry = entry->backing; src = src->backingStore; } @@ -359,10 +303,9 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, { qemuDomainObjPrivatePtr priv = vm->privateData; virHashTablePtr disktable = NULL; - virHashTablePtr nodenametable = NULL; virJSONValuePtr data = NULL; + virJSONValuePtr blockstats = NULL; virDomainDiskDefPtr disk; - struct qemuDomainDiskInfo *info; size_t i; int ret = -1; @@ -372,22 +315,19 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; - disktable = qemuMonitorGetBlockInfo(qemuDomainGetMonitor(vm)); data = qemuMonitorQueryNamedBlockNodes(qemuDomainGetMonitor(vm)); + blockstats = qemuMonitorQueryBlockstats(qemuDomainGetMonitor(vm)); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || !data || !disktable) + if (qemuDomainObjExitMonitor(driver, vm) < 0 || !data || !blockstats) goto cleanup; - if (!(nodenametable = qemuBlockNodeNameGetBackingChain(data))) + if (!(disktable = qemuBlockNodeNameGetBackingChain(data, blockstats))) goto cleanup; for (i = 0; i < vm->def->ndisks; i++) { disk = vm->def->disks[i]; - if (!(info = virHashLookup(disktable, disk->info.alias))) - continue; - - if (qemuBlockDiskDetectNodes(disk, info->nodename, nodenametable) < 0) + if (qemuBlockDiskDetectNodes(disk, disktable) < 0) goto cleanup; } @@ -395,7 +335,7 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, cleanup: virJSONValueFree(data); - virHashFree(nodenametable); + virJSONValueFree(blockstats); virHashFree(disktable); return ret; diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 17dec799f..5d21057a7 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -31,19 +31,15 @@ typedef struct qemuBlockNodeNameBackingChainData qemuBlockNodeNameBackingChainDa typedef qemuBlockNodeNameBackingChainData *qemuBlockNodeNameBackingChainDataPtr; struct qemuBlockNodeNameBackingChainData { char *qemufilename; /* name of the image from qemu */ - char *backingstore; char *nodeformat; /* node name of the format layer */ char *nodestorage; /* node name of the storage backing the format node */ - char *nodebacking; /* node name of the backing file format layer */ - - /* data necessary for detection of the node names from qemu */ - virJSONValuePtr *elems; - size_t nelems; + qemuBlockNodeNameBackingChainDataPtr backing; }; virHashTablePtr -qemuBlockNodeNameGetBackingChain(virJSONValuePtr data); +qemuBlockNodeNameGetBackingChain(virJSONValuePtr namednodesdata, + virJSONValuePtr blockstats); int qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-blockstats.json new file mode 100644 index 000000000..c3752b4cf --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-blockstats.json @@ -0,0 +1,166 @@ +[ + { + "device": "drive-virtio-disk0", + "parent": { + "stats": { + "flush_total_time_ns": 0, + "wr_highest_offset": 32899072, + "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": "#block033" + }, + "stats": { + "flush_total_time_ns": 452246313, + "wr_highest_offset": 8072282112, + "wr_total_time_ns": 4803102521, + "failed_wr_operations": 0, + "failed_rd_operations": 0, + "wr_merged": 8, + "wr_bytes": 6517248, + "timed_stats": [ + + ], + "failed_flush_operations": 0, + "account_invalid": true, + "rd_total_time_ns": 11065169148, + "flush_operations": 10, + "wr_operations": 129, + "rd_merged": 77, + "rd_bytes": 76399104, + "invalid_flush_operations": 0, + "account_failed": true, + "idle_time_ns": 22663656304, + "rd_operations": 4038, + "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": "#block220" + }, + "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": "#block481" + }, + "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": "#block558" + }, + "node-name": "#block306" + }, + "node-name": "#block187" + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-named-nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-named-nodes.json index fe2f32176..ce8fdae70 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-named-nodes.json +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-named-nodes.json @@ -21,7 +21,7 @@ }, "iops_wr": 0, "ro": true, - "node-name": "#block567", + "node-name": "#block558", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, @@ -50,7 +50,7 @@ }, "iops_wr": 0, "ro": true, - "node-name": "#block424", + "node-name": "#block481", "backing_file_depth": 0, "drv": "file", "iops": 0, @@ -109,7 +109,7 @@ }, "iops_wr": 0, "ro": true, - "node-name": "#block331", + "node-name": "#block306", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, @@ -139,7 +139,7 @@ }, "iops_wr": 0, "ro": true, - "node-name": "#block281", + "node-name": "#block220", "backing_file_depth": 0, "drv": "file", "iops": 0, @@ -202,7 +202,7 @@ "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", "cluster-size": 65536, "format": "qcow2", - "actual-size": 32968704, + "actual-size": 33165312, "format-specific": { "type": "qcow2", "data": { @@ -218,7 +218,7 @@ }, "iops_wr": 0, "ro": false, - "node-name": "#block118", + "node-name": "#block187", "backing_file_depth": 2, "drv": "qcow2", "iops": 0, @@ -240,15 +240,15 @@ "iops_rd": 0, "detect_zeroes": "off", "image": { - "virtual-size": 33030144, + "virtual-size": 33226752, "filename": "/var/lib/libvirt/images/rhel7.3.1483545313", "format": "file", - "actual-size": 32968704, + "actual-size": 33165312, "dirty-flag": false }, "iops_wr": 0, "ro": false, - "node-name": "#block078", + "node-name": "#block033", "backing_file_depth": 0, "drv": "file", "iops": 0, diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result index 992fc5165..09e0b36ac 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result @@ -1,9 +1,9 @@ filename : '/var/lib/libvirt/images/rhel7.3.1483545313' -format node : '#block118' -storage node: '#block078' +format node : '#block187' +storage node: '#block033' filename : '/var/lib/libvirt/images/rhel7.3.1483536402' - format node : '#block331' - storage node: '#block281' + format node : '#block306' + storage node: '#block220' filename : '/var/lib/libvirt/images/rhel7.3.qcow2' - format node : '#block567' - storage node: '#block424' + format node : '#block558' + storage node: '#block481' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index c3e86419d..cb7a7dbdb 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2704,18 +2704,17 @@ struct testBlockNodeNameDetectData { static void testBlockNodeNameDetectFormat(virBufferPtr buf, - const char *basenode, + const char *diskalias, virHashTablePtr nodedata) { qemuBlockNodeNameBackingChainDataPtr entry = NULL; - const char *node = basenode; virBufferSetIndent(buf, 0); - while (node) { - if (!(entry = virHashLookup(nodedata, node))) - break; + if (!(entry = virHashLookup(nodedata, diskalias))) + return; + while (entry) { virBufferAsprintf(buf, "filename : '%s'\n", entry->qemufilename); virBufferAsprintf(buf, "format node : '%s'\n", NULLSTR(entry->nodeformat)); @@ -2724,7 +2723,7 @@ testBlockNodeNameDetectFormat(virBufferPtr buf, virBufferAdjustIndent(buf, 2); - node = entry->nodebacking; + entry = entry->backing; } virBufferSetIndent(buf, 0); @@ -2742,6 +2741,7 @@ testBlockNodeNameDetect(const void *opaque) char **nodenames = NULL; char **next; virJSONValuePtr namedNodesJson = NULL; + virJSONValuePtr blockstatsJson = NULL; virHashTablePtr nodedata = NULL; virBuffer buf = VIR_BUFFER_INITIALIZER; int ret = -1; @@ -2757,7 +2757,12 @@ testBlockNodeNameDetect(const void *opaque) "-named-nodes.json", NULL))) goto cleanup; - if (!(nodedata = qemuBlockNodeNameGetBackingChain(namedNodesJson))) + if (!(blockstatsJson = virTestLoadFileJSON(pathprefix, data->name, + "-blockstats.json", NULL))) + goto cleanup; + + if (!(nodedata = qemuBlockNodeNameGetBackingChain(namedNodesJson, + blockstatsJson))) goto cleanup; for (next = nodenames; *next; next++) @@ -2781,6 +2786,7 @@ testBlockNodeNameDetect(const void *opaque) virHashFree(nodedata); virStringListFree(nodenames); virJSONValueFree(namedNodesJson); + virJSONValueFree(blockstatsJson); return ret; } @@ -2929,7 +2935,7 @@ mymain(void) ret = -1; \ } while (0) - DO_TEST_BLOCK_NODE_DETECT("basic", "#block118"); + DO_TEST_BLOCK_NODE_DETECT("basic", "drive-virtio-disk0"); /* DO_TEST_BLOCK_NODE_DETECT("same-backing", "#block170,#block574"); */ /* DO_TEST_BLOCK_NODE_DETECT("relative", "#block153,#block1177"); */ /* DO_TEST_BLOCK_NODE_DETECT("gluster", "#block1008"); */ -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
Remove the complex and unreliable code which inferred the node name hierarchy only from data returned by 'query-named-block-nodes'. It turns out that query-blockstats contain the full hierarchy of nodes as perceived by qemu so the inference code is not necessary.
In query blockstats, the 'parent' object corresponds to the storage behind a storage volume and 'backing' corresponds to the lower level of backing chain. Since all have node names this data can be really easily used to detect node names.
In addition to the code refactoring the one remaining test case needed to be fixed along.
The diff is hard to read given how much changed; it's easier to just focus on the code additions to see if the new stuff makes sense, ignoring what used to be there.
--- src/qemu/qemu_block.c | 290 ++++++++------------- src/qemu/qemu_block.h | 10 +- .../qemumonitorjson-nodename-basic-blockstats.json | 166 ++++++++++++ ...qemumonitorjson-nodename-basic-named-nodes.json | 18 +- .../qemumonitorjson-nodename-basic.result | 12 +- tests/qemumonitorjsontest.c | 22 +- 6 files changed, 313 insertions(+), 205 deletions(-) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-blockstats.json
- +/* list of driver names of layers that qemu automatically adds into the + * backing chain */ +static const char *qemuBlockDriversBlockjob[] = { + "mirror_top", "commit_top", NULL };
This list may change over time; also, qemu 2.10 will hide these implicit nodes (or did 2.9 expose them, so we are stuck dealing with them?)
+ + /* qemu 2.9 reports layers in the backing chain which don't correspond + * to files. skip them */ + if (qemuBlockDriverMatch(drvname, qemuBlockDriversBlockjob)) {
And that answers my question.
+qemuBlockNodeNameGetBackingChainDisk(size_t pos ATTRIBUTE_UNUSED, + virJSONValuePtr item, + void *opaque)
+ if (qemuBlockNodeNameGetBackingChainBacking(item, data->nodenamestable, + &devicedata) < 0)
Sounds like we're stuttering on Backing; but I guess it makes sense (we are doing pieces of 'GetBackingChain', with one piece getting the disk and the other getting the next backing level).
/** * qemuBlockNodeNameGetBackingChain: - * @json: JSON array of data returned from 'query-named-block-nodes' + * @namednodes: JSON array of data returned from 'query-named-block-nodes' + * @blockstats: JSON array of data returned from 'query-blockstats'
So we really have to query two pieces of information, then thread them together (but at least the threading is easy to do, now that qemu auto-names every node); definitely better than our old code of reconstructing the threading by filename guesses. But it also goes to show why Kevin is working on a new query-block-something for 2.11 that will be less painful; so while we'll have to keep this cruft for as long as we support 2.9/2.10, we'll want to give feedback to Kevin's improvements that will let us rebuild things in less time. Or even better, we reach the point where we assign all node names ourselves, and don't even have to do reconstructive queries. But that's for down the road; now back to reviewing this patch.
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-named-nodes.json @@ -21,7 +21,7 @@ }, "iops_wr": 0, "ro": true, - "node-name": "#block567", + "node-name": "#block558",
Trivia: qemu randomizes the last two digits (so you HAVE to query rather than making hard-coded assumptions about what node name will be auto-assigned); but the leading digits are merely a counter of how many nodes qemu previously had to name (this node thus had 5 preceding nodes) - so having the same #block5XX means you created your new trace using the same steps of node creation as the old trace ;)
- DO_TEST_BLOCK_NODE_DETECT("basic", "#block118"); + DO_TEST_BLOCK_NODE_DETECT("basic", "drive-virtio-disk0");
The real payout of your new scheme: you get to start your query from a block device name (under libvirt control) rather than from an intermediate generated node name! I didn't spot anything blatantly wrong, and the new code DOES seem less convoluted (yeah, we have to bounce between two arrays to piece things together, but we aren't reconstructing threading by hand), and, as the commit message says, you're now able to handle a case that previously failed without the use of query-blockstats. I'd still like to test things once I've gone over the whole series, but if I get through my review to 24/24 without any further red flags, you can add: Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

On Wed, Jul 26, 2017 at 16:21:25 -0500, Eric Blake wrote:
On 07/26/2017 05:00 AM, Peter Krempa wrote:
Remove the complex and unreliable code which inferred the node name hierarchy only from data returned by 'query-named-block-nodes'. It turns out that query-blockstats contain the full hierarchy of nodes as perceived by qemu so the inference code is not necessary.
In query blockstats, the 'parent' object corresponds to the storage behind a storage volume and 'backing' corresponds to the lower level of backing chain. Since all have node names this data can be really easily used to detect node names.
In addition to the code refactoring the one remaining test case needed to be fixed along.
The diff is hard to read given how much changed; it's easier to just focus on the code additions to see if the new stuff makes sense, ignoring what used to be there.
--- src/qemu/qemu_block.c | 290 ++++++++------------- src/qemu/qemu_block.h | 10 +- .../qemumonitorjson-nodename-basic-blockstats.json | 166 ++++++++++++ ...qemumonitorjson-nodename-basic-named-nodes.json | 18 +- .../qemumonitorjson-nodename-basic.result | 12 +- tests/qemumonitorjsontest.c | 22 +- 6 files changed, 313 insertions(+), 205 deletions(-) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-blockstats.json
[...]
So we really have to query two pieces of information, then thread them together (but at least the threading is easy to do, now that qemu auto-names every node); definitely better than our old code of reconstructing the threading by filename guesses. But it also goes to show why Kevin is working on a new query-block-something for 2.11 that will be less painful; so while we'll have to keep this cruft for as long as we support 2.9/2.10, we'll want to give feedback to Kevin's improvements that will let us rebuild things in less time. Or even better, we reach the point where we assign all node names ourselves, and don't even have to do reconstructive queries. But that's for down the
Yes that is the final plan and I sure hope to make it happen soon :). With assigning names manually we will have to keep this code for backcompat with VMs started on older versions without assigned node names. Also this code allows the block threshold event for qemu 2.5 - 2.9. I take 2.9 as the first version where assigning names will be feasible due to fixed blockdev add.
road; now back to reviewing this patch.
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic-named-nodes.json @@ -21,7 +21,7 @@ }, "iops_wr": 0, "ro": true, - "node-name": "#block567", + "node-name": "#block558",
Trivia: qemu randomizes the last two digits (so you HAVE to query rather than making hard-coded assumptions about what node name will be auto-assigned); but the leading digits are merely a counter of how many nodes qemu previously had to name (this node thus had 5 preceding nodes) - so having the same #block5XX means you created your new trace using the same steps of node creation as the old trace ;)
I read the commit adding the "object name generator" but did not quite get this detail from reading it. Thanks for enlightenment :)

virHashNew calls virRandomBits to initialize seed for the hashing function. If a test uses iteration through the hash table to produce results they may/will be non-deterministic. Extract the mock library which was used for mac address mapping to be universal. --- tests/Makefile.am | 17 +++++++++-------- tests/{virmacmapmock.c => virdeterministichashmock.c} | 0 tests/virmacmaptest.c | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) rename tests/{virmacmapmock.c => virdeterministichashmock.c} (100%) diff --git a/tests/Makefile.am b/tests/Makefile.am index 5be81d221..a2a9ebec9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1198,22 +1198,23 @@ else ! WITH_NSS EXTRA_DIST += nsstest.c nssmock.c nsslinktest.c endif ! WITH_NSS -if WITH_YAJL -virmacmapmock_la_SOURCES = \ - virmacmapmock.c -virmacmapmock_la_CFLAGS = $(AM_CFLAGS) -virmacmapmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS) -virmacmapmock_la_LIBADD = $(MOCKLIBS_LIBS) +virdeterministichashmock_la_SOURCES = \ + virdeterministichashmock.c +virdeterministichashmock_la_CFLAGS = $(AM_CFLAGS) +virdeterministichashmock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS) +virdeterministichashmock_la_LIBADD = $(MOCKLIBS_LIBS) + +test_libraries += virdeterministichashmock.la +if WITH_YAJL virmacmaptest_SOURCES = \ virmacmaptest.c testutils.h testutils.c virmacmaptest_CLFAGS = $(AM_CFLAGS) virmacmaptest_LDADD = $(LDADDS) -test_libraries += virmacmapmock.la test_programs += virmacmaptest else ! WITH_YAJL -EXTRA_DIST += virmacmapmock.c virmacmaptest.c +EXTRA_DIST += virmacmaptest.c endif ! WITH_YAJL virnetdevtest_SOURCES = \ diff --git a/tests/virmacmapmock.c b/tests/virdeterministichashmock.c similarity index 100% rename from tests/virmacmapmock.c rename to tests/virdeterministichashmock.c diff --git a/tests/virmacmaptest.c b/tests/virmacmaptest.c index 35e312771..0627fb37a 100644 --- a/tests/virmacmaptest.c +++ b/tests/virmacmaptest.c @@ -234,4 +234,4 @@ mymain(void) return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } -VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virmacmapmock.so") +VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virdeterministichashmock.so") -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
virHashNew calls virRandomBits to initialize seed for the hashing function. If a test uses iteration through the hash table to produce results they may/will be non-deterministic. Extract the mock library which was used for mac address mapping to be universal. --- tests/Makefile.am | 17 +++++++++-------- tests/{virmacmapmock.c => virdeterministichashmock.c} | 0 tests/virmacmaptest.c | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) rename tests/{virmacmapmock.c => virdeterministichashmock.c} (100%)
Long name, but works for me. Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

We can now iterate the hash table and print all detected backing chains. This simplifies calling of the test cases. --- .../qemumonitorjson-nodename-basic.result | 1 + tests/qemumonitorjsontest.c | 55 +++++++++------------- 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result index 09e0b36ac..bc183f8b9 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result @@ -1,3 +1,4 @@ +drive-virtio-disk0 filename : '/var/lib/libvirt/images/rhel7.3.1483545313' format node : '#block187' storage node: '#block033' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index cb7a7dbdb..88169832e 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2696,23 +2696,19 @@ testQemuMonitorCPUInfo(const void *opaque) } -struct testBlockNodeNameDetectData { - const char *name; - const char *nodenames; -}; - - -static void -testBlockNodeNameDetectFormat(virBufferPtr buf, - const char *diskalias, - virHashTablePtr nodedata) +static int +testBlockNodeNameDetectFormat(void *payload, + const void *name, + void *opaque) { - qemuBlockNodeNameBackingChainDataPtr entry = NULL; + qemuBlockNodeNameBackingChainDataPtr entry = payload; + const char *diskalias = name; + virBufferPtr buf = opaque; virBufferSetIndent(buf, 0); - if (!(entry = virHashLookup(nodedata, diskalias))) - return; + virBufferAdd(buf, diskalias, -1); + virBufferAddLit(buf, "\n"); while (entry) { virBufferAsprintf(buf, "filename : '%s'\n", entry->qemufilename); @@ -2728,18 +2724,17 @@ testBlockNodeNameDetectFormat(virBufferPtr buf, virBufferSetIndent(buf, 0); virBufferAddLit(buf, "\n"); + return 0; } static int testBlockNodeNameDetect(const void *opaque) { - const struct testBlockNodeNameDetectData *data = opaque; + const char *testname = opaque; const char *pathprefix = "qemumonitorjsondata/qemumonitorjson-nodename-"; char *resultFile = NULL; char *actual = NULL; - char **nodenames = NULL; - char **next; virJSONValuePtr namedNodesJson = NULL; virJSONValuePtr blockstatsJson = NULL; virHashTablePtr nodedata = NULL; @@ -2747,17 +2742,14 @@ testBlockNodeNameDetect(const void *opaque) int ret = -1; if (virAsprintf(&resultFile, "%s/%s%s.result", - abs_srcdir, pathprefix, data->name) < 0) - goto cleanup; - - if (!(nodenames = virStringSplit(data->nodenames, ",", 0))) + abs_srcdir, pathprefix, testname) < 0) goto cleanup; - if (!(namedNodesJson = virTestLoadFileJSON(pathprefix, data->name, + if (!(namedNodesJson = virTestLoadFileJSON(pathprefix, testname, "-named-nodes.json", NULL))) goto cleanup; - if (!(blockstatsJson = virTestLoadFileJSON(pathprefix, data->name, + if (!(blockstatsJson = virTestLoadFileJSON(pathprefix, testname, "-blockstats.json", NULL))) goto cleanup; @@ -2765,8 +2757,7 @@ testBlockNodeNameDetect(const void *opaque) blockstatsJson))) goto cleanup; - for (next = nodenames; *next; next++) - testBlockNodeNameDetectFormat(&buf, *next, nodedata); + virHashForEach(nodedata, testBlockNodeNameDetectFormat, &buf); virBufferTrim(&buf, "\n", -1); @@ -2784,7 +2775,6 @@ testBlockNodeNameDetect(const void *opaque) VIR_FREE(resultFile); VIR_FREE(actual); virHashFree(nodedata); - virStringListFree(nodenames); virJSONValueFree(namedNodesJson); virJSONValueFree(blockstatsJson); @@ -2927,18 +2917,17 @@ mymain(void) DO_TEST_CPU_INFO("ppc64-hotplug-4", 24); DO_TEST_CPU_INFO("ppc64-no-threads", 16); -#define DO_TEST_BLOCK_NODE_DETECT(testname, testnodes) \ +#define DO_TEST_BLOCK_NODE_DETECT(testname) \ do { \ - struct testBlockNodeNameDetectData testdata = {testname, testnodes}; \ if (virTestRun("node-name-detect(" testname ")", \ - testBlockNodeNameDetect, &testdata) < 0) \ + testBlockNodeNameDetect, testname) < 0) \ ret = -1; \ } while (0) - DO_TEST_BLOCK_NODE_DETECT("basic", "drive-virtio-disk0"); -/* DO_TEST_BLOCK_NODE_DETECT("same-backing", "#block170,#block574"); */ -/* DO_TEST_BLOCK_NODE_DETECT("relative", "#block153,#block1177"); */ -/* DO_TEST_BLOCK_NODE_DETECT("gluster", "#block1008"); */ + DO_TEST_BLOCK_NODE_DETECT("basic"); +/* DO_TEST_BLOCK_NODE_DETECT("same-backing"); */ +/* DO_TEST_BLOCK_NODE_DETECT("relative"); */ +/* DO_TEST_BLOCK_NODE_DETECT("gluster"); */ #undef DO_TEST_BLOCK_NODE_DETECT @@ -2947,4 +2936,4 @@ mymain(void) return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } -VIR_TEST_MAIN(mymain) +VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virdeterministichashmock.so") -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
We can now iterate the hash table and print all detected backing chains. This simplifies calling of the test cases. --- .../qemumonitorjson-nodename-basic.result | 1 + tests/qemumonitorjsontest.c | 55 +++++++++------------- 2 files changed, 23 insertions(+), 33 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

Store the 'drv' field both for the storage node and for the format node and format them in the test case. --- src/qemu/qemu_block.c | 14 +++++++++++--- src/qemu/qemu_block.h | 4 ++++ .../qemumonitorjson-nodename-basic.result | 6 ++++++ tests/qemumonitorjsontest.c | 2 ++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index bca6965fa..348961199 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -56,6 +56,9 @@ qemuBlockNodeNameBackingChainDataFree(qemuBlockNodeNameBackingChainDataPtr data) VIR_FREE(data->qemufilename); + VIR_FREE(data->drvformat); + VIR_FREE(data->drvstorage); + qemuBlockNodeNameBackingChainDataFree(data->backing); VIR_FREE(data); @@ -108,7 +111,8 @@ qemuBlockNodeNameGetBackingChainBacking(virJSONValuePtr next, virJSONValuePtr parentnodedata; virJSONValuePtr nodedata; const char *nodename = virJSONValueObjectGetString(next, "node-name"); - const char *drvname; + const char *drvname = NULL; + const char *drvparent = NULL; const char *parentnodename = NULL; const char *filename = NULL; int ret = -1; @@ -134,8 +138,10 @@ qemuBlockNodeNameGetBackingChainBacking(virJSONValuePtr next, if (parent && (parentnodename = virJSONValueObjectGetString(parent, "node-name"))) { - if ((parentnodedata = virHashLookup(nodenamestable, parentnodename))) + if ((parentnodedata = virHashLookup(nodenamestable, parentnodename))) { filename = virJSONValueObjectGetString(parentnodedata, "file"); + drvparent = virJSONValueObjectGetString(parentnodedata, "drv"); + } } if (VIR_ALLOC(data) < 0) @@ -143,7 +149,9 @@ qemuBlockNodeNameGetBackingChainBacking(virJSONValuePtr next, if (VIR_STRDUP(data->nodeformat, nodename) < 0 || VIR_STRDUP(data->nodestorage, parentnodename) < 0 || - VIR_STRDUP(data->qemufilename, filename) < 0) + VIR_STRDUP(data->qemufilename, filename) < 0 || + VIR_STRDUP(data->drvformat, drvname) < 0 || + VIR_STRDUP(data->drvstorage, drvparent) < 0) goto cleanup; if (backing && diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 5d21057a7..c0ed43ec0 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -34,6 +34,10 @@ struct qemuBlockNodeNameBackingChainData { char *nodeformat; /* node name of the format layer */ char *nodestorage; /* node name of the storage backing the format node */ + /* for testing purposes */ + char *drvformat; + char *drvstorage; + qemuBlockNodeNameBackingChainDataPtr backing; }; diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result index bc183f8b9..ad8b9b46e 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-basic.result @@ -1,10 +1,16 @@ drive-virtio-disk0 filename : '/var/lib/libvirt/images/rhel7.3.1483545313' format node : '#block187' +format drv : 'qcow2' storage node: '#block033' +storage drv : 'file' filename : '/var/lib/libvirt/images/rhel7.3.1483536402' format node : '#block306' + format drv : 'qcow2' storage node: '#block220' + storage drv : 'file' filename : '/var/lib/libvirt/images/rhel7.3.qcow2' format node : '#block558' + format drv : 'qcow2' storage node: '#block481' + storage drv : 'file' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 88169832e..346d5c401 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2714,8 +2714,10 @@ testBlockNodeNameDetectFormat(void *payload, virBufferAsprintf(buf, "filename : '%s'\n", entry->qemufilename); virBufferAsprintf(buf, "format node : '%s'\n", NULLSTR(entry->nodeformat)); + virBufferAsprintf(buf, "format drv : '%s'\n", NULLSTR(entry->drvformat)); virBufferAsprintf(buf, "storage node: '%s'\n", NULLSTR(entry->nodestorage)); + virBufferAsprintf(buf, "storage drv : '%s'\n", NULLSTR(entry->drvstorage)); virBufferAdjustIndent(buf, 2); -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
Store the 'drv' field both for the storage node and for the format node and format them in the test case. --- src/qemu/qemu_block.c | 14 +++++++++++--- src/qemu/qemu_block.h | 4 ++++ .../qemumonitorjson-nodename-basic.result | 6 ++++++ tests/qemumonitorjsontest.c | 2 ++ 4 files changed, 23 insertions(+), 3 deletions(-) +++ b/src/qemu/qemu_block.h @@ -34,6 +34,10 @@ struct qemuBlockNodeNameBackingChainData { char *nodeformat; /* node name of the format layer */ char *nodestorage; /* node name of the storage backing the format node */
+ /* for testing purposes */ + char *drvformat; + char *drvstorage; +
Should those two fields be listed...
qemuBlockNodeNameBackingChainDataPtr backing;
...after this one, to make it obvious where the 'for testing purposes' ends?
filename : '/var/lib/libvirt/images/rhel7.3.qcow2' format node : '#block558' + format drv : 'qcow2' storage node: '#block481' + storage drv : 'file'
But I definitely see how it will be useful when we mix more than one protocol, or where a backing chain ends in raw instead of qcow2. Rearranging fields in a declaration is minor, so you are still okay adding: Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

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

On 07/26/2017 05:00 AM, Peter Krempa wrote:
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
Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

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

On 07/26/2017 05:00 AM, Peter Krempa wrote:
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
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-relative-named-nodes.json @@ -41,7 +41,7 @@ }, "iops_wr": 0, "ro": false, - "node-name": "#block1177", + "node-name": "#block1290",
Hmm - here you created one extra node in the regeneration in comparison to how you set it up previously. Not fatal to the patch, though. Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

Add the blockstats data and fix the expected output. --- ...emumonitorjson-nodename-gluster-blockstats.json | 111 +++++++++++++++++++++ ...mumonitorjson-nodename-gluster-named-nodes.json | 90 ++++++++--------- .../qemumonitorjson-nodename-gluster.result | 15 ++- tests/qemumonitorjsontest.c | 2 +- 4 files changed, 167 insertions(+), 51 deletions(-) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json new file mode 100644 index 000000000..665a6b05b --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json @@ -0,0 +1,111 @@ +[ + { + "device": "drive-virtio-disk0", + "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": "#block282" + }, + "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": "#block477" + }, + "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": "#block596" + }, + "node-name": "#block338" + } + ] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-named-nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-named-nodes.json index 7ea5c5d54..e6bd2cfa7 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-named-nodes.json +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-named-nodes.json @@ -3,40 +3,19 @@ "iops_rd": 0, "detect_zeroes": "off", "image": { - "backing-image": { - "virtual-size": 197120, - "filename": "gluster://gluster-host/vol0/img0", - "format": "raw", - "actual-size": 197120 - }, - "backing-filename-format": "raw", "virtual-size": 197120, - "filename": "gluster://gluster-host/vol0/img1", - "cluster-size": 65536, - "format": "qcow2", - "actual-size": 197120, - "format-specific": { - "type": "qcow2", - "data": { - "compat": "1.1", - "lazy-refcounts": false, - "refcount-bits": 16, - "corrupt": false - } - }, - "full-backing-filename": "gluster://gluster-host/vol0/img0", - "backing-filename": "gluster://gluster-host/vol0/img0", - "dirty-flag": false + "filename": "gluster://gluster-host/vol0/img0", + "format": "raw", + "actual-size": 197120 }, "iops_wr": 0, - "ro": false, - "node-name": "#block1008", - "backing_file_depth": 1, - "drv": "qcow2", + "ro": true, + "node-name": "#block596", + "backing_file_depth": 0, + "drv": "raw", "iops": 0, "bps_wr": 0, "write_threshold": 0, - "backing_file": "gluster://gluster-host/vol0/img0", "encrypted": false, "bps": 0, "bps_rd": 0, @@ -45,7 +24,7 @@ "direct": true, "writeback": true }, - "file": "gluster://gluster-host/vol0/img1", + "file": "gluster://gluster-host/vol0/img0", "encryption_key_missing": false }, { @@ -53,13 +32,13 @@ "detect_zeroes": "off", "image": { "virtual-size": 197120, - "filename": "gluster://gluster-host/vol0/img1", + "filename": "gluster://gluster-host/vol0/img0", "format": "gluster", "actual-size": 197120 }, "iops_wr": 0, - "ro": false, - "node-name": "#block981", + "ro": true, + "node-name": "#block477", "backing_file_depth": 0, "drv": "gluster", "iops": 0, @@ -73,26 +52,47 @@ "direct": true, "writeback": true }, - "file": "gluster://gluster-host/vol0/img1", + "file": "gluster://gluster-host/vol0/img0", "encryption_key_missing": false }, { "iops_rd": 0, "detect_zeroes": "off", "image": { + "backing-image": { + "virtual-size": 197120, + "filename": "gluster://gluster-host/vol0/img0", + "format": "raw", + "actual-size": 197120 + }, + "backing-filename-format": "raw", "virtual-size": 197120, - "filename": "gluster://gluster-host/vol0/img0", - "format": "raw", - "actual-size": 197120 + "filename": "gluster://gluster-host:24007/vol0/img1", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 197120, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "gluster://gluster-host/vol0/img0", + "backing-filename": "gluster://gluster-host/vol0/img0", + "dirty-flag": false }, "iops_wr": 0, - "ro": true, - "node-name": "#block349", - "backing_file_depth": 0, - "drv": "raw", + "ro": false, + "node-name": "#block338", + "backing_file_depth": 1, + "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, + "backing_file": "gluster://gluster-host/vol0/img0", "encrypted": false, "bps": 0, "bps_rd": 0, @@ -101,7 +101,7 @@ "direct": true, "writeback": true }, - "file": "gluster://gluster-host/vol0/img0", + "file": "gluster://gluster-host:24007/vol0/img1", "encryption_key_missing": false }, { @@ -109,13 +109,13 @@ "detect_zeroes": "off", "image": { "virtual-size": 197120, - "filename": "gluster://gluster-host/vol0/img0", + "filename": "gluster://gluster-host:24007/vol0/img1", "format": "gluster", "actual-size": 197120 }, "iops_wr": 0, - "ro": true, - "node-name": "#block269", + "ro": false, + "node-name": "#block282", "backing_file_depth": 0, "drv": "gluster", "iops": 0, @@ -129,7 +129,7 @@ "direct": true, "writeback": true }, - "file": "gluster://gluster-host/vol0/img0", + "file": "gluster://gluster-host:24007/vol0/img1", "encryption_key_missing": false } ] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.result index d99576202..6289fdd1a 100644 --- a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.result +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster.result @@ -1,6 +1,11 @@ -filename : 'gluster://gluster-host/vol0/img1' -format node : '#block1008' -storage node: '#block981' +drive-virtio-disk0 +filename : 'gluster://gluster-host:24007/vol0/img1' +format node : '#block338' +format drv : 'qcow2' +storage node: '#block282' +storage drv : 'gluster' filename : 'gluster://gluster-host/vol0/img0' - format node : '#block349' - storage node: '#block269' + format node : '#block596' + format drv : 'raw' + storage node: '#block477' + storage drv : 'gluster' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 2b10a75cd..8edb3f121 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2929,7 +2929,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("gluster"); */ + DO_TEST_BLOCK_NODE_DETECT("gluster"); #undef DO_TEST_BLOCK_NODE_DETECT -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
Add the blockstats data and fix the expected output. --- ...emumonitorjson-nodename-gluster-blockstats.json | 111 +++++++++++++++++++++ ...mumonitorjson-nodename-gluster-named-nodes.json | 90 ++++++++--------- .../qemumonitorjson-nodename-gluster.result | 15 ++- tests/qemumonitorjsontest.c | 2 +- 4 files changed, 167 insertions(+), 51 deletions(-) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json
Reviewed-by: Eric Blake <eblake@redhat.com>
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json new file mode 100644 index 000000000..665a6b05b --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json @@ -0,0 +1,111 @@ +[ + { + "device": "drive-virtio-disk0", + "parent": { + "stats": { + "flush_total_time_ns": 0,
This output was obviously generated by loading a simple <domain> XML and then getting query-blockstats output. I'm wondering, if for reproducibility (modulo the change of random nodename suffixes), you should enhance the commit message here (and in similar other patches) to call out the steps you used to create the domain (did you have to use qemu-img, and what <disk> spec did you use). It's not a hard request, as I've already given reviews, but it may be something we appreciate in the future when doing git archaeology. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

On Wed, Jul 26, 2017 at 16:46:23 -0500, Eric Blake wrote:
On 07/26/2017 05:00 AM, Peter Krempa wrote:
Add the blockstats data and fix the expected output. --- ...emumonitorjson-nodename-gluster-blockstats.json | 111 +++++++++++++++++++++ ...mumonitorjson-nodename-gluster-named-nodes.json | 90 ++++++++--------- .../qemumonitorjson-nodename-gluster.result | 15 ++- tests/qemumonitorjsontest.c | 2 +- 4 files changed, 167 insertions(+), 51 deletions(-) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json
Reviewed-by: Eric Blake <eblake@redhat.com>
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json new file mode 100644 index 000000000..665a6b05b --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-gluster-blockstats.json @@ -0,0 +1,111 @@ +[ + { + "device": "drive-virtio-disk0", + "parent": { + "stats": { + "flush_total_time_ns": 0,
This output was obviously generated by loading a simple <domain> XML and then getting query-blockstats output. I'm wondering, if for reproducibility (modulo the change of random nodename suffixes), you should enhance the commit message here (and in similar other patches) to call out the steps you used to create the domain (did you have to use qemu-img, and what <disk> spec did you use). It's not a hard request, as I've already given reviews, but it may be something we appreciate in the future when doing git archaeology.
Hmm, yeah that sounds like a good idea. The partial problem may be that I had most of the files already laying around from various other testing, so I'll need to recreate the steps.

qemu 2.9 returns an extra layer in the backing data if a block job is active. Add a test case to see whether our code properly detects and ignores such layer. --- ...mumonitorjson-nodename-blockjob-blockstats.json | 301 +++++++++ ...umonitorjson-nodename-blockjob-named-nodes.json | 682 +++++++++++++++++++++ .../qemumonitorjson-nodename-blockjob.result | 26 + tests/qemumonitorjsontest.c | 1 + 4 files changed, 1010 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob.result diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-blockstats.json new file mode 100644 index 000000000..51cd664c2 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-blockstats.json @@ -0,0 +1,301 @@ +[ + { + "device": "drive-ide0-0-0", + "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": 99763, + "flush_operations": 0, + "wr_operations": 0, + "rd_merged": 0, + "rd_bytes": 512, + "invalid_flush_operations": 0, + "account_failed": true, + "idle_time_ns": 1142142388760097, + "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": "#block042" + }, + "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": "#block259" + }, + "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": "#block449" + }, + "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": "#block618" + }, + "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": "#block846" + }, + "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": "#block901" + }, + "node-name": "#block717" + }, + "node-name": "#block551" + }, + "node-name": "#block312" + }, + "node-name": "#block179" + }, + "node-name": "#block3343" + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-named-nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-named-nodes.json new file mode 100644 index 000000000..3cebb23a9 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-named-nodes.json @@ -0,0 +1,682 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/a", + "format": "raw", + "actual-size": 0, + "dirty-flag": false + }, + "backing-filename-format": "raw", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/c", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/a", + "backing-filename": "/var/lib/libvirt/images/a", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/d", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/c", + "backing-filename": "/var/lib/libvirt/images/c", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/d.1499152668", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/d", + "backing-filename": "/var/lib/libvirt/images/d", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/d.1499152698", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/d.1499152668", + "backing-filename": "/var/lib/libvirt/images/d.1499152668", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/d.1499152698", + "format": "mirror_top", + "full-backing-filename": "/var/lib/libvirt/images/d.1499152698", + "backing-filename": "/var/lib/libvirt/images/d.1499152698" + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block3343", + "backing_file_depth": 5, + "drv": "mirror_top", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/d.1499152698", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/d.1499152698", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "/tmp/kkt", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 266240, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block3243", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/kkt", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 327680, + "filename": "/tmp/kkt", + "format": "file", + "actual-size": 266240, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block3144", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/kkt", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/a", + "format": "raw", + "actual-size": 0, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block901", + "backing_file_depth": 0, + "drv": "raw", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/a", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/a", + "format": "file", + "actual-size": 0, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block846", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/a", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/a", + "format": "raw", + "actual-size": 0, + "dirty-flag": false + }, + "backing-filename-format": "raw", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/c", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/a", + "backing-filename": "/var/lib/libvirt/images/a", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block717", + "backing_file_depth": 1, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/a", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/c", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/c", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block618", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/c", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/a", + "format": "raw", + "actual-size": 0, + "dirty-flag": false + }, + "backing-filename-format": "raw", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/c", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/a", + "backing-filename": "/var/lib/libvirt/images/a", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/d", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/c", + "backing-filename": "/var/lib/libvirt/images/c", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block551", + "backing_file_depth": 2, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/c", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/d", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/d", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block449", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/d", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/a", + "format": "raw", + "actual-size": 0, + "dirty-flag": false + }, + "backing-filename-format": "raw", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/c", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/a", + "backing-filename": "/var/lib/libvirt/images/a", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/d", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/c", + "backing-filename": "/var/lib/libvirt/images/c", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/d.1499152668", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/d", + "backing-filename": "/var/lib/libvirt/images/d", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block312", + "backing_file_depth": 3, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/d", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/d.1499152668", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/d.1499152668", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "#block259", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/d.1499152668", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/a", + "format": "raw", + "actual-size": 0, + "dirty-flag": false + }, + "backing-filename-format": "raw", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/c", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/a", + "backing-filename": "/var/lib/libvirt/images/a", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/d", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/c", + "backing-filename": "/var/lib/libvirt/images/c", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/d.1499152668", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/d", + "backing-filename": "/var/lib/libvirt/images/d", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/var/lib/libvirt/images/d.1499152698", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/var/lib/libvirt/images/d.1499152668", + "backing-filename": "/var/lib/libvirt/images/d.1499152668", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block179", + "backing_file_depth": 4, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/var/lib/libvirt/images/d.1499152668", + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/d.1499152698", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/var/lib/libvirt/images/d.1499152698", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block042", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/d.1499152698", + "encryption_key_missing": false + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob.result new file mode 100644 index 000000000..4abe6f934 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob.result @@ -0,0 +1,26 @@ +drive-ide0-0-0 +filename : '/var/lib/libvirt/images/d.1499152698' +format node : '#block179' +format drv : 'qcow2' +storage node: '#block042' +storage drv : 'file' + filename : '/var/lib/libvirt/images/d.1499152668' + format node : '#block312' + format drv : 'qcow2' + storage node: '#block259' + storage drv : 'file' + filename : '/var/lib/libvirt/images/d' + format node : '#block551' + format drv : 'qcow2' + storage node: '#block449' + storage drv : 'file' + filename : '/var/lib/libvirt/images/c' + format node : '#block717' + format drv : 'qcow2' + storage node: '#block618' + storage drv : 'file' + filename : '/var/lib/libvirt/images/a' + format node : '#block901' + format drv : 'raw' + storage node: '#block846' + storage drv : 'file' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 8edb3f121..0601c1188 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2930,6 +2930,7 @@ mymain(void) DO_TEST_BLOCK_NODE_DETECT("same-backing"); DO_TEST_BLOCK_NODE_DETECT("relative"); DO_TEST_BLOCK_NODE_DETECT("gluster"); + DO_TEST_BLOCK_NODE_DETECT("blockjob"); #undef DO_TEST_BLOCK_NODE_DETECT -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
qemu 2.9 returns an extra layer in the backing data if a block job is active. Add a test case to see whether our code properly detects and ignores such layer. --- ...mumonitorjson-nodename-blockjob-blockstats.json | 301 +++++++++ ...umonitorjson-nodename-blockjob-named-nodes.json | 682 +++++++++++++++++++++ .../qemumonitorjson-nodename-blockjob.result | 26 + tests/qemumonitorjsontest.c | 1 + 4 files changed, 1010 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob.result
Again, the sequence of steps used to get to this point (as setting up a block job is not necessarily trivial) might be useful reference material when reading git log in the future.
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-blockjob.result @@ -0,0 +1,26 @@ +drive-ide0-0-0 +filename : '/var/lib/libvirt/images/d.1499152698' +format node : '#block179' +format drv : 'qcow2' +storage node: '#block042' +storage drv : 'file' + filename : '/var/lib/libvirt/images/d.1499152668' + format node : '#block312'
Looks like two snapshots where libvirt created the filename via timestamps (which of course is not trivially reproducible, but easy to understand when I get higher numbers), on top of a chain you built...
+ format drv : 'qcow2' + storage node: '#block259' + storage drv : 'file' + filename : '/var/lib/libvirt/images/d' + format node : '#block551' + format drv : 'qcow2' + storage node: '#block449' + storage drv : 'file' + filename : '/var/lib/libvirt/images/c' + format node : '#block717' + format drv : 'qcow2' + storage node: '#block618' + storage drv : 'file' + filename : '/var/lib/libvirt/images/a'
of 'a'<-'c'<-'d' - I suppose you've already merged 'b' from some other operation? At any rate, the new test is useful, and adding a backstory to the commit message won't change the patch body, so: Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

Prior to qemu 2.5 the node names would not be generated, thus would be missing from 'query-blockstats' and 'query-named-block-nodes'. Test that the code correctly detects nothing. Additionally make sure that a VM without disks does not cause problems. The test case change is necessary as our test file checker does not play well with empty files. --- .../qemumonitorjson-nodename-empty-blockstats.json | 2 + ...qemumonitorjson-nodename-empty-named-nodes.json | 2 + .../qemumonitorjson-nodename-empty.result | 1 + .../qemumonitorjson-nodename-old-blockstats.json | 160 +++++++++++++++++++++ .../qemumonitorjson-nodename-old-named-nodes.json | 2 + .../qemumonitorjson-nodename-old.result | 1 + tests/qemumonitorjsontest.c | 5 + 7 files changed, 173 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-empty.result create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-old.result diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-blockstats.json new file mode 100644 index 000000000..0d4f101c7 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-blockstats.json @@ -0,0 +1,2 @@ +[ +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-named-nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-named-nodes.json new file mode 100644 index 000000000..0d4f101c7 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty-named-nodes.json @@ -0,0 +1,2 @@ +[ +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty.result new file mode 100644 index 000000000..9dafe9be2 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty.result @@ -0,0 +1 @@ +nothing diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-blockstats.json new file mode 100644 index 000000000..26c14f9f2 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-blockstats.json @@ -0,0 +1,160 @@ +[ + { + "device": "drive-virtio-disk0", + "parent": { + "stats": { + "flush_total_time_ns": 0, + "wr_highest_offset": 32899072, + "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 + } + }, + "stats": { + "flush_total_time_ns": 452246313, + "wr_highest_offset": 8072282112, + "wr_total_time_ns": 4803102521, + "failed_wr_operations": 0, + "failed_rd_operations": 0, + "wr_merged": 8, + "wr_bytes": 6517248, + "timed_stats": [ + + ], + "failed_flush_operations": 0, + "account_invalid": true, + "rd_total_time_ns": 11065169148, + "flush_operations": 10, + "wr_operations": 129, + "rd_merged": 77, + "rd_bytes": 76399104, + "invalid_flush_operations": 0, + "account_failed": true, + "idle_time_ns": 22663656304, + "rd_operations": 4038, + "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 + } + }, + "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 + } + }, + "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 + } + } + } + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-named-nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-named-nodes.json new file mode 100644 index 000000000..0d4f101c7 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-old-named-nodes.json @@ -0,0 +1,2 @@ +[ +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-old.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-old.result new file mode 100644 index 000000000..9dafe9be2 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-old.result @@ -0,0 +1 @@ +nothing diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 0601c1188..06d97989e 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2763,6 +2763,9 @@ testBlockNodeNameDetect(const void *opaque) virBufferTrim(&buf, "\n", -1); + if (virBufferUse(&buf) == 0) + virBufferAddLit(&buf, "nothing\n"); + if (virBufferCheckError(&buf) < 0) goto cleanup; @@ -2931,6 +2934,8 @@ mymain(void) DO_TEST_BLOCK_NODE_DETECT("relative"); DO_TEST_BLOCK_NODE_DETECT("gluster"); DO_TEST_BLOCK_NODE_DETECT("blockjob"); + DO_TEST_BLOCK_NODE_DETECT("old"); + DO_TEST_BLOCK_NODE_DETECT("empty"); #undef DO_TEST_BLOCK_NODE_DETECT -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
Prior to qemu 2.5 the node names would not be generated, thus would be missing from 'query-blockstats' and 'query-named-block-nodes'. Test that the code correctly detects nothing.
Additionally make sure that a VM without disks does not cause problems.
The test case change is necessary as our test file checker does not play well with empty files.
Can you use a file consisting of solely backslash-newline? That is not empty, but with \\\n folding becomes an empty string. That might be a bit simpler than:
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-empty.result @@ -0,0 +1 @@ +nothing
+++ b/tests/qemumonitorjsontest.c @@ -2763,6 +2763,9 @@ testBlockNodeNameDetect(const void *opaque)
virBufferTrim(&buf, "\n", -1);
+ if (virBufferUse(&buf) == 0) + virBufferAddLit(&buf, "nothing\n");
having to special case "nothing". -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

--- .../qemumonitorjson-nodename-luks-blockstats.json | 58 +++++++++++ .../qemumonitorjson-nodename-luks-named-nodes.json | 109 +++++++++++++++++++++ .../qemumonitorjson-nodename-luks.result | 6 ++ tests/qemumonitorjsontest.c | 1 + 4 files changed, 174 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks.result diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-blockstats.json new file mode 100644 index 000000000..6f971b2af --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-blockstats.json @@ -0,0 +1,58 @@ +[ + { + "device": "drive-virtio-disk0", + "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": "#block033" + }, + "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": 89560, + "flush_operations": 0, + "wr_operations": 0, + "rd_merged": 0, + "rd_bytes": 512, + "invalid_flush_operations": 0, + "account_failed": true, + "idle_time_ns": 323120536984, + "rd_operations": 1, + "invalid_wr_operations": 0, + "invalid_rd_operations": 0 + }, + "node-name": "#block136" + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-named-nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-named-nodes.json new file mode 100644 index 000000000..8de6d6c6a --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-named-nodes.json @@ -0,0 +1,109 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "json:{\"driver\": \"luks\", \"file\": {\"driver\": \"file\", \"filename\": \"/var/lib/libvirt/images/luks\"}, \"key-secret\": \"virtio-disk0-luks-secret0\"}", + "format": "luks", + "actual-size": 262144, + "format-specific": { + "type": "luks", + "data": { + "ivgen-alg": "plain64", + "hash-alg": "sha256", + "cipher-alg": "aes-256", + "uuid": "687ef639-c687-40d3-a103-7b4bdaa6e74a", + "cipher-mode": "xts", + "slots": [ + { + "active": true, + "iters": 1886334, + "key-offset": 4096, + "stripes": 4000 + }, + { + "active": false, + "key-offset": 262144 + }, + { + "active": false, + "key-offset": 520192 + }, + { + "active": false, + "key-offset": 778240 + }, + { + "active": false, + "key-offset": 1036288 + }, + { + "active": false, + "key-offset": 1294336 + }, + { + "active": false, + "key-offset": 1552384 + }, + { + "active": false, + "key-offset": 1810432 + } + ], + "payload-offset": 2068480, + "master-key-iters": 484865 + } + }, + "encrypted": true, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block136", + "backing_file_depth": 0, + "drv": "luks", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": true, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "json:{\"driver\": \"luks\", \"file\": {\"driver\": \"file\", \"filename\": \"/var/lib/libvirt/images/luks\"}, \"key-secret\": \"virtio-disk0-luks-secret0\"}", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 12554240, + "filename": "/var/lib/libvirt/images/luks", + "format": "file", + "actual-size": 262144, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block033", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/var/lib/libvirt/images/luks", + "encryption_key_missing": false + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks.result new file mode 100644 index 000000000..6a6b37519 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks.result @@ -0,0 +1,6 @@ +drive-virtio-disk0 +filename : '/var/lib/libvirt/images/luks' +format node : '#block136' +format drv : 'luks' +storage node: '#block033' +storage drv : 'file' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 06d97989e..f4169e550 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2936,6 +2936,7 @@ mymain(void) DO_TEST_BLOCK_NODE_DETECT("blockjob"); DO_TEST_BLOCK_NODE_DETECT("old"); DO_TEST_BLOCK_NODE_DETECT("empty"); + DO_TEST_BLOCK_NODE_DETECT("luks"); #undef DO_TEST_BLOCK_NODE_DETECT -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
--- .../qemumonitorjson-nodename-luks-blockstats.json | 58 +++++++++++ .../qemumonitorjson-nodename-luks-named-nodes.json | 109 +++++++++++++++++++++ .../qemumonitorjson-nodename-luks.result | 6 ++ tests/qemumonitorjsontest.c | 1 + 4 files changed, 174 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-luks.result
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-luks-named-nodes.json @@ -0,0 +1,109 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "json:{\"driver\": \"luks\", \"file\": {\"driver\": \"file\", \"filename\": \"/var/lib/libvirt/images/luks\"}, \"key-secret\": \"virtio-disk0-luks-secret0\"}",
What a fun name. Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

--- .../qemumonitorjson-nodename-iscsi-blockstats.json | 113 ++++++++++++++++++++ ...qemumonitorjson-nodename-iscsi-named-nodes.json | 114 +++++++++++++++++++++ .../qemumonitorjson-nodename-iscsi.result | 13 +++ tests/qemumonitorjsontest.c | 1 + 4 files changed, 241 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-blockstats.json new file mode 100644 index 000000000..b13386ecb --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-blockstats.json @@ -0,0 +1,113 @@ +[ + { + "device": "drive-virtio-disk0", + "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": "#block038" + }, + "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": 995504, + "flush_operations": 0, + "wr_operations": 0, + "rd_merged": 0, + "rd_bytes": 512, + "invalid_flush_operations": 0, + "account_failed": true, + "idle_time_ns": 117550038551, + "rd_operations": 1, + "invalid_wr_operations": 0, + "invalid_rd_operations": 0 + }, + "node-name": "#block169" + }, + { + "device": "drive-scsi0-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": "#block250" + }, + "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 + }, + "node-name": "#block301" + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json new file mode 100644 index 000000000..6a04e62c0 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json @@ -0,0 +1,114 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 1073741824, + "filename": "json:{\"driver\": \"raw\", \"file\": {\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}}", + "format": "raw", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block301", + "backing_file_depth": 0, + "drv": "raw", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "json:{\"driver\": \"raw\", \"file\": {\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}}", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 1073741824, + "filename": "json:{\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}", + "format": "iscsi", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block250", + "backing_file_depth": 0, + "drv": "iscsi", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "json:{\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 1073741824, + "filename": "json:{\"driver\": \"raw\", \"file\": {\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}}", + "format": "raw", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block169", + "backing_file_depth": 0, + "drv": "raw", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "json:{\"driver\": \"raw\", \"file\": {\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}}", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 1073741824, + "filename": "json:{\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}", + "format": "iscsi", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block038", + "backing_file_depth": 0, + "drv": "iscsi", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "json:{\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}", + "encryption_key_missing": false + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result new file mode 100644 index 000000000..3ffe55340 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result @@ -0,0 +1,13 @@ +drive-scsi0-0-1 +filename : 'json:{"lun": "0", "portal": "example.com:3260", "driver": "iscsi", "transport": "tcp", "target": "iqn.2016-09.com.example:server"}' +format node : '#block301' +format drv : 'raw' +storage node: '#block250' +storage drv : 'iscsi' + +drive-virtio-disk0 +filename : 'json:{"lun": "0", "portal": "example.com:3260", "driver": "iscsi", "transport": "tcp", "target": "iqn.2016-09.com.example:server"}' +format node : '#block169' +format drv : 'raw' +storage node: '#block038' +storage drv : 'iscsi' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index f4169e550..150a1d879 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2937,6 +2937,7 @@ mymain(void) DO_TEST_BLOCK_NODE_DETECT("old"); DO_TEST_BLOCK_NODE_DETECT("empty"); DO_TEST_BLOCK_NODE_DETECT("luks"); + DO_TEST_BLOCK_NODE_DETECT("iscsi"); #undef DO_TEST_BLOCK_NODE_DETECT -- 2.13.2

On 07/26/2017 05:00 AM, Peter Krempa wrote:
--- .../qemumonitorjson-nodename-iscsi-blockstats.json | 113 ++++++++++++++++++++ ...qemumonitorjson-nodename-iscsi-named-nodes.json | 114 +++++++++++++++++++++ .../qemumonitorjson-nodename-iscsi.result | 13 +++ tests/qemumonitorjsontest.c | 1 + 4 files changed, 241 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result
+++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json @@ -0,0 +1,114 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 1073741824, + "filename": "json:{\"driver\": \"raw\", \"file\": {\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}}",
Another fun name. Reviewed-by: Eric Blake <eblake@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

So, this test fails on S390 because the actual test in testBlockNodeNameDetect is dependent on the ordering of the entries in the hash table, which is different on big endian machines. There are two other tests which have multiple results in the backing chain, 'same-backing' and 'relative', but their keys are reasonable similar that we got lucky and the hashes are ordered the same. I don't suspect that code that uses the tested function, qemuBlockNodeNameGetBackingChain, is dependent on the ordering of keys so this is actually only a problem in the test suite. Sorry for the late notice for this. Bjoern

On Wed, Aug 02, 2017 at 13:50:49 +0200, Bjoern Walk wrote:
So, this test fails on S390 because the actual test in testBlockNodeNameDetect is dependent on the ordering of the entries in the hash table, which is different on big endian machines.
There are two other tests which have multiple results in the backing chain, 'same-backing' and 'relative', but their keys are reasonable similar that we got lucky and the hashes are ordered the same.
I don't suspect that code that uses the tested function, qemuBlockNodeNameGetBackingChain, is dependent on the ordering of keys so this is actually only a problem in the test suite.
Yes, the hash function is non-deterministic. I'm working on mocking it so that it uses a simpler algorithm which will be endian independent.
Sorry for the late notice for this.
Well, since the issue is not in this series, but the other tests needing specific ordering were lucky enough to be ordered the same way, it was rather hard to catch.
Bjoern
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 07/26/2017 04:00 AM, Peter Krempa wrote:
--- .../qemumonitorjson-nodename-iscsi-blockstats.json | 113 ++++++++++++++++++++ ...qemumonitorjson-nodename-iscsi-named-nodes.json | 114 +++++++++++++++++++++ .../qemumonitorjson-nodename-iscsi.result | 13 +++ tests/qemumonitorjsontest.c | 1 + 4 files changed, 241 insertions(+) create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-blockstats.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json create mode 100644 tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result
FYI, I've noticed that this patch causes build failures of 3.6.0 on s390x and ppc64 [ 189s] 100) node-name-detect(iscsi) ... [ 189s] In '/home/abuild/rpmbuild/BUILD/libvirt-3.6.0/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result': [ 189s] Offset 6 [ 189s] Expect [scsi0-0-1 [ 189s] filename : 'json:{"lun": "0", "portal": "example.com:3260", "driver": "iscsi", "transport": "tcp", "target": "iqn.2016-09.com.example:server"}' [ 189s] format node : '#block301' [ 189s] format drv : 'raw' [ 189s] storage node: '#block250' [ 189s] storage drv : 'iscsi' [ 189s] [ 189s] drive-virtio-disk0 [ 189s] filename : 'json:{"lun": "0", "portal": "example.com:3260", "driver": "iscsi", "transport": "tcp", "target": "iqn.2016-09.com.example:server"}' [ 189s] format node : '#block169' [ 189s] format drv : 'raw' [ 189s] storage node: '#block038] [ 189s] Actual [virtio-disk0 [ 189s] filename : 'json:{"lun": "0", "portal": "example.com:3260", "driver": "iscsi", "transport": "tcp", "target": "iqn.2016-09.com.example:server"}' [ 189s] format node : '#block169' [ 189s] format drv : 'raw' [ 189s] storage node: '#block038' [ 189s] storage drv : 'iscsi' [ 189s] [ 189s] drive-scsi0-0-1 [ 189s] filename : 'json:{"lun": "0", "portal": "example.com:3260", "driver": "iscsi", "transport": "tcp", "target": "iqn.2016-09.com.example:server"}' [ 189s] format node : '#block301' [ 189s] format drv : 'raw' [ 189s] storage node: '#block250] [ 189s] ... FAILED As you can see the device order is swapped in the "Actual" output. It is odd that I don't see the failure on other arches. I have little experience with the monitor test code. Any ideas on what might cause that? Regards, Jim
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-blockstats.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-blockstats.json new file mode 100644 index 000000000..b13386ecb --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-blockstats.json @@ -0,0 +1,113 @@ +[ + { + "device": "drive-virtio-disk0", + "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": "#block038" + }, + "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": 995504, + "flush_operations": 0, + "wr_operations": 0, + "rd_merged": 0, + "rd_bytes": 512, + "invalid_flush_operations": 0, + "account_failed": true, + "idle_time_ns": 117550038551, + "rd_operations": 1, + "invalid_wr_operations": 0, + "invalid_rd_operations": 0 + }, + "node-name": "#block169" + }, + { + "device": "drive-scsi0-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": "#block250" + }, + "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 + }, + "node-name": "#block301" + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json new file mode 100644 index 000000000..6a04e62c0 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi-named-nodes.json @@ -0,0 +1,114 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 1073741824, + "filename": "json:{\"driver\": \"raw\", \"file\": {\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}}", + "format": "raw", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block301", + "backing_file_depth": 0, + "drv": "raw", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "json:{\"driver\": \"raw\", \"file\": {\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}}", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 1073741824, + "filename": "json:{\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}", + "format": "iscsi", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block250", + "backing_file_depth": 0, + "drv": "iscsi", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "json:{\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 1073741824, + "filename": "json:{\"driver\": \"raw\", \"file\": {\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}}", + "format": "raw", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block169", + "backing_file_depth": 0, + "drv": "raw", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "json:{\"driver\": \"raw\", \"file\": {\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}}", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 1073741824, + "filename": "json:{\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}", + "format": "iscsi", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "#block038", + "backing_file_depth": 0, + "drv": "iscsi", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "json:{\"lun\": \"0\", \"portal\": \"example.com:3260\", \"driver\": \"iscsi\", \"transport\": \"tcp\", \"target\": \"iqn.2016-09.com.example:server\"}", + "encryption_key_missing": false + } +] diff --git a/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result new file mode 100644 index 000000000..3ffe55340 --- /dev/null +++ b/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result @@ -0,0 +1,13 @@ +drive-scsi0-0-1 +filename : 'json:{"lun": "0", "portal": "example.com:3260", "driver": "iscsi", "transport": "tcp", "target": "iqn.2016-09.com.example:server"}' +format node : '#block301' +format drv : 'raw' +storage node: '#block250' +storage drv : 'iscsi' + +drive-virtio-disk0 +filename : 'json:{"lun": "0", "portal": "example.com:3260", "driver": "iscsi", "transport": "tcp", "target": "iqn.2016-09.com.example:server"}' +format node : '#block169' +format drv : 'raw' +storage node: '#block038' +storage drv : 'iscsi' diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index f4169e550..150a1d879 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2937,6 +2937,7 @@ mymain(void) DO_TEST_BLOCK_NODE_DETECT("old"); DO_TEST_BLOCK_NODE_DETECT("empty"); DO_TEST_BLOCK_NODE_DETECT("luks"); + DO_TEST_BLOCK_NODE_DETECT("iscsi");
#undef DO_TEST_BLOCK_NODE_DETECT

On 08/02/2017 05:13 PM, Jim Fehlig wrote:
FYI, I've noticed that this patch causes build failures of 3.6.0 on s390x and ppc64
[ 189s] 100) node-name-detect(iscsi) ... [ 189s] In '/home/abuild/rpmbuild/BUILD/libvirt-3.6.0/tests/qemumonitorjsondata/qemumonitorjson-nodename-iscsi.result':
[ 189s] Offset 6 [ 189s] Expect [scsi0-0-1 [ 189s] filename : 'json:{"lun": "0", "portal": "example.com:3260", "driver": "iscsi", "transport": "tcp", "target": "iqn.2016-09.com.example:server"}'
As you can see the device order is swapped in the "Actual" output. It is odd that I don't see the failure on other arches. I have little experience with the monitor test code. Any ideas on what might cause that?
Known issue with endianness affecting the mocked hashing; patch posted here: https://www.redhat.com/archives/libvir-list/2017-August/msg00091.html -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

On 07/26/2017 05:00 AM, Peter Krempa wrote:
Since query-blockstats provides full hierarchy of node names without any doubtful matching algorithm, use it to make the node name detector reliable.
Unfortunately some of the changes are ugly when viewed as a diff since they delete and rewrite chunks of code.
This series can be fetched at:
git fetch git://pipo.sk/pipo/libvirt.git node-name-detect-refactor-1
So far, I've just reviewed the patches, and found a few things to fix although the overall impression was good. I still hope to build and see if I can manage to find problems in my own testing, but don't let that be a bottleneck if you are trying to get this in before Thursday morning's freeze (ie. we can do followup patches if I find something later, if you can't wait for me to report results). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org

On Wed, Jul 26, 2017 at 17:20:33 -0500, Eric Blake wrote:
On 07/26/2017 05:00 AM, Peter Krempa wrote:
Since query-blockstats provides full hierarchy of node names without any doubtful matching algorithm, use it to make the node name detector reliable.
Unfortunately some of the changes are ugly when viewed as a diff since they delete and rewrite chunks of code.
This series can be fetched at:
git fetch git://pipo.sk/pipo/libvirt.git node-name-detect-refactor-1
So far, I've just reviewed the patches, and found a few things to fix although the overall impression was good. I still hope to build and see if I can manage to find problems in my own testing, but don't let that be a bottleneck if you are trying to get this in before Thursday morning's freeze (ie. we can do followup patches if I find something later, if you can't wait for me to report results).
I've pushed 23 of the 24 patches that had the R-b tag. I'll try to come up wit a better solution for the 'nothing' marker. Thanks for the very quick review.
participants (4)
-
Bjoern Walk
-
Eric Blake
-
Jim Fehlig
-
Peter Krempa