Merge lp:~bladernr/checkbox/1291664-removable-storage-traceback-on-ro-usb into lp:checkbox

Proposed by Jeff Lane 
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 2782
Merged at revision: 2783
Proposed branch: lp:~bladernr/checkbox/1291664-removable-storage-traceback-on-ro-usb
Merge into: lp:checkbox
Diff against target: 27 lines (+6/-0)
2 files modified
checkbox-old/CHANGELOG (+2/-0)
checkbox-old/scripts/removable_storage_test (+4/-0)
To merge this branch: bzr merge lp:~bladernr/checkbox/1291664-removable-storage-traceback-on-ro-usb
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Jeff Lane  Needs Resubmitting
Review via email: mp+210712@code.launchpad.net

Description of the change

Fixes a condition where a write-protected USB device (or probably any WP device) causes the removable_storage_test script to dump a trace and exit prematurely due to the unhandled exception.

Write protected USB devices (and maybe others) cause an IOError in a section where they weren't caught.

Now we catch them

I've tried this on two servers that have embedded USB storage that is write protected, and this resolved the issue on both.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I think this is a bit eager to jump to conclusions. We can check if the device is read only but we shouldn't treat *all* IOErrors as the device being read only. If you reword the error message to:

+ logging.error("I/O error accessing the device %s", dest)

I will gladly merge it.

review: Needs Fixing
2782. By Jeff Lane 

Fixed the error message for IOError in write_file to be more generic and not assume a read-only mount

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

Thanks, that makes a lot of sense and I've changed the error message accordingly. You're right, the RO filesystem errors WOULD be I/O errors, but not all I/O errors would be due to a read-only filesystem.

review: Needs Resubmitting
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Thanks, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'checkbox-old/CHANGELOG'
--- checkbox-old/CHANGELOG 2014-02-27 05:56:02 +0000
+++ checkbox-old/CHANGELOG 2014-03-13 03:02:58 +0000
@@ -20,6 +20,8 @@
20 new 14.04 only version for Trusty testing. This is the foundation for 14.0420 new 14.04 only version for Trusty testing. This is the foundation for 14.04
21 server cert changes.21 server cert changes.
22 * Added usb3/storage-preinserted to server-selftest-14.04.whitelist22 * Added usb3/storage-preinserted to server-selftest-14.04.whitelist
23 * /scripts/removable_storage_test: fixed an unhandled exception with write
24 protected devices that caused the script to crash (LP: #1291664)
2325
24 [ Po-Hsu Lin]26 [ Po-Hsu Lin]
25 * jobs/power-management.txt.in: add product requirement for laptops into 27 * jobs/power-management.txt.in: add product requirement for laptops into
2628
=== modified file 'checkbox-old/scripts/removable_storage_test'
--- checkbox-old/scripts/removable_storage_test 2013-05-29 07:50:30 +0000
+++ checkbox-old/scripts/removable_storage_test 2014-03-13 03:02:58 +0000
@@ -121,6 +121,10 @@
121 logging.error("Unable to open %s for writing.", dest)121 logging.error("Unable to open %s for writing.", dest)
122 logging.error(" %s", exc)122 logging.error(" %s", exc)
123 return False123 return False
124 except IOError as exc:
125 logging.error("I/O Error when accessing device %s.", dest)
126 logging.error(" %s", exc)
127 return False
124 with outfile:128 with outfile:
125 try:129 try:
126 outfile.write(self.data)130 outfile.write(self.data)

Subscribers

People subscribed via source and target branches