From: Adam King Date: Tue, 16 Sep 2025 16:07:36 +0000 (-0400) Subject: qa/tasks/nvme_loop: fix nvme loop task for ubuntu noble X-Git-Tag: testing/wip-pdonnell-testing-20260522.225612-main^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=49c518f71dbcce5954d45d5e0fcfc46107960469;p=ceph-ci.git qa/tasks/nvme_loop: fix nvme loop task for ubuntu noble 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 --- diff --git a/qa/tasks/nvme_loop.py b/qa/tasks/nvme_loop.py index fdec467a16d..8f3ab42012e 100644 --- a/qa/tasks/nvme_loop.py +++ b/qa/tasks/nvme_loop.py @@ -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')