[PATCH 5/5] Only gather lvm information one time per DeviceTree.populate call.

David Lehman dlehman at redhat.com
Mon Mar 31 15:46:09 UTC 2014


On Mon, 2014-03-31 at 11:15 -0400, Anne Mulhern wrote:
> 
> 
> 
> ----- Original Message -----
> > From: "David Lehman" <dlehman at redhat.com>
> > To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> > Sent: Friday, March 28, 2014 5:02:28 PM
> > Subject: Re: [PATCH 5/5] Only gather lvm information one time per	DeviceTree.populate call.
> > 
> > This requires a followup patch:
> > 
> > diff --git a/blivet/devicetree.py b/blivet/devicetree.py
> > index ca5d498..ab091f5 100644
> > --- a/blivet/devicetree.py
> > +++ b/blivet/devicetree.py
> > @@ -1317,7 +1317,8 @@ class DeviceTree(object):
> >          if flags.installer_mode:
> >              lv_info = devicelibs.lvm.lvs(vg_name)
> >          else:
> > -            lv_info = self.lvInfo
> > +            lv_info = dict((k, v) for (k, v) in self.lvInfo.iteritems()
> > +                            if udev_device_get_vg_name(v) == vg_name)
> >  
> >          self.names.extend(n for n in lv_info.keys() if n not in
> > self.names)
> > 
> > This filters the LV dict used by handleVgLVs so that it contains only
> > LVs in the VG we're concerned with. I am adding this into patch 5 in my
> > working tree.
> > 
> > David
> > 
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> > 
> 
> Why is it so desirable to cache this info? I worry that keeping around and handling
> this state will prove troublesome in the long run.

The benefit of caching the lvm data is that the number of calls to pvs
and lvs is no longer proportional to the number of pvs and vgs present.
For systems with very large numbers of disks and/or vgs, this is a
significant optimization.

Any time you add or reveal a new device you should call populate to get
it picked up by blivet's model. We automatically drop the cache on entry
to populate, and the data is only used by populate, so I'm not aware of
any way caching this data could backfire.

> 
> - mulhern
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches




More information about the anaconda-patches mailing list