Merge ~bladernr/plainbox-provider-resource:1705745-dmi-supported-resource into plainbox-provider-resource:master

Proposed by Jeff Lane 
Status: Merged
Approved by: Rod Smith
Approved revision: 1d4cfc08f5b0a4170d2c55ffe7e2c41e85f2db30
Merged at revision: c8364b3ae393d0d273ecab1906a6402c0c631f51
Proposed branch: ~bladernr/plainbox-provider-resource:1705745-dmi-supported-resource
Merge into: plainbox-provider-resource:master
Diff against target: 26 lines (+11/-4)
1 file modified
bin/dmi_resource (+11/-4)
Reviewer Review Type Date Requested Status
Jonathan Cave (community) Needs Fixing
Rod Smith Approve
Review via email: mp+327985@code.launchpad.net

Description of the change

Adds a 'supported' item to the dmi resource to indicate that the SUT supports DMI (verified by the presense of /sys/devices/virtual/dmi).

Jobs using this can now say:

requires: dmi.supported == 'True'

Example result from a supported case:

Test DMI data for CPUs passed unspecified 1

Base Board Information:
Chassis Information:
Processor Information:
 Version: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
System Information:
Passed all tests

And example where supported is False (simulated by changing the requires from True to False):

Test DMI data for CPUs not supported unspecified 1 job cannot be started: resource expression "dmi.supported == 'False'" evaluates to false

To post a comment you must log in.
Revision history for this message
Jeff Lane  (bladernr) wrote :

This could (maybe should) replace the arch specific requirements so that DMI jobs will now run on anything that has the dmi directories present, indicating support for dmi.

Revision history for this message
Rod Smith (rodsmith) wrote :

I've tested this on a couple of systems, tweaking the filename to simulate the non-presence of /sys/devices/virtual/dmi, and it worked as expected. (I also had to change some job definitions to use this modified test rather than check architecture type.)

review: Approve
Revision history for this message
Jeff Lane  (bladernr) wrote :

Also... tested the script itself on a Z instance (no dmi there):

ubuntu@hwe0008:~$ ls /sys/devices/virtual/
bdi block iscsi_transport mem misc net tty workqueue
ubuntu@hwe0008:~$ sudo ./dmi_resource
supported: False

it properly returns supported: False

Revision history for this message
Jonathan Cave (jocave) wrote :

I don't like the way this particular solution combines the test for dmi support and the production of dmi resource entries in to one job.

Currently all records produced by the dmi job are individual entries in the system dmi table, with this addition one record is "special" and indicates platform support e.g.:

--------------[ Running job 2 / 2. Estimated time left: 0:00:01 ]---------------
--------------[ Collect information about hardware devices (DMI) ]--------------
ID: com.canonical.certification::dmi
Category: com.canonical.plainbox::uncategorised
... 8< -------------------------------------------------------------------------
supported: True

path: /devices/virtual/dmi/id/bios
category: BIOS
product: 00.00.27
vendor: Dell Inc.
version: 00.00.27

path: /devices/virtual/dmi/id/system
category: SYSTEM
product: Edge Gateway 3003
vendor: Dell Inc.
serial: 9D5JB02

path: /devices/virtual/dmi/id/board
category: BOARD
product: 0ffnwn
vendor: Dell Inc.
serial: /9D5JB02/cn7443171a002b/
version: x02
------------------------------------------------------------------------

I would prefer to see an extra job that does the test and can be used in the requires field.

review: Needs Fixing
Revision history for this message
Jeff Lane  (bladernr) wrote :

This was already approved and merged. I've instead created a new MR to refactor this:

https://code.launchpad.net/~bladernr/plainbox-provider-resource/+git/plainbox-provider-resource/+merge/328047

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/dmi_resource b/bin/dmi_resource
2index 4100727..ac2879b 100755
3--- a/bin/dmi_resource
4+++ b/bin/dmi_resource
5@@ -42,12 +42,19 @@ class DmiResult:
6
7
8 def main():
9- stream = os.popen(COMMAND)
10- dmi = DmidecodeParser(stream)
11
12- result = DmiResult()
13- dmi.run(result)
14+ if os.path.exists('/sys/devices/virtual/dmi'):
15+ print("supported: True")
16+ print()
17+
18+ stream = os.popen(COMMAND)
19+ dmi = DmidecodeParser(stream)
20
21+ result = DmiResult()
22+ dmi.run(result)
23+ else:
24+ print("supported: False")
25+ print()
26 return 0
27
28

Subscribers

People subscribed via source and target branches