[PATCH 3/8] Correctly handle the default vg not having been instantiated yet.

David Lehman dlehman at redhat.com
Thu Nov 29 23:39:09 UTC 2012


On Thu, 2012-11-29 at 14:31 -0800, Brian C. Lane wrote:
> On Thu, Nov 29, 2012 at 11:19:27AM -0600, David Lehman wrote:
> > When editing a non-lv and changing the device type type to lvm it is
> > possible that there are no vg instances in the devicetree.
> > ---
> >  pyanaconda/ui/gui/spokes/custom.py |    9 ++++++++-
> >  1 files changed, 8 insertions(+), 1 deletions(-)
> > 
> > diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
> > index 39327c1..29643bf 100644
> > --- a/pyanaconda/ui/gui/spokes/custom.py
> > +++ b/pyanaconda/ui/gui/spokes/custom.py
> > @@ -2222,6 +2222,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
> >                      container = self.__storage.getContainer(factory)
> >                      default_vg = getattr(container, "name", None)
> >  
> > +            log.debug("default vg is %s" % default_vg)
> >              vg_combo.remove_all()
> >              vgs = self.__storage.vgs
> >              for vg in vgs:
> > @@ -2229,9 +2230,15 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
> >                  if default_vg and vg.name == default_vg:
> >                      vg_combo.set_active(vgs.index(vg))
> >  
> > +            if default_vg is None:
> > +                hostname = self.data.network.hostname
> > +                default_vg = self.__storage.suggestContainerName(hostname=hostname)
> > +                vg_combo.append_text(default_vg)
> > +                vg_combo.set_active(len(vg_combo.get_model()) - 1)
> > +
> >              vg_combo.append_text(new_vg_text)
> >              if default_vg is None:
> > -                vg_combo.set_active(len(vg_combo.get_model()))
> > +                vg_combo.set_active(len(vg_combo.get_model()) - 1)
> >  
> >              vg_combo.show()
> >              vg_button.show()
> > -- 
> > 1.7.7.6
> 
> Does this depend on some other patches? On master custom.py doesn't have
> default_vg code in it. And it ends at line 2079...

Yeah, it's on top of my last set of four, which I didn't want to push
without this patch. The patch was 2/4 from that set (Add support for
changing a new LV's VG).




More information about the anaconda-patches mailing list