From afc89fdde80fb53b7145b1d0aa342af5a35ec815 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Tue, 28 Jan 2025 09:33:37 +0100 Subject: [PATCH] qa/workunits/rbd: add test_import_nbd_stream_disconnected() When the NBD server is killed, nbd_pread() can set errno to at least ENOTCONN, EINVAL and 0 which is supposed to stand for "no additional errno information is available for this error". Add a test to ensure that "rbd migration execute" command always fails and that the image isn't transitioned to MIGRATION_STATE_EXECUTED in this scenario. Signed-off-by: Ilya Dryomov --- .../rbd/cli/workloads/rbd_cli_migration.yaml | 8 +++ qa/workunits/rbd/cli_migration.sh | 64 +++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/qa/suites/rbd/cli/workloads/rbd_cli_migration.yaml b/qa/suites/rbd/cli/workloads/rbd_cli_migration.yaml index b04ac08f7b4..96845dce436 100644 --- a/qa/suites/rbd/cli/workloads/rbd_cli_migration.yaml +++ b/qa/suites/rbd/cli/workloads/rbd_cli_migration.yaml @@ -1,3 +1,11 @@ +overrides: + install: + extra_system_packages: + rpm: + - qemu-kvm-block-rbd + deb: + - qemu-block-extra + - qemu-utils tasks: - workunit: clients: diff --git a/qa/workunits/rbd/cli_migration.sh b/qa/workunits/rbd/cli_migration.sh index 3af19420957..d4bcf7f77df 100755 --- a/qa/workunits/rbd/cli_migration.sh +++ b/qa/workunits/rbd/cli_migration.sh @@ -596,6 +596,68 @@ EOF kill_nbd_server } +test_import_nbd_stream_disconnected() { + local dest_image=$1 + local migration_execute_pid + + dd if=/dev/urandom of=${TEMPDIR}/large.raw bs=1M count=20480 + qemu-nbd -f raw --read-only --shared 10 --persistent --fork \ + ${TEMPDIR}/large.raw + + cat > ${TEMPDIR}/spec.json <&1 | wc -l | grep -v '^0$' && echo "nonempty rbd pool, aborting! run this script on an empty test cluster only." && exit 1 @@ -614,6 +676,8 @@ test_import_nbd_stream_qcow2 ${IMAGE2} ${IMAGE3} test_import_raw_format ${IMAGE1} ${IMAGE2} test_import_nbd_stream_raw ${IMAGE1} ${IMAGE2} +test_import_nbd_stream_disconnected ${IMAGE2} + rbd namespace create rbd/${NAMESPACE1} rbd namespace create rbd/${NAMESPACE2} create_base_image rbd/${NAMESPACE1}/${IMAGE1} -- 2.47.3