Skip to content
Snippets Groups Projects
Commit b9a2b4b3 authored by Simon Michnowicz's avatar Simon Michnowicz
Browse files

modified detection of pci bus id's to account for baremetal machines have a different format

Former-commit-id: b67df474
parent 7e67ec55
No related branches found
No related tags found
No related merge requests found
......@@ -29,8 +29,18 @@ def grab_card_ids():
cards = []
for line in p.stdout.readlines():
line = line.rstrip().split(":")[2]
pcibus_num = int(re.sub('[.:]', '', line).rstrip("0"),16)
stripped_line = line.rstrip().split(":")[2]
#check for different format of pcibus_id. This happens on baremetals
# i.e. 00000000:06:00.0 not 00000000:00:06.0
pcibus_id = re.sub('[.:]', '', stripped_line).rstrip("0")
if not pcibus_id: # empty string, try the other way
stripped_line = line.rstrip().split(":")[1]
pcibus_id = re.sub('[.:]', '', stripped_line).rstrip("0")
if not pcibus_id:
print("Error in grab_card_ids: we can not parse the line {}".format(line))
print("Command that generated it is: {}".format(cmd))
system.exit(1)
pcibus_num = int(pcibus_id,16)
card = "PCI:0:{}:0".format(str(pcibus_num))
cards.append(card)
return cards
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment