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

Re: [PATCH 3/3] Enhance drive specification for clearpart, ignoredisk, and partition.

> > +def deviceMatches(spec):
> > +    matches = udev_resolve_glob(spec)
> > +    dev = udev_resolve_devspec(spec)
> > +
> > +    # udev_resolve_devspec returns None if there's no match, but we don't
> > +    # want that ending up in the list.
> > +    if dev:
> > +        matches.append(dev)
> Shouldn't the above be something like 'if dev and dev not in matches:'
> instead?

My thinking was that we should try both methods for resolving the spec
we're given.  However, maybe there's no reason you'd ever get a glob
that's also a valid disk name so I don't need to do this.

> Also, about the udev_trigger... it would be nice if we could only do
> that as often as is really necessary, especially for larger systems, but
> that probably doesn't rank very high among our other sins.

Agreed.  I wonder if we can get away with doing this only once early on.
Alternatively, we could do some sort of caching thing like so:

_triggerCache = {}
def udev_trigger(subsystem=None, action="add"):
   global _triggerCache
   if _triggerCache.has_key(subsystem):


However, this is entirely too much like the old driveDict out of isys
that we always had so many problems with.  I don't really like it.

- Chris

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