[libvirt] [PATCH 24/24] tests: qemumonitorjson: Test extraction of iSCSI device node names

Jim Fehlig jfehlig at suse.com
Wed Aug 2 22:13:11 UTC 2017


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
> 




More information about the libvir-list mailing list