From 1bf26076d677f693dd99a6e8ef2eca69b842d873 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Tue, 9 Mar 2021 18:34:51 +0100 Subject: stream: Don't crash when node permission is denied The image streaming block job restricts shared permissions of the nodes it accesses. This can obviously fail when other users already got these permissions. &error_abort is therefore wrong and can crash. Handle these errors gracefully and just fail starting the block job. Reported-by: Nini Gu Signed-off-by: Kevin Wolf Message-Id: <20210309173451.45152-1-kwolf@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Alberto Garcia Signed-off-by: Kevin Wolf --- tests/qemu-iotests/tests/qsd-jobs | 20 ++++++++++++++++++++ tests/qemu-iotests/tests/qsd-jobs.out | 10 ++++++++++ 2 files changed, 30 insertions(+) (limited to 'tests/qemu-iotests') diff --git a/tests/qemu-iotests/tests/qsd-jobs b/tests/qemu-iotests/tests/qsd-jobs index 1a1c534fac..972b6b3898 100755 --- a/tests/qemu-iotests/tests/qsd-jobs +++ b/tests/qemu-iotests/tests/qsd-jobs @@ -30,6 +30,7 @@ status=1 # failure is the default! _cleanup() { _cleanup_test_img + rm -f "$SOCK_DIR/nbd.sock" } trap "_cleanup; exit \$status" 0 1 2 3 15 @@ -59,6 +60,25 @@ $QSD --chardev stdio,id=stdio --monitor chardev=stdio \ {"execute": "quit"} EOF +echo +echo "=== Streaming can't get permission on base node ===" +echo + +# Just make sure that this doesn't crash +$QSD --chardev stdio,id=stdio --monitor chardev=stdio \ + --blockdev node-name=file_base,driver=file,filename="$TEST_IMG.base" \ + --blockdev node-name=fmt_base,driver=qcow2,file=file_base \ + --blockdev node-name=file_overlay,driver=file,filename="$TEST_IMG" \ + --blockdev node-name=fmt_overlay,driver=qcow2,file=file_overlay,backing=fmt_base \ + --nbd-server addr.type=unix,addr.path="$SOCK_DIR/nbd.sock" \ + --export type=nbd,id=export1,node-name=fmt_base,writable=on,name=export1 \ + <