]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/tasks/nvme_loop: fix nvme loop task for ubuntu noble
authorAdam King <adking@redhat.com>
Tue, 16 Sep 2025 16:07:36 +0000 (12:07 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Fri, 22 May 2026 22:54:33 +0000 (18:54 -0400)
Compared to older distros, this one complains if
you include `-q hostnqn` in the nvme connect command,
saying "Failed to write to /dev/nvme-fabrics: Invalid argument".
Removing that argument gets passed that error and
doesn't seem to have any downsides

Signed-off-by: Adam King <adking@redhat.com>
qa/tasks/nvme_loop.py

index fdec467a16d247046cedd2c384b8b4ff8b91c993..8f3ab42012eca44baa93e3fa3564e9a79af1ca27 100644 (file)
@@ -37,30 +37,39 @@ def task(ctx, config):
                 'sudo', 'tee', f'{base}/ports/{port}/addr_trtype',
             ]
         )
+        provide_hostname = True
         for dev in devs:
             short = dev.split('/')[-1]
             log.info(f'Connecting nvme_loop {remote.shortname}:{dev}...')
-            remote.run(
-                args=[
-                    'sudo', 'mkdir', '-p', f'{base}/subsystems/{short}',
-                    run.Raw('&&'),
-                    'echo', '1', run.Raw('|'),
-                    'sudo', 'tee', f'{base}/subsystems/{short}/attr_allow_any_host',
-                    run.Raw('&&'),
-                    'sudo', 'mkdir', '-p', f'{base}/subsystems/{short}/namespaces/1',
-                    run.Raw('&&'),
-                    'echo', '-n', dev, run.Raw('|'),
-                    'sudo', 'tee', f'{base}/subsystems/{short}/namespaces/1/device_path',
-                    run.Raw('&&'),
-                    'echo', '1', run.Raw('|'),
-                    'sudo', 'tee', f'{base}/subsystems/{short}/namespaces/1/enable',
-                    run.Raw('&&'),
-                    'sudo', 'ln', '-s', f'{base}/subsystems/{short}',
-                    f'{base}/ports/{port}/subsystems/{short}',
-                    run.Raw('&&'),
-                    'sudo', 'nvme', 'connect', '-t', 'loop', '-n', short, '-q', host,
-                ]
-            )
+            nvme_connect_args=[
+                'sudo', 'mkdir', '-p', f'{base}/subsystems/{short}',
+                run.Raw('&&'),
+                'echo', '1', run.Raw('|'),
+                'sudo', 'tee', f'{base}/subsystems/{short}/attr_allow_any_host',
+                run.Raw('&&'),
+                'sudo', 'mkdir', '-p', f'{base}/subsystems/{short}/namespaces/1',
+                run.Raw('&&'),
+                'echo', '-n', dev, run.Raw('|'),
+                'sudo', 'tee', f'{base}/subsystems/{short}/namespaces/1/device_path',
+                run.Raw('&&'),
+                'echo', '1', run.Raw('|'),
+                'sudo', 'tee', f'{base}/subsystems/{short}/namespaces/1/enable',
+                run.Raw('&&'),
+                'sudo', 'ln', '-s', f'{base}/subsystems/{short}',
+                f'{base}/ports/{port}/subsystems/{short}',
+                run.Raw('&&'),
+                'sudo', 'nvme', 'connect', '-t', 'loop', '-n', short
+            ]
+            if provide_hostname:
+                nvme_connect_args.extend(['-q', host])
+            try:
+                remote.run(args=nvme_connect_args)
+            except Exception:
+                if provide_hostname:
+                    provide_hostname = False
+                    remote.run(args=['sudo', 'nvme', 'connect', '-t', 'loop', '-n', short])
+                else:
+                    raise
 
         # identify nvme_loops devices
         old_scratch_by_remote[remote] = remote.read_file('/scratch_devs')