4 # Test I/O throttle block filter driver interface
6 # Copyright (C) 2017 Manos Pitsidianakis
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 owner="Manos Pitsidianakis"
26 echo "QA output created by $seq"
28 status=1 # failure is the default!
30 trap "exit \$status" 0 1 2 3 15
32 # get standard environment, filters and checks
37 _require_drivers throttle
41 echo Testing: "$@" | _filter_imgfmt
42 $QEMU -nographic -qmp-pretty stdio -serial none "$@"
48 do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
49 | _filter_qemu_io | _filter_generated_node_ids
52 test_throttle=$($QEMU_IMG --help|grep throttle)
53 [ "$test_throttle" = "" ] && _supported_fmt throttle
56 echo "== checking interface =="
59 { "execute": "qmp_capabilities" }
60 { "execute": "blockdev-add",
66 { "execute": "object-add",
68 "qom-type": "throttle-group",
75 { "execute": "blockdev-add",
78 "node-name": "throttle0",
79 "throttle-group": "group0",
83 { "execute": "query-named-block-nodes" }
84 { "execute": "query-block" }
89 echo "== property changes in ThrottleGroup =="
92 { "execute": "qmp_capabilities" }
93 { "execute": "object-add",
95 "qom-type": "throttle-group",
102 { "execute" : "qom-get",
105 "property" : "limits"
108 { "execute" : "qom-set",
111 "property" : "limits",
117 { "execute" : "qom-get",
120 "property" : "limits"
123 { "execute": "quit" }
127 echo "== object creation/set errors =="
130 { "execute": "qmp_capabilities" }
131 { "execute": "object-add",
133 "qom-type": "throttle-group",
140 { "execute" : "qom-set",
143 "property" : "x-iops-total",
147 { "execute" : "qom-set",
150 "property" : "limits",
157 { "execute": "quit" }
161 echo "== don't specify group =="
164 { "execute": "qmp_capabilities" }
165 { "execute": "blockdev-add",
171 { "execute": "blockdev-add",
173 "driver": "throttle",
174 "node-name": "throttle0",
178 { "execute": "quit" }