]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: make sure nvmetcli and nvme-cli are up to date 57932/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 26 Jun 2024 10:35:43 +0000 (10:35 +0000)
committerCasey Bodley <cbodley@redhat.com>
Mon, 1 Jul 2024 15:57:14 +0000 (11:57 -0400)
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 <gabrioux@ibm.com>
(cherry picked from commit d707c41eacb513bdcb9fec17c823bfbfdc182700)

qa/distros/container-hosts/centos_9.stream.yaml
qa/distros/container-hosts/centos_9.stream_runc.yaml
qa/tasks/nvme_loop.py

index d3bc430e63b981d71cebdd629d826ea56a56d5df..45295bb4a7499ef423c7c2d32c26d05edbf83bd6 100644 (file)
@@ -5,3 +5,7 @@ overrides:
     whitelist:
       - scontext=system_u:system_r:logrotate_t:s0
 
+tasks:
+- pexec:
+    all:
+    - sudo dnf install nvmetcli nvme-cli -y
index 2e4f9fe3a61e8be31df67238088e736737069e0b..ed9cb9cc8a99f181fd58437a2295c12f04f132b2 100644 (file)
@@ -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
index c9d8f0dc78e4faf5472d85ce49b1d85020dcd03c..5b29c11f007cbc738a7137083cee5b0502dc5c74 100644 (file)
@@ -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}')