[PATCH 4/9] Add type-specific methods for member set management.

Vratislav Podzimek vpodzime at redhat.com
Mon Mar 24 08:00:24 UTC 2014


On Fri, 2014-03-21 at 10:11 -0500, David Lehman wrote:
> On Fri, 2014-03-21 at 08:42 +0100, Vratislav Podzimek wrote:
> > > +    def memberStatus(self, member):
> > > +        if not (self.status and member.status):
> > > +            return
> > > +
> > > +        member_name = os.path.basename(member.sysfsPath)
> > > +        path = "/sys/%s/md/dev-%s/state" % (self.sysfsPath, member_name)
> > > +        try:
> > > +            state = open(path).read().strip()
> > > +        except IOError:
> > > +            state = None
> > > +
> > > +        return state
> > I think this is a good candidate for another function in
> > devicelibs/mdraid.py.
> 
> It is. So is the degraded property just below. Both use a sysfs path,
> however, so moving them to devicelibs one would have to choose between
> constructing the sysfs path in devicelibs based on array name or having
> the identifying parameter be a sysfs path instead of array name or path.
> I'm not crazy about either option.
I think that long-term solution would be moving sysfs path construction
to devicelibs (or the new low-level library), but for now we could leave
it here. I'm just adding this function to the features list of the new
library.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list