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

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