Merge ~pieq/plainbox-provider-resource:1649464-sorting-bus-hex-id into plainbox-provider-resource:master

Proposed by Pierre Equoy
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 81d448047cf1854f2169c1de9f0a09fade92ef4c
Merged at revision: 9e93ef16c36f89f6d6dc8d943d36c334bf880f50
Proposed branch: ~pieq/plainbox-provider-resource:1649464-sorting-bus-hex-id
Merge into: plainbox-provider-resource:master
Diff against target: 11 lines (+1/-1)
1 file modified
bin/graphics_card_resource (+1/-1)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+315197@code.launchpad.net

Description of the change

Fix graphics card bus ordering when bus ID contains hexadecimal values

The PCI bus ID that we use in the graphics card resource job in order to sort
the available graphics cards can contain hexadecimal values (e.g. 'b3') and not
only decimal values.

We now make sure these values are converted into decimal before comparing them.

To test it, you can launch (in a venv running checkbox):

    ./graphics_card_resource -c ./udev_resource

This problem occurred on servers being tested with graphics cards, so it might be interesting to test it on similar devices. We had indeed never seen this issue before on desktops/laptops.

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Very pythonic, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/graphics_card_resource b/bin/graphics_card_resource
2index 0457ae2..6c18672 100755
3--- a/bin/graphics_card_resource
4+++ b/bin/graphics_card_resource
5@@ -93,7 +93,7 @@ def bus_ordering(record):
6 if record.get('bus') == "pci":
7 # We are looking for this ---------------v
8 # /devices/pci0000:00/0000:00:02.1/0000:01:00.0
9- return int(record.get('path').split(':')[-2])
10+ return int(record.get('path').split(':')[-2], 16)
11 return 0
12
13

Subscribers

People subscribed via source and target branches