]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/qemu: switch nbd devices from virtio to ide
authorOr Ozeri <oro@il.ibm.com>
Tue, 7 Dec 2021 13:04:00 +0000 (15:04 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 27 Jan 2022 20:28:35 +0000 (21:28 +0100)
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 <oro@il.ibm.com>
(cherry picked from commit 555a2896d74511271303d901e9da29d765f31637)

qa/tasks/qemu.py

index 673ccdb144f943e5312362db3484e71ae21ecdac..0d984e75bfa2f78142ee07cda5da5e05efd4fd15 100644 (file)
@@ -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,
                     ),
                 ])