Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210409' into staging
[qemu/ar7.git] / tests / qemu-iotests / tests / qsd-jobs
blob972b6b3898b81e81e1bc28f346146975ec1882d0
1 #!/usr/bin/env bash
2 # group: rw auto quick qsd
4 # Job tests related specifically to qemu-storage-daemon
6 # Copyright (C) 2021 Red Hat, Inc.
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/>.
22 # creator
23 owner=kwolf@redhat.com
25 seq="$(basename $0)"
26 echo "QA output created by $seq"
28 status=1 # failure is the default!
30 _cleanup()
32 _cleanup_test_img
33 rm -f "$SOCK_DIR/nbd.sock"
35 trap "_cleanup; exit \$status" 0 1 2 3 15
37 # get standard environment, filters and checks
38 cd ..
39 . ./common.rc
40 . ./common.filter
42 _supported_fmt qcow2
43 _supported_proto generic
45 size=128M
47 TEST_IMG="$TEST_IMG.base" _make_test_img $size
48 _make_test_img -b "$TEST_IMG.base" -F $IMGFMT
50 echo
51 echo "=== Job still present at shutdown ==="
52 echo
54 # Just make sure that this doesn't crash
55 $QSD --chardev stdio,id=stdio --monitor chardev=stdio \
56 --blockdev node-name=file0,driver=file,filename="$TEST_IMG" \
57 --blockdev node-name=fmt0,driver=qcow2,file=file0 <<EOF | _filter_qmp
58 {"execute":"qmp_capabilities"}
59 {"execute": "block-commit", "arguments": {"device": "fmt0", "job-id": "job0"}}
60 {"execute": "quit"}
61 EOF
63 echo
64 echo "=== Streaming can't get permission on base node ==="
65 echo
67 # Just make sure that this doesn't crash
68 $QSD --chardev stdio,id=stdio --monitor chardev=stdio \
69 --blockdev node-name=file_base,driver=file,filename="$TEST_IMG.base" \
70 --blockdev node-name=fmt_base,driver=qcow2,file=file_base \
71 --blockdev node-name=file_overlay,driver=file,filename="$TEST_IMG" \
72 --blockdev node-name=fmt_overlay,driver=qcow2,file=file_overlay,backing=fmt_base \
73 --nbd-server addr.type=unix,addr.path="$SOCK_DIR/nbd.sock" \
74 --export type=nbd,id=export1,node-name=fmt_base,writable=on,name=export1 \
75 <<EOF | _filter_qmp
76 {"execute": "qmp_capabilities"}
77 {"execute": "block-stream",
78 "arguments": {"device": "fmt_overlay", "job-id": "job0"}}
79 {"execute": "quit"}
80 EOF
82 # success, all done
83 echo "*** done"
84 rm -f $seq.full
85 status=0