From: Guillaume Abrioux Date: Wed, 26 Jun 2024 10:35:43 +0000 (+0000) Subject: tests: make sure nvmetcli and nvme-cli are up to date X-Git-Tag: v19.1.1~157^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=440243b04dd8d6ab9265f8be80587026fe16aacb;p=ceph.git tests: make sure nvmetcli and nvme-cli are up to date Otherwise jobs end up with the following failure: ``` 2024-06-25T14:22:18.659 INFO:teuthology.orchestra.run.smithi098.stderr:Failed to write to /dev/nvme-fabrics: Invalid argument ``` Also, the output of nvme list has changed so we have to update qa/tasks/nvme_loop.py accordingly. Fixes: https://tracker.ceph.com/issues/66707 Signed-off-by: Guillaume Abrioux (cherry picked from commit d707c41eacb513bdcb9fec17c823bfbfdc182700) --- diff --git a/qa/distros/container-hosts/centos_9.stream.yaml b/qa/distros/container-hosts/centos_9.stream.yaml index de05533cea800..53fc162dfc6a4 100644 --- a/qa/distros/container-hosts/centos_9.stream.yaml +++ b/qa/distros/container-hosts/centos_9.stream.yaml @@ -5,3 +5,7 @@ overrides: allowlist: - scontext=system_u:system_r:logrotate_t:s0 +tasks: +- pexec: + all: + - sudo dnf install nvmetcli nvme-cli -y diff --git a/qa/distros/container-hosts/centos_9.stream_runc.yaml b/qa/distros/container-hosts/centos_9.stream_runc.yaml index 10d2137a5b32e..0f3f21d8ad4c1 100644 --- a/qa/distros/container-hosts/centos_9.stream_runc.yaml +++ b/qa/distros/container-hosts/centos_9.stream_runc.yaml @@ -8,6 +8,6 @@ overrides: tasks: - pexec: all: - - sudo dnf install runc -y + - sudo dnf install runc nvmetcli nvme-cli -y - sudo sed -i 's/^#runtime = "crun"/runtime = "runc"/g' /usr/share/containers/containers.conf - sudo sed -i 's/runtime = "crun"/#runtime = "crun"/g' /usr/share/containers/containers.conf diff --git a/qa/tasks/nvme_loop.py b/qa/tasks/nvme_loop.py index c9d8f0dc78e4f..5b29c11f007cb 100644 --- a/qa/tasks/nvme_loop.py +++ b/qa/tasks/nvme_loop.py @@ -1,5 +1,6 @@ import contextlib import logging +import json from io import StringIO from teuthology import misc as teuthology @@ -66,10 +67,33 @@ def task(ctx, config): with contextutil.safe_while(sleep=1, tries=15) as proceed: while proceed(): - p = remote.run(args=['sudo', 'nvme', 'list'], stdout=StringIO()) + p = remote.run(args=['sudo', 'nvme', 'list', '-o', 'json'], stdout=StringIO()) new_devs = [] - for line in p.stdout.getvalue().splitlines(): - dev, _, vendor = line.split()[0:3] + # `nvme list -o json` will return the following output: + '''{ + "Devices" : [ + { + "DevicePath" : "/dev/nvme0n1", + "Firmware" : "8DV101H0", + "Index" : 0, + "ModelNumber" : "INTEL SSDPEDMD400G4", + "ProductName" : "Unknown Device", + "SerialNumber" : "PHFT620400WB400BGN" + }, + { + "DevicePath" : "/dev/nvme1n1", + "Firmware" : "5.15.0-1", + "Index" : 1, + "ModelNumber" : "Linux", + "ProductName" : "Unknown Device", + "SerialNumber" : "7672ce414766ba44a8e5" + } + ] + }''' + nvme_list = json.loads(p.stdout.getvalue()) + for device in nvme_list['Devices']: + dev = device['DevicePath'] + vendor = device['ModelNumber'] if dev.startswith('/dev/') and vendor == 'Linux': new_devs.append(dev) log.info(f'new_devs {new_devs}')