No, there's no need. The open will always succeed. Accessing information from the file descriptor, however, will raise exceptions if there are problems.

-Drew

On 9/12/11 7:16 AM, William Schumann wrote:
Drew,
Should open() be within try: ?
William

On 9/12/2011 3:09 PM, Drew Fisher wrote:
Round 2:

https://cr.opensolaris.org/action/browse/caiman/drewfish/7088855_2/webrev/

I tested opening a bad path on my own system, outside of target discovery:

>>> fd = os.open("/dev/rdsk/c4t0d0s1", os.O_RDONLY | os.O_NDELAY)
>>> fd
3
>>> os.read(fd, 512)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 5] I/O error

python doesn't care if the path doesn't exist (I don't have any disks with c4), just when we try to read from it.

I've also added the finally clause to close the file descriptor.

Thanks!

-Drew


On 9/9/11 8:02 PM, Drew Fisher wrote:
Good evening!

Could I please get a code review for a fairly simple CR:

7088855 <http://monaco.us.oracle.com/detail.jsf?cr=7088855> bad drive leads to failed auto-install assertion

https://cr.opensolaris.org/action/browse/caiman/drewfish/7088855/webrev/

I ran the target unittests and saw no new regressions. I also tested on Mike's machine (where the problem originally presented itself). We now properly skip the broken drive.

We have to do the check where it is, because for failing / failed / broken drives, accessing the media attributes actually causes the failure so we have to do this first.

Thanks!

-Drew


_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss


_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss

Reply via email to