Skip to content

Commit cbc6d66

Browse files
authored
Merge pull request ceph#58290 from guits/fix_nvme_loop
tests: make sure nvmetcli and nvme-cli are up to date
2 parents 314971d + d707c41 commit cbc6d66

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

qa/distros/container-hosts/centos_9.stream.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ overrides:
55
allowlist:
66
- scontext=system_u:system_r:logrotate_t:s0
77

8+
tasks:
9+
- pexec:
10+
all:
11+
- sudo dnf install nvmetcli nvme-cli -y

qa/distros/container-hosts/centos_9.stream_runc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ overrides:
88
tasks:
99
- pexec:
1010
all:
11-
- sudo dnf install runc -y
11+
- sudo dnf install runc nvmetcli nvme-cli -y
1212
- sudo sed -i 's/^#runtime = "crun"/runtime = "runc"/g' /usr/share/containers/containers.conf
1313
- sudo sed -i 's/runtime = "crun"/#runtime = "crun"/g' /usr/share/containers/containers.conf

qa/tasks/nvme_loop.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import contextlib
22
import logging
3+
import json
34

45
from io import StringIO
56
from teuthology import misc as teuthology
@@ -66,10 +67,33 @@ def task(ctx, config):
6667

6768
with contextutil.safe_while(sleep=1, tries=15) as proceed:
6869
while proceed():
69-
p = remote.run(args=['sudo', 'nvme', 'list'], stdout=StringIO())
70+
p = remote.run(args=['sudo', 'nvme', 'list', '-o', 'json'], stdout=StringIO())
7071
new_devs = []
71-
for line in p.stdout.getvalue().splitlines():
72-
dev, _, vendor = line.split()[0:3]
72+
# `nvme list -o json` will return the following output:
73+
'''{
74+
"Devices" : [
75+
{
76+
"DevicePath" : "/dev/nvme0n1",
77+
"Firmware" : "8DV101H0",
78+
"Index" : 0,
79+
"ModelNumber" : "INTEL SSDPEDMD400G4",
80+
"ProductName" : "Unknown Device",
81+
"SerialNumber" : "PHFT620400WB400BGN"
82+
},
83+
{
84+
"DevicePath" : "/dev/nvme1n1",
85+
"Firmware" : "5.15.0-1",
86+
"Index" : 1,
87+
"ModelNumber" : "Linux",
88+
"ProductName" : "Unknown Device",
89+
"SerialNumber" : "7672ce414766ba44a8e5"
90+
}
91+
]
92+
}'''
93+
nvme_list = json.loads(p.stdout.getvalue())
94+
for device in nvme_list['Devices']:
95+
dev = device['DevicePath']
96+
vendor = device['ModelNumber']
7397
if dev.startswith('/dev/') and vendor == 'Linux':
7498
new_devs.append(dev)
7599
log.info(f'new_devs {new_devs}')

0 commit comments

Comments
 (0)