Blame SOURCES/kvm-qemu-iotests-Test-query-blockstats-with-drive-and-bl.patch

357786
From fa169d0d6e7109c79f3fb517e0ce695ed1954965 Mon Sep 17 00:00:00 2001
357786
From: Kevin Wolf <kwolf@redhat.com>
357786
Date: Tue, 7 Aug 2018 14:04:01 +0200
357786
Subject: [PATCH 08/13] qemu-iotests: Test query-blockstats with -drive and
357786
 -blockdev
357786
357786
RH-Author: Kevin Wolf <kwolf@redhat.com>
357786
Message-id: <20180807140401.23995-4-kwolf@redhat.com>
357786
Patchwork-id: 81665
357786
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 3/3] qemu-iotests: Test query-blockstats with -drive and -blockdev
357786
Bugzilla: 1612114
357786
RH-Acked-by: John Snow <jsnow@redhat.com>
357786
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
357786
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
357786
357786
Make sure that query-blockstats returns information for every
357786
BlockBackend that is named or attached to a device model (or both).
357786
357786
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
357786
Reviewed-by: Eric Blake <eblake@redhat.com>
357786
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
357786
(cherry picked from commit 1239ac241fe170bb9fcf0be74bfff04f6f1c2560)
357786
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 tests/qemu-iotests/227     | 101 ++++++++++++++++++++++
357786
 tests/qemu-iotests/227.out | 205 +++++++++++++++++++++++++++++++++++++++++++++
357786
 tests/qemu-iotests/group   |   1 +
357786
 3 files changed, 307 insertions(+)
357786
 create mode 100755 tests/qemu-iotests/227
357786
 create mode 100644 tests/qemu-iotests/227.out
357786
357786
diff --git a/tests/qemu-iotests/227 b/tests/qemu-iotests/227
357786
new file mode 100755
357786
index 0000000..9a5f7f9
357786
--- /dev/null
357786
+++ b/tests/qemu-iotests/227
357786
@@ -0,0 +1,101 @@
357786
+#!/bin/bash
357786
+#
357786
+# Test query-blockstats with different ways to create a BB
357786
+#
357786
+# Copyright (C) 2018 Red Hat, Inc.
357786
+#
357786
+# This program is free software; you can redistribute it and/or modify
357786
+# it under the terms of the GNU General Public License as published by
357786
+# the Free Software Foundation; either version 2 of the License, or
357786
+# (at your option) any later version.
357786
+#
357786
+# This program is distributed in the hope that it will be useful,
357786
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
357786
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
357786
+# GNU General Public License for more details.
357786
+#
357786
+# You should have received a copy of the GNU General Public License
357786
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
357786
+#
357786
+
357786
+# creator
357786
+owner=kwolf@redhat.com
357786
+
357786
+seq=$(basename $0)
357786
+echo "QA output created by $seq"
357786
+
357786
+here=$PWD
357786
+status=1	# failure is the default!
357786
+
357786
+_cleanup()
357786
+{
357786
+    _cleanup_test_img
357786
+}
357786
+trap "_cleanup; exit \$status" 0 1 2 3 15
357786
+
357786
+# get standard environment, filters and checks
357786
+. ./common.rc
357786
+. ./common.filter
357786
+
357786
+_supported_fmt generic
357786
+_supported_proto file
357786
+_supported_os Linux
357786
+
357786
+function do_run_qemu()
357786
+{
357786
+    echo Testing: "$@"
357786
+    $QEMU -nographic -qmp-pretty stdio -serial none "$@"
357786
+    echo
357786
+}
357786
+
357786
+function run_qemu()
357786
+{
357786
+    do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
357786
+                          | _filter_qemu | _filter_imgfmt \
357786
+                          | _filter_generated_node_ids
357786
+}
357786
+
357786
+echo
357786
+echo '=== blockstats with -drive if=virtio ==='
357786
+echo
357786
+
357786
+run_qemu -drive driver=null-co,if=virtio <
357786
+{ "execute": "qmp_capabilities" }
357786
+{ "execute": "query-blockstats"}
357786
+{ "execute": "quit" }
357786
+EOF
357786
+
357786
+echo
357786
+echo '=== blockstats with -drive if=none ==='
357786
+echo
357786
+
357786
+run_qemu -drive driver=null-co,if=none <
357786
+{ "execute": "qmp_capabilities" }
357786
+{ "execute": "query-blockstats"}
357786
+{ "execute": "quit" }
357786
+EOF
357786
+
357786
+echo
357786
+echo '=== blockstats with -blockdev ==='
357786
+echo
357786
+
357786
+run_qemu -blockdev driver=null-co,node-name=null <
357786
+{ "execute": "qmp_capabilities" }
357786
+{ "execute": "query-blockstats"}
357786
+{ "execute": "quit" }
357786
+EOF
357786
+
357786
+echo
357786
+echo '=== blockstats with -blockdev and -device ==='
357786
+echo
357786
+
357786
+run_qemu -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0 <
357786
+{ "execute": "qmp_capabilities" }
357786
+{ "execute": "query-blockstats"}
357786
+{ "execute": "quit" }
357786
+EOF
357786
+
357786
+# success, all done
357786
+echo "*** done"
357786
+rm -f $seq.full
357786
+status=0
357786
diff --git a/tests/qemu-iotests/227.out b/tests/qemu-iotests/227.out
357786
new file mode 100644
357786
index 0000000..736f2e3
357786
--- /dev/null
357786
+++ b/tests/qemu-iotests/227.out
357786
@@ -0,0 +1,205 @@
357786
+QA output created by 227
357786
+
357786
+=== blockstats with -drive if=virtio ===
357786
+
357786
+Testing: -drive driver=null-co,if=virtio
357786
+{
357786
+    QMP_VERSION
357786
+}
357786
+{
357786
+    "return": {
357786
+    }
357786
+}
357786
+{
357786
+    "return": [
357786
+        {
357786
+            "device": "virtio0",
357786
+            "stats": {
357786
+                "flush_total_time_ns": 0,
357786
+                "wr_highest_offset": 0,
357786
+                "wr_total_time_ns": 0,
357786
+                "failed_wr_operations": 0,
357786
+                "failed_rd_operations": 0,
357786
+                "wr_merged": 0,
357786
+                "wr_bytes": 0,
357786
+                "timed_stats": [
357786
+                ],
357786
+                "failed_flush_operations": 0,
357786
+                "account_invalid": true,
357786
+                "rd_total_time_ns": 0,
357786
+                "flush_operations": 0,
357786
+                "wr_operations": 0,
357786
+                "rd_merged": 0,
357786
+                "rd_bytes": 0,
357786
+                "invalid_flush_operations": 0,
357786
+                "account_failed": true,
357786
+                "rd_operations": 0,
357786
+                "invalid_wr_operations": 0,
357786
+                "invalid_rd_operations": 0
357786
+            },
357786
+            "node-name": "NODE_NAME",
357786
+            "qdev": "/machine/peripheral-anon/device[0]/virtio-backend"
357786
+        }
357786
+    ]
357786
+}
357786
+{
357786
+    "return": {
357786
+    }
357786
+}
357786
+{
357786
+    "timestamp": {
357786
+        "seconds":  TIMESTAMP,
357786
+        "microseconds":  TIMESTAMP
357786
+    },
357786
+    "event": "SHUTDOWN",
357786
+    "data": {
357786
+        "guest": false
357786
+    }
357786
+}
357786
+
357786
+
357786
+=== blockstats with -drive if=none ===
357786
+
357786
+Testing: -drive driver=null-co,if=none
357786
+{
357786
+    QMP_VERSION
357786
+}
357786
+{
357786
+    "return": {
357786
+    }
357786
+}
357786
+{
357786
+    "return": [
357786
+        {
357786
+            "device": "none0",
357786
+            "stats": {
357786
+                "flush_total_time_ns": 0,
357786
+                "wr_highest_offset": 0,
357786
+                "wr_total_time_ns": 0,
357786
+                "failed_wr_operations": 0,
357786
+                "failed_rd_operations": 0,
357786
+                "wr_merged": 0,
357786
+                "wr_bytes": 0,
357786
+                "timed_stats": [
357786
+                ],
357786
+                "failed_flush_operations": 0,
357786
+                "account_invalid": true,
357786
+                "rd_total_time_ns": 0,
357786
+                "flush_operations": 0,
357786
+                "wr_operations": 0,
357786
+                "rd_merged": 0,
357786
+                "rd_bytes": 0,
357786
+                "invalid_flush_operations": 0,
357786
+                "account_failed": true,
357786
+                "rd_operations": 0,
357786
+                "invalid_wr_operations": 0,
357786
+                "invalid_rd_operations": 0
357786
+            },
357786
+            "node-name": "NODE_NAME"
357786
+        }
357786
+    ]
357786
+}
357786
+{
357786
+    "return": {
357786
+    }
357786
+}
357786
+{
357786
+    "timestamp": {
357786
+        "seconds":  TIMESTAMP,
357786
+        "microseconds":  TIMESTAMP
357786
+    },
357786
+    "event": "SHUTDOWN",
357786
+    "data": {
357786
+        "guest": false
357786
+    }
357786
+}
357786
+
357786
+
357786
+=== blockstats with -blockdev ===
357786
+
357786
+Testing: -blockdev driver=null-co,node-name=null
357786
+{
357786
+    QMP_VERSION
357786
+}
357786
+{
357786
+    "return": {
357786
+    }
357786
+}
357786
+{
357786
+    "return": [
357786
+    ]
357786
+}
357786
+{
357786
+    "return": {
357786
+    }
357786
+}
357786
+{
357786
+    "timestamp": {
357786
+        "seconds":  TIMESTAMP,
357786
+        "microseconds":  TIMESTAMP
357786
+    },
357786
+    "event": "SHUTDOWN",
357786
+    "data": {
357786
+        "guest": false
357786
+    }
357786
+}
357786
+
357786
+
357786
+=== blockstats with -blockdev and -device ===
357786
+
357786
+Testing: -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0
357786
+{
357786
+    QMP_VERSION
357786
+}
357786
+{
357786
+    "return": {
357786
+    }
357786
+}
357786
+{
357786
+    "return": [
357786
+        {
357786
+            "device": "",
357786
+            "stats": {
357786
+                "flush_total_time_ns": 0,
357786
+                "wr_highest_offset": 0,
357786
+                "wr_total_time_ns": 0,
357786
+                "failed_wr_operations": 0,
357786
+                "failed_rd_operations": 0,
357786
+                "wr_merged": 0,
357786
+                "wr_bytes": 0,
357786
+                "timed_stats": [
357786
+                ],
357786
+                "failed_flush_operations": 0,
357786
+                "account_invalid": false,
357786
+                "rd_total_time_ns": 0,
357786
+                "flush_operations": 0,
357786
+                "wr_operations": 0,
357786
+                "rd_merged": 0,
357786
+                "rd_bytes": 0,
357786
+                "invalid_flush_operations": 0,
357786
+                "account_failed": false,
357786
+                "rd_operations": 0,
357786
+                "invalid_wr_operations": 0,
357786
+                "invalid_rd_operations": 0
357786
+            },
357786
+            "node-name": "null",
357786
+            "qdev": "/machine/peripheral/virtio0/virtio-backend"
357786
+        }
357786
+    ]
357786
+}
357786
+{
357786
+    "return": {
357786
+    }
357786
+}
357786
+{
357786
+    "timestamp": {
357786
+        "seconds":  TIMESTAMP,
357786
+        "microseconds":  TIMESTAMP
357786
+    },
357786
+    "event": "SHUTDOWN",
357786
+    "data": {
357786
+        "guest": false
357786
+    }
357786
+}
357786
+
357786
+*** done
357786
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
357786
index e479fe1..6dd146a 100644
357786
--- a/tests/qemu-iotests/group
357786
+++ b/tests/qemu-iotests/group
357786
@@ -222,3 +222,4 @@
357786
 222 rw auto quick
357786
 223 rw auto quick
357786
 226 auto quick
357786
+227 auto quick
357786
-- 
357786
1.8.3.1
357786