[rhel6-branch] Keep track of whether users should be prompted to format CDL dasds. (#1164240)

Anne Mulhern amulhern at redhat.com
Mon Mar 9 12:47:03 UTC 2015





----- Original Message -----
> From: "Samantha N. Bueno" <sbueno+anaconda at redhat.com>
> To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> Sent: Monday, March 9, 2015 8:32:33 AM
> Subject: Re: [rhel6-branch] Keep track of whether users should be prompted to	format CDL dasds. (#1164240)
> 
> Er, my brain segfaulted. The title should be "....prompted to format LDL
> dasds". CDL do not need to be (re)formatted.
> 
> On Mon, Mar 09, 2015 at 08:20:46AM -0400, Samantha N. Bueno wrote:
> > A small logical error made it so that LDL dasds were always formatted
> > with dasdfmt, even if --cdl was not specified in kickstart.
> > 
> > Thanks to Jan Stodola <jstodola at redhat.com> for the patch.
> > 
> > Related: rhbz#1164240
> > ---
> >  storage/dasd.py | 13 ++++++++-----
> >  1 file changed, 8 insertions(+), 5 deletions(-)
> > 
> > diff --git a/storage/dasd.py b/storage/dasd.py
> > index 17f81bd..2dba34b 100644
> > --- a/storage/dasd.py
> > +++ b/storage/dasd.py
> > @@ -105,10 +105,13 @@ class DASD:
> >                                                                           bypath))
> >                  self._ldldasdlist.append((device, bypath))
> >  
> > -        askUser = True
> > +        askUser_zeroMbr = True
> > +        askUser_cdl = True
> >  
> > -        if zeroMbr or cdl:
> > -            askUser = False
> > +        if zeroMbr:
> > +            askUser_zeroMbr = False
> > +        if cdl:
> > +            askUser_cdl = False
> >          elif not intf and not zeroMbr:
> >              log.info("    non-interactive kickstart install without
> >              zerombr "
> >                       "command, unable to run dasdfmt, exiting installer")
> > @@ -118,12 +121,12 @@ class DASD:
> >          if not len(self._dasdlist):
> >              log.info("    no unformatted DASD devices found")
> >          else:
> > -            self.format_dasds(intf, askUser, self._dasdlist)
> > +            self.format_dasds(intf, askUser_zeroMbr, self._dasdlist)
> >  
> >          if not len(self._ldldasdlist):
> >              log.info("    no LDL DASD devices found")
> >          else:
> > -            self.format_dasds(intf, askUser, self._ldldasdlist)
> > +            self.format_dasds(intf, askUser_cdl, self._ldldasdlist)
> >  
> >      def format_dasds(self, intf, askUser, dasdlist):
> >          """ Iterate through a given list of DASDs and run dasdfmt on them.
> >          """
> > --
> > 1.9.3
> > 
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

Could easily make that whole chunk of code shorter instead of longer,
in order to solve problem, something like:

if not intf and not zeroMbr and not cdl:
    log.info(...)
    sys.exit(0)

# now onto formatting...
if not len(self._dasdlist):
    log.info...
else:
    self.format_dasds(intf, not zeroMbr, self._dasdlist)

if not...
    log.info...
else:
    self.format_dasds(intf, not cdl, self._ldldasdlist)



More information about the anaconda-patches mailing list