Lines Matching +full:protocol +full:- +full:node
33 rm -f "$EXT_MP"
34 rm -f "$COPIED_IMG"
56 # $2: Options (beyond the node-name and ID)
58 # $4: Node to export (defaults to 'node-format')
61 # The grep -v is a filter for errors when /etc/fuse.conf does not contain
65 "{'execute': 'block-export-add',
69 'node-name': '${4:-node-format}',
72 "${3:-return}" \
74 | grep -v 'option allow_other only allowed if'
82 "{'execute': 'block-export-del',
92 # Return the length of the protocol file
93 # $1: Protocol node export mount point
97 len1=$(stat -c '%s' "$1")
98 len2=$(stat -c '%s' "$2")
117 $QEMU_IO -c 'write -s /dev/urandom 0 64M' "$TEST_IMG" | _filter_qemu_io
124 # Separate blockdev-add calls for format and protocol so we can remove
127 "{'execute': 'blockdev-add',
130 'node-name': 'node-protocol',
136 "{'execute': 'blockdev-add',
139 'node-name': 'node-format',
140 'file': 'node-protocol'
148 rm -f "$EXT_MP"
149 output=$(fuse_export_add 'export-err' "'mountpoint': '$EXT_MP'" error)
151 if echo "$output" | grep -q "Parameter 'type' does not accept value 'fuse'"; then
161 fuse_export_add 'export-err' "'mountpoint': '$EXT_MP'" error
168 fuse_export_add 'export-mp' "'mountpoint': '$EXT_MP'"
171 $QEMU_IMG compare -f raw -F $IMGFMT -U "$EXT_MP" "$TEST_IMG"
174 stat -c 'Permissions pre-chmod: %a' "$EXT_MP"
178 stat -c 'Permissions post-+w: %a' "$EXT_MP"
182 stat -c 'Permissions post-+x: %a' "$EXT_MP"
189 fuse_export_add 'export-img' "'mountpoint': '$TEST_IMG'"
192 $QEMU_IMG compare -f raw -F raw -U "$EXT_MP" "$TEST_IMG"
201 # $TEST_IMG will be in mode 0400 because it is read-only; we are going
208 # We have already seen that exporting a node twice works fine, but you
214 fuse_export_add 'export-err' "'mountpoint': '$EXT_MP'" error
219 # Double-check that $EXT_MP appears as a non-empty file (the raw image)
220 $QEMU_IMG info -f raw "$EXT_MP" | grep 'virtual size' | head -n 1
222 fuse_export_del 'export-mp'
225 $QEMU_IMG info -f raw "$EXT_MP" | grep 'virtual size' | head -n 1
230 fuse_export_add 'export-mp' "'mountpoint': '$EXT_MP', 'writable': true"
232 # Check that writing to the read-only export fails
233 output=$($QEMU_IO -f raw -c 'write -P 42 1M 64k' "$TEST_IMG" 2>&1 \
240 if echo "$output" | grep -q "$reference"; then
241 echo "Writing to read-only export failed: OK"
242 elif echo "$output" | grep -q "write failed: Permission denied"; then
251 echo "Writing to read-only export failed: OK"
253 echo "Writing to read-only export failed: ERROR"
258 $QEMU_IO -f raw -c 'write -P 42 1M 64k' "$EXT_MP" | _filter_qemu_io
261 $QEMU_IO -f raw -c 'write -P 42 1M 64k' "$COPIED_IMG" | _filter_qemu_io
266 # Here, we need to export the protocol node -- the format layer may
269 # Remove all exports and the format node first so permissions will not
271 fuse_export_del 'export-mp'
272 fuse_export_del 'export-img'
275 "{'execute': 'blockdev-del',
277 'node-name': 'node-format'
281 # Now export the protocol node
283 'export-mp' \
286 'node-protocol'
289 echo '--- Try growing non-growable export ---'
293 orig_disk_usage=$(stat -c '%b' "$TEST_IMG")
295 # Should fail (exports are non-growable by default)
296 # (Note that qemu-io can never write beyond the EOF, so we have to use
302 echo '--- Resize export ---'
305 fallocate -o "$orig_len" -l 64k "$EXT_MP"
309 echo 'ERROR: Unexpected post-truncate image size:'
312 echo 'OK: Post-truncate image size is as expected'
315 new_disk_usage=$(stat -c '%b' "$TEST_IMG")
316 if [ "$new_disk_usage" -gt "$orig_disk_usage" ]; then
324 echo '--- Try growing growable export ---'
327 fuse_export_del 'export-mp'
329 'export-mp' \
332 'node-protocol'
340 echo 'ERROR: Unexpected post-grow image size:'
343 echo 'OK: Post-grow image size is as expected'
347 echo '--- Shrink export ---'
350 truncate -s "$orig_len" "$EXT_MP"
354 echo 'ERROR: Unexpected post-truncate image size:'
357 echo 'OK: Post-truncate image size is as expected'
372 $QEMU_IMG compare -f raw -F $IMGFMT "$COPIED_IMG" "$TEST_IMG"
377 # Regression test for https://gitlab.com/qemu-project/qemu/-/issues/1507
379 $QEMU_IO -c 'write -s /dev/urandom 0 64M' "$TEST_IMG" | _filter_qemu_io
387 "{'execute': 'blockdev-add',
390 'node-name': 'node-format',
401 $QEMU_IO -f raw -c 'write -zu 0 64M' "$EXT_MP" | _filter_qemu_io
404 $QEMU_IO -f raw -c 'read -P 0 0 64M' "$EXT_MP" | _filter_qemu_io
413 $QEMU_IO -c 'read -P 0 0 64M' "$TEST_IMG" | _filter_qemu_io
419 rm -f $seq.full