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

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