Skip to content

Commit 4de9683

Browse files
Fix a bug detecting interfaces on BM.Optimized3.36
1 parent c53f071 commit 4de9683

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/var/lib/oci-cn-auth/lib/interfaces.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@
33
SHAPES = {
44
'BM.GPU4.8' : ["0000:48:00.0", "0000:4c:00.0", "0000:0c:00.0", "0000:16:00.0", "0000:c3:00.0", "0000:d1:00.0", "0000:8a:00.0", "0000:94:00.0",
55
"0000:48:00.1", "0000:4c:00.1", "0000:0c:00.1", "0000:16:00.1", "0000:c3:00.1", "0000:d1:00.1", "0000:8a:00.1", "0000:94:00.1"],
6-
'BM.HPC2.36' : ["0000:5e:00.0"]
6+
'BM.HPC2.36' : ["0000:5e:00.0"],
7+
'BM.Optimized3.36' : ["0000:98:00.0"]
78
}
89

910
def get_dev_name_by_id(id):
1011
""" This assumes there are no virtual interfaces """
12+
1113
base_path = '/sys/bus/pci/devices/{}/net/'.format(id)
1214
interface_name=os.listdir(base_path)[0]
1315
return interface_name
1416

1517
def get_interfaces_by_shape(shape):
18+
""" get list of interfaces by compute shape """
19+
1620
interfaces = []
17-
ids = SHAPES[shape]
18-
19-
for id in ids:
20-
interfaces.append(get_dev_name_by_id(id))
21+
22+
if shape in SHAPES:
23+
ids = SHAPES[shape]
24+
25+
for id in ids:
26+
interfaces.append(get_dev_name_by_id(id))
2127

2228
return interfaces

0 commit comments

Comments
 (0)