Merge lp:~sylvain-pineau/checkbox/add_removable_attribute_to_udev_resource into lp:checkbox

Proposed by Sylvain Pineau
Status: Rejected
Rejected by: Sylvain Pineau
Proposed branch: lp:~sylvain-pineau/checkbox/add_removable_attribute_to_udev_resource
Merge into: lp:checkbox
Diff against target: 108 lines (+22/-7)
4 files modified
checkbox/parsers/udevadm.py (+12/-0)
jobs/disk.txt.in (+7/-5)
scripts/disk_read_performance_test (+1/-1)
scripts/udev_resource (+2/-1)
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/add_removable_attribute_to_udev_resource
Reviewer Review Type Date Requested Status
Marc Tardif (community) Needs Information
Review via email: mp+107391@code.launchpad.net

Description of the change

After reviewing several systems which reported disk_read_performance_test failures after running the SRU tests, it turns out that the usb stick we use is unable to reach the usb threshold defined in scripts/disk_read_performance_test.

An easy fix is to lower this value to 7 MB/s.

Another proposal is to run disks.txt.in jobs only on non-removable devices, this is the purpose of the changes to udev_resource and its corresponding parser, add a new attribute we could use in job requirements.

I'm still not sure about what to do for removable devices, duplicating the read_performance test in their related sections (usb, firewire, etc...), add benchmarks-like tests to removable_storage_test or just rely on the current version of removable_storage_test.

So several solutions for one problem, that's why i'm requesting your reviews.

Thanks.

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

I don't think we should do benchmarking on removable devices (yet; we may have to when we start testing USB 3.0). The reason is that this is very dependent on the device itself, I've seen USB sticks with transfer rates as low as 1 MB/s, especially cheap ones. On the other hand, performance for internal hard drives is pretty much standard so we *can* benchmark those more reliably.

Revision history for this message
Marc Tardif (cr3) wrote :

I not sure I agree with extending the udev_resource script just for the sake of the removable_storage_test script. I can appreciate the need for this information but I question the way it is exposed. The "removable" property provided in the output looks like the concept of "capabilities" in HAL. Instead of being implemented as individual attributes, this is implemented as a list of values where you'd have something like:

  capabilities: removable

This could be reused for optical devices to look like:

  capabilities: cdrom-readable cdrom-writable dvd-readable dvd-writable

Instead, with your approach, you would need an attribute for each capability:

  cdrom-readable: supported
  cdrom-writable: supported
  dvd-readable: supported
  dvd-writable: supported

Both approaches would work equally well to reach the ultimate objective of expressing requirements, but it seems that capabilities would provide a more generic way of solving the same problem. However, note that the reason capabilities were never implemented is that the names of the actual capabilities might not be universal. For example, the name of the capability to define whether an optical device is readable could be any of: cdromread, cdrom-read, cdread, cd-readable, or any upper case variation. In other words, nobody could guess the name of a capability without actually reading the source code.

So, what to do from here? To move this merge request forward, I'd suggest putting a bit more thought into the changes made to udev_resource so that it might apply to other devices as well. First, I'd suggest thinking about optical devices as described above. Second, I'd also suggest looking outside Checkbox, like facter that is also used for gathering system information by Puppet. What do you think?

review: Needs Information
Revision history for this message
Daniel Manrique (roadmr) wrote :

Just a comment, we already have a optical_drive resource that tells if the CD and/or DVD readers are "writable" or "readonly". Job definition is as follows:

name: optical_drive
plugin: resource
command: for media in CD DVD; do wodim -prcap 2>/dev/null | grep -q -i "Does write $media" && echo "$media: writable" || echo "$media: readonly"; done
description: Create resource info for supported optical actions

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

I've created lp:~sylvain-pineau/checkbox/disk_tests_on_internal_drives_only to not hack into udev_resources and propose something similar to optical_drives resources.

So I'd prefer to reject this one.

Sylvain

Unmerged revisions

1396. By Sylvain Pineau

Add the removable attribute to udev_resource and a new requirement to all jobs in disk.txt.in to only run on non-removable devices.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox/parsers/udevadm.py'
2--- checkbox/parsers/udevadm.py 2012-02-28 21:26:55 +0000
3+++ checkbox/parsers/udevadm.py 2012-05-25 14:29:20 +0000
4@@ -377,6 +377,18 @@
5
6 return None
7
8+ @property
9+ def removable(self):
10+ if self._environment.get("DEVTYPE") == "disk":
11+ devpath = self._environment.get("DEVPATH")
12+ with open("/sys%s/removable" %devpath) as f:
13+ if f.read(1) == '1':
14+ return u'supported'
15+ else:
16+ return u'unsupported'
17+
18+ return None
19+
20
21 class UdevadmParser:
22 """Parser for the udevadm command."""
23
24=== modified file 'jobs/disk.txt.in'
25--- jobs/disk.txt.in 2012-02-29 08:33:20 +0000
26+++ jobs/disk.txt.in 2012-05-25 14:29:20 +0000
27@@ -11,7 +11,7 @@
28 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
29 plugin: shell
30 name: disk/benchmark_`ls /sys$path/block`
31- requires: device.path == "$path" and package.name == 'linux'
32+ requires: device.path == "$path" and device.removable == 'unsupported' and package.name == 'linux'
33 user: root
34 command: hdparm -tT /dev/`ls /sys$path/block | sed 's|!|/|'` | sed 's/:.*= */ = /' | grep -v "^$"
35 description: This test runs hdparm timing tests as a benchmark for $path
36@@ -25,7 +25,7 @@
37 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
38 plugin: shell
39 name: disk/stats_`ls /sys$path/block`
40- requires: device.path == "$path" and package.name == 'linux'
41+ requires: device.path == "$path" and device.removable == 'unsupported' and package.name == 'linux'
42 user: root
43 command: disk_stats_test `ls /sys$path/block | sed 's|!|/|'`
44 description: This test checks disk stats, generates some activity and rechecks stats to verify they've changed. It also verifies that disks appear in the various files they're supposed to.
45@@ -42,9 +42,9 @@
46 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
47 plugin: shell
48 name: disk/smart_`ls /sys$path/block`
49- requires: device.path == "$path"
50+ requires: device.path == "$path" and device.removable == 'unsupported'
51 description:
52- This tests the SMART capabilities for $product (Note that this test will not work against removable media (USB, Firewire) and hardware RAID)
53+ This tests the SMART capabilities for $product (Note that this test will not work against hardware RAID)
54 user: root
55 command: disk_smart -b /dev/`ls /sys$path/block | sed 's|!|/|'` -s 130
56 EOF
57@@ -58,7 +58,7 @@
58 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
59 plugin: shell
60 name: disk/max_diskspace_used_`ls /sys$path/block`
61- requires: device.path == "$path"
62+ requires: device.path == "$path" and device.removable == 'unsupported'
63 description: Maximum disk space test for $product
64 user: root
65 command: max_diskspace_used `ls /sys$path/block | sed 's|!|/|'`
66@@ -75,6 +75,7 @@
67 name: disk/read_performance_`ls /sys$path/block`
68 requires:
69 device.path == "$path"
70+ device.removable == 'unsupported'
71 package.name == 'linux'
72 description: Disk performance test for $product
73 user: root
74@@ -93,6 +94,7 @@
75 user: root
76 requires:
77 device.path == "$path"
78+ device.removable == 'unsupported'
79 package.name == 'linux'
80 description: Disk I/O stress test for $product
81 command: storage_test `ls /sys$path/block | sed 's|!|/|'`
82
83=== modified file 'scripts/disk_read_performance_test'
84--- scripts/disk_read_performance_test 2011-06-24 12:43:06 +0000
85+++ scripts/disk_read_performance_test 2012-05-25 14:29:20 +0000
86@@ -10,7 +10,7 @@
87 disk_type=`udevadm info --name /dev/$disk --query property | grep "ID_BUS" | awk '{gsub(/ID_BUS=/," ")}{printf $1}'`
88
89 case $disk_type in
90- "usb" ) MIN_BUF_READ=15;; #Custom metrics are guesstimates for now...
91+ "usb" ) MIN_BUF_READ=7;; #Custom metrics are guesstimates for now...
92 "ide" ) MIN_BUF_READ=40;;
93 * ) MIN_BUF_READ=$DEFAULT_BUF_READ;;
94 esac
95
96=== modified file 'scripts/udev_resource'
97--- scripts/udev_resource 2011-10-11 20:15:01 +0000
98+++ scripts/udev_resource 2012-05-25 14:29:20 +0000
99@@ -30,7 +30,8 @@
100 class UdevResult(object):
101
102 attributes = ("path", "bus", "category", "driver", "product_id",
103- "vendor_id", "subproduct_id", "subvendor_id", "product", "vendor",)
104+ "vendor_id", "subproduct_id", "subvendor_id", "product", "vendor",
105+ "removable",)
106
107 def addDevice(self, device):
108 for attribute in self.attributes:

Subscribers

People subscribed via source and target branches