Merge lp:~pieq/checkbox/fix-1630525-graphics_card_resource-driver-name into lp:checkbox

Proposed by Pierre Equoy
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 4518
Merged at revision: 4519
Proposed branch: lp:~pieq/checkbox/fix-1630525-graphics_card_resource-driver-name
Merge into: lp:checkbox
Diff against target: 12 lines (+2/-0)
1 file modified
providers/plainbox-provider-resource-generic/bin/graphics_card_resource (+2/-0)
To merge this branch: bzr merge lp:~pieq/checkbox/fix-1630525-graphics_card_resource-driver-name
Reviewer Review Type Date Requested Status
Sylvain Pineau Approve
Review via email: mp+307804@code.launchpad.net

Description of the change

A graphics card should always have a driver associated to it to work.

In lp:1630525 we discovered it was apparently not always the case, so udev will not return any driver name for the given graphics card.

We decided to fake it to avoid Checkbox to crash later, when trying to retrieve the information to use in template jobs.

To test, you can use the fact that the graphics_card_resource script can take any source to process (and not only the udev_resource script itself). What I did was to generate a udev output, then edit it to remove any driver for the graphics card, and then run graphics_resource against it:

(on a device with Checkbox available or using a virtualenv with Checkbox:)

    ./udev_resource > /tmp/udevres.log
    vim /tmp/udevres.log # Edit the file to remove the graphics card driver information from the udev output
    ./graphics_card_resource -c "cat /tmp/udevres.log"

You should see something like:
    bus: pci
    category: VIDEO
  → driver: unknown ←
    index: 1
    path: /devices/pci0000:00/0000:00:02.0
    product: Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller
    product_id: 1042
    product_slug: Xeon_E3-1200_v3_4th_Gen_Core_Processor_Integrated_Graphics_Controller
    subproduct_id: 34100
    subvendor_id: 4163
    vendor: Intel Corporation
    vendor_id: 32902
    vendor_slug: Intel_Corporation

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

+1, perfect!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'providers/plainbox-provider-resource-generic/bin/graphics_card_resource'
2--- providers/plainbox-provider-resource-generic/bin/graphics_card_resource 2016-09-09 12:52:23 +0000
3+++ providers/plainbox-provider-resource-generic/bin/graphics_card_resource 2016-10-06 09:30:07 +0000
4@@ -146,6 +146,8 @@
5 fake_vendor = "PCI ID unknown"
6 record['vendor'] = fake_vendor
7 record['vendor_slug'] = slugify(fake_vendor)
8+ if 'driver' not in record:
9+ record['driver'] = 'unknown'
10 # Finally, print the record
11 items = ["{key}: {value}".format(key=k, value=record[k])
12 for k in sorted(record.keys())]

Subscribers

People subscribed via source and target branches