From 555a2896d74511271303d901e9da29d765f31637 Mon Sep 17 00:00:00 2001 From: Or Ozeri Date: Tue, 7 Dec 2021 15:04:00 +0200 Subject: [PATCH 1/3] qa/tasks/qemu: switch nbd devices from virtio to ide This commit is a workaround of a bug in the virtio interface in qemu 6.1.0+. Fixes: https://tracker.ceph.com/issues/53587 Signed-off-by: Or Ozeri --- qa/tasks/qemu.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/qa/tasks/qemu.py b/qa/tasks/qemu.py index 673ccdb144f..0d984e75bfa 100644 --- a/qa/tasks/qemu.py +++ b/qa/tasks/qemu.py @@ -203,14 +203,18 @@ def generate_iso(ctx, config): 'device_letter' not in disk or \ 'image_url' in disk: continue - dev_letter = disk['device_letter'] + if disk['encryption_format'] == 'none': + dev_name = 'vd' + disk['device_letter'] + else: + # encrypted disks use if=ide interface, instead of if=virtio + dev_name = 'sd' + disk['device_letter'] user_data += """ - | #!/bin/bash - mkdir /mnt/test_{dev_letter} - mkfs -t xfs /dev/vd{dev_letter} - mount -t xfs /dev/vd{dev_letter} /mnt/test_{dev_letter} -""".format(dev_letter=dev_letter) + mkdir /mnt/test_{dev_name} + mkfs -t xfs /dev/{dev_name} + mount -t xfs /dev/{dev_name} /mnt/test_{dev_name} +""".format(dev_name=dev_name) user_data += """ - | @@ -496,17 +500,23 @@ def run_qemu(ctx, config): continue if disk['encryption_format'] == 'none': + interface = 'virtio' disk_spec = 'rbd:rbd/{img}:id={id}'.format( img=disk['image_name'], id=client[len('client.'):] ) else: + # encrypted disks use ide as a temporary workaround for + # a bug in qemu when using virtio over nbd + # TODO: use librbd encryption directly via qemu (not via nbd) + interface = 'ide' disk_spec = disk['device_path'] args.extend([ '-drive', - 'file={disk_spec},format=raw,if=virtio,cache={cachemode}'.format( + 'file={disk_spec},format=raw,if={interface},cache={cachemode}'.format( disk_spec=disk_spec, + interface=interface, cachemode=cachemode, ), ]) From 1f0782057993b4658a2c8b4bb671a69863e78015 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Sat, 22 Jan 2022 11:49:46 +0100 Subject: [PATCH 2/3] qa/run_xfstests_qemu.sh: fall back to ide disks if needed Signed-off-by: Ilya Dryomov --- qa/run_xfstests_qemu.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/qa/run_xfstests_qemu.sh b/qa/run_xfstests_qemu.sh index 40300cea6fe..8463a12dc49 100644 --- a/qa/run_xfstests_qemu.sh +++ b/qa/run_xfstests_qemu.sh @@ -15,10 +15,19 @@ cd "${TESTDIR}" wget -O "${SCRIPT}" "${URL_BASE}/${SCRIPT}" chmod +x "${SCRIPT}" +TEST_DEV="/dev/vdb" +if [[ ! -b "${TEST_DEV}" ]]; then + TEST_DEV="/dev/sdb" +fi +SCRATCH_DEV="/dev/vdc" +if [[ ! -b "${SCRATCH_DEV}" ]]; then + SCRATCH_DEV="/dev/sdc" +fi + # tests excluded fail in the current testing vm regardless of whether # rbd is used -./"${SCRIPT}" -c 1 -f xfs -t /dev/vdb -s /dev/vdc \ +./"${SCRIPT}" -c 1 -f xfs -t "${TEST_DEV}" -s "${SCRATCH_DEV}" \ 1-7 9-17 19-26 28-49 51-61 63 66-67 69-79 83 85-105 108-110 112-135 \ 137-170 174-191 193-204 206-217 220-227 230-231 233 235-241 243-249 \ 251-262 264-278 281-286 288-289 From b274bca1b2dfd7a46f66d2075f20fba2d2b1f73b Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Sun, 23 Jan 2022 16:32:57 +0100 Subject: [PATCH 3/3] qa/run_xfstests_qemu.sh: disable 251, 260 and 288 All three are skipped with virtio disks: 251 [not run] FITRIM not supported on /dev/vdc 260 [not run] FITRIM not supported on /dev/vdc 288 [not run] FITRIM not supported on /dev/vdc But 260 and 288 fail with ide disks, where discard defaults to on. The ancient kernel in our ubuntu-12.04.qcow2 doesn't support virtio discard anyway so let's just disable them for consistency. Signed-off-by: Ilya Dryomov --- qa/run_xfstests_qemu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qa/run_xfstests_qemu.sh b/qa/run_xfstests_qemu.sh index 8463a12dc49..1b5feadd363 100644 --- a/qa/run_xfstests_qemu.sh +++ b/qa/run_xfstests_qemu.sh @@ -30,7 +30,7 @@ fi ./"${SCRIPT}" -c 1 -f xfs -t "${TEST_DEV}" -s "${SCRATCH_DEV}" \ 1-7 9-17 19-26 28-49 51-61 63 66-67 69-79 83 85-105 108-110 112-135 \ 137-170 174-191 193-204 206-217 220-227 230-231 233 235-241 243-249 \ - 251-262 264-278 281-286 288-289 + 252-259 261-262 264-278 281-286 289 STATUS=$? rm -f "${SCRIPT}"