Re: Storage device enumeration script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2011-05-26 at 07:39 -0400, Phil Turmel wrote:
> Thanks TorbjÃrn !
> 
> I tend to short the error-checking when I'm putting something together...  Clearly, this script was less baked than I thought.
> 
> On 05/26/2011 05:45 AM, TorbjÃrn Skagestad wrote:
> > @@ -166,9 +171,12 @@
> >  	devpath = os.path.realpath(devpathlink)
> >  	if devpath in phydevs:
> >  		return phydevs[devpath]
> > -	phy = Struct(dpath=devpath, node=nodestr,
> > -		vendor=io.FileIO(devpath+'/vendor').read().split("\n",1)[0].strip(),
> > -		model=io.FileIO(devpath+'/model').read().split("\n",1)[0].strip())
> > +	try:
> > +		phy = Struct(dpath=devpath, node=nodestr,
> > +			vendor=io.FileIO(devpath+'/vendor').read().split("\n",1)[0].strip(),
> > +			model=io.FileIO(devpath+'/model').read().split("\n",1)[0].strip())
> > +	except IOError:
> > +		return None
> >  	if os.path.exists(devpath+'/unique_id'):
> >  		phy.serial = io.FileIO(devpath+'/unique_id').read().split("\n",1)[0].strip()
> >  	if not phy.serial:
> 
> This hunk will have to be done differently.  "phy" needs to be set without vendor & model if they can't be read.  I'll make a helper function to read the first line of a file, or return None.

That makes sense.
Guess I was too trigger happy here and ignored some devices in the
process.
> 
> On 05/26/2011 04:11 AM, CoolCold wrote:
> > May be setup some github repo for this?
> > 
> 
> Yes, I'll do this later today.  Obviously needed. :(
> 
> Phil
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
TorbjÃrn Skagestad
Idà Til Produkt AS
torborn@xxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux