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
=== modified file 'checkbox/parsers/udevadm.py'
--- checkbox/parsers/udevadm.py 2012-02-28 21:26:55 +0000
+++ checkbox/parsers/udevadm.py 2012-05-25 14:29:20 +0000
@@ -377,6 +377,18 @@
377377
378 return None378 return None
379379
380 @property
381 def removable(self):
382 if self._environment.get("DEVTYPE") == "disk":
383 devpath = self._environment.get("DEVPATH")
384 with open("/sys%s/removable" %devpath) as f:
385 if f.read(1) == '1':
386 return u'supported'
387 else:
388 return u'unsupported'
389
390 return None
391
380392
381class UdevadmParser:393class UdevadmParser:
382 """Parser for the udevadm command."""394 """Parser for the udevadm command."""
383395
=== modified file 'jobs/disk.txt.in'
--- jobs/disk.txt.in 2012-02-29 08:33:20 +0000
+++ jobs/disk.txt.in 2012-05-25 14:29:20 +0000
@@ -11,7 +11,7 @@
11 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'11 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
12 plugin: shell12 plugin: shell
13 name: disk/benchmark_`ls /sys$path/block`13 name: disk/benchmark_`ls /sys$path/block`
14 requires: device.path == "$path" and package.name == 'linux'14 requires: device.path == "$path" and device.removable == 'unsupported' and package.name == 'linux'
15 user: root15 user: root
16 command: hdparm -tT /dev/`ls /sys$path/block | sed 's|!|/|'` | sed 's/:.*= */ = /' | grep -v "^$"16 command: hdparm -tT /dev/`ls /sys$path/block | sed 's|!|/|'` | sed 's/:.*= */ = /' | grep -v "^$"
17 description: This test runs hdparm timing tests as a benchmark for $path17 description: This test runs hdparm timing tests as a benchmark for $path
@@ -25,7 +25,7 @@
25 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'25 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
26 plugin: shell26 plugin: shell
27 name: disk/stats_`ls /sys$path/block`27 name: disk/stats_`ls /sys$path/block`
28 requires: device.path == "$path" and package.name == 'linux'28 requires: device.path == "$path" and device.removable == 'unsupported' and package.name == 'linux'
29 user: root29 user: root
30 command: disk_stats_test `ls /sys$path/block | sed 's|!|/|'`30 command: disk_stats_test `ls /sys$path/block | sed 's|!|/|'`
31 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.31 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.
@@ -42,9 +42,9 @@
42 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'42 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
43 plugin: shell43 plugin: shell
44 name: disk/smart_`ls /sys$path/block`44 name: disk/smart_`ls /sys$path/block`
45 requires: device.path == "$path"45 requires: device.path == "$path" and device.removable == 'unsupported'
46 description:46 description:
47 This tests the SMART capabilities for $product (Note that this test will not work against removable media (USB, Firewire) and hardware RAID)47 This tests the SMART capabilities for $product (Note that this test will not work against hardware RAID)
48 user: root48 user: root
49 command: disk_smart -b /dev/`ls /sys$path/block | sed 's|!|/|'` -s 13049 command: disk_smart -b /dev/`ls /sys$path/block | sed 's|!|/|'` -s 130
50 EOF50 EOF
@@ -58,7 +58,7 @@
58 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'58 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
59 plugin: shell59 plugin: shell
60 name: disk/max_diskspace_used_`ls /sys$path/block`60 name: disk/max_diskspace_used_`ls /sys$path/block`
61 requires: device.path == "$path"61 requires: device.path == "$path" and device.removable == 'unsupported'
62 description: Maximum disk space test for $product62 description: Maximum disk space test for $product
63 user: root63 user: root
64 command: max_diskspace_used `ls /sys$path/block | sed 's|!|/|'`64 command: max_diskspace_used `ls /sys$path/block | sed 's|!|/|'`
@@ -75,6 +75,7 @@
75 name: disk/read_performance_`ls /sys$path/block`75 name: disk/read_performance_`ls /sys$path/block`
76 requires:76 requires:
77 device.path == "$path"77 device.path == "$path"
78 device.removable == 'unsupported'
78 package.name == 'linux'79 package.name == 'linux'
79 description: Disk performance test for $product80 description: Disk performance test for $product
80 user: root81 user: root
@@ -93,6 +94,7 @@
93 user: root94 user: root
94 requires:95 requires:
95 device.path == "$path"96 device.path == "$path"
97 device.removable == 'unsupported'
96 package.name == 'linux'98 package.name == 'linux'
97 description: Disk I/O stress test for $product99 description: Disk I/O stress test for $product
98 command: storage_test `ls /sys$path/block | sed 's|!|/|'`100 command: storage_test `ls /sys$path/block | sed 's|!|/|'`
99101
=== modified file 'scripts/disk_read_performance_test'
--- scripts/disk_read_performance_test 2011-06-24 12:43:06 +0000
+++ scripts/disk_read_performance_test 2012-05-25 14:29:20 +0000
@@ -10,7 +10,7 @@
10 disk_type=`udevadm info --name /dev/$disk --query property | grep "ID_BUS" | awk '{gsub(/ID_BUS=/," ")}{printf $1}'`10 disk_type=`udevadm info --name /dev/$disk --query property | grep "ID_BUS" | awk '{gsub(/ID_BUS=/," ")}{printf $1}'`
1111
12 case $disk_type in12 case $disk_type in
13 "usb" ) MIN_BUF_READ=15;; #Custom metrics are guesstimates for now...13 "usb" ) MIN_BUF_READ=7;; #Custom metrics are guesstimates for now...
14 "ide" ) MIN_BUF_READ=40;;14 "ide" ) MIN_BUF_READ=40;;
15 * ) MIN_BUF_READ=$DEFAULT_BUF_READ;;15 * ) MIN_BUF_READ=$DEFAULT_BUF_READ;;
16 esac16 esac
1717
=== modified file 'scripts/udev_resource'
--- scripts/udev_resource 2011-10-11 20:15:01 +0000
+++ scripts/udev_resource 2012-05-25 14:29:20 +0000
@@ -30,7 +30,8 @@
30class UdevResult(object):30class UdevResult(object):
3131
32 attributes = ("path", "bus", "category", "driver", "product_id",32 attributes = ("path", "bus", "category", "driver", "product_id",
33 "vendor_id", "subproduct_id", "subvendor_id", "product", "vendor",)33 "vendor_id", "subproduct_id", "subvendor_id", "product", "vendor",
34 "removable",)
3435
35 def addDevice(self, device):36 def addDevice(self, device):
36 for attribute in self.attributes:37 for attribute in self.attributes:

Subscribers

People subscribed via source and target branches