3 # Test I/O throttle block filter driver interface
5 # Copyright (C) 2017 Manos Pitsidianakis
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 owner
="Manos Pitsidianakis"
25 echo "QA output created by $seq"
28 status
=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
44 function do_run_qemu
()
46 echo Testing
: "$@" | _filter_imgfmt
47 $QEMU -nographic -qmp-pretty stdio
-serial none
"$@"
53 do_run_qemu
"$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
54 | _filter_qemu_io | _filter_generated_node_ids \
55 | _filter_actual_image_size
59 test_throttle
=$
($QEMU_IMG --help|
grep throttle
)
60 [ "$test_throttle" = "" ] && _supported_fmt throttle
63 echo "== checking interface =="
66 { "execute": "qmp_capabilities" }
67 { "execute": "blockdev-add",
73 "filename": "$TEST_IMG"
77 { "execute": "object-add",
79 "qom-type": "throttle-group",
88 { "execute": "blockdev-add",
91 "node-name": "throttle0",
92 "throttle-group": "group0",
96 { "execute": "query-named-block-nodes" }
97 { "execute": "query-block" }
102 echo "== property changes in ThrottleGroup =="
105 { "execute": "qmp_capabilities" }
106 { "execute": "object-add",
108 "qom-type": "throttle-group",
117 { "execute" : "qom-get",
120 "property" : "limits"
123 { "execute" : "qom-set",
126 "property" : "limits",
132 { "execute" : "qom-get",
135 "property" : "limits"
138 { "execute": "quit" }
142 echo "== object creation/set errors =="
145 { "execute": "qmp_capabilities" }
146 { "execute": "object-add",
148 "qom-type": "throttle-group",
157 { "execute" : "qom-set",
160 "property" : "x-iops-total",
164 { "execute" : "qom-set",
167 "property" : "limits",
174 { "execute": "quit" }
178 echo "== don't specify group =="
181 { "execute": "qmp_capabilities" }
182 { "execute": "blockdev-add",
185 "node-name": "disk0",
188 "filename": "$TEST_IMG"
192 { "execute": "blockdev-add",
194 "driver": "throttle",
195 "node-name": "throttle0",
199 { "execute": "quit" }