LGTM
On Fri, Jul 04, 2014 at 07:41:07PM +0200, 'Klaus Aehlig' via ganeti-devel wrote: > Over time, the htools accumulated quite a few flags influencing > the moves considered by htools. So far, all those flags are passed > as positional arguments. This bares the risk of passing them in wrong > order as type checking cannot distinguish different arguments of the > same type (usually Bool). It also renders the function calls hard > to read. So, add a module capsuling the parameters as named record > fields. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > Makefile.am | 1 + > src/Ganeti/HTools/AlgorithmParams.hs | 41 > ++++++++++++++++++++++++++++++++++++ > 2 files changed, 42 insertions(+) > create mode 100644 src/Ganeti/HTools/AlgorithmParams.hs > > diff --git a/Makefile.am b/Makefile.am > index 68c31a8..f0d06de 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -764,6 +764,7 @@ HS_LIB_SRCS = \ > src/Ganeti/DataCollectors/Program.hs \ > src/Ganeti/DataCollectors/Types.hs \ > src/Ganeti/Errors.hs \ > + src/Ganeti/HTools/AlgorithmParams.hs \ > src/Ganeti/HTools/Backend/IAlloc.hs \ > src/Ganeti/HTools/Backend/Luxi.hs \ > src/Ganeti/HTools/Backend/Rapi.hs \ > diff --git a/src/Ganeti/HTools/AlgorithmParams.hs > b/src/Ganeti/HTools/AlgorithmParams.hs > new file mode 100644 > index 0000000..13fb5bc > --- /dev/null > +++ b/src/Ganeti/HTools/AlgorithmParams.hs > @@ -0,0 +1,41 @@ > +{-| Algorithm Options for HTools > + > +This module describes the parameters that influence the balancing > +algorithm in htools. > + > +-} > + > +{- > + > +Copyright (C) 2014 Google Inc. > + > +This program is free software; you can redistribute it and/or modify > +it under the terms of the GNU General Public License as published by > +the Free Software Foundation; either version 2 of the License, or > +(at your option) any later version. > + > +This program is distributed in the hope that it will be useful, but > +WITHOUT ANY WARRANTY; without even the implied warranty of > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > +General Public License for more details. > + > +You should have received a copy of the GNU General Public License > +along with this program; if not, write to the Free Software > +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > +02110-1301, USA. > + > +-} > + > +module Ganeti.HTools.AlgorithmParams > + ( AlgorithmOptions(..) > + ) where > + > +data AlgorithmOptions = AlgorithmOptions > + { algDiskMoves :: Bool -- ^ Whether disk moves are allowed > + , algInstanceMoves :: Bool -- ^ Whether instance moves are allowed > + , algRestrictedMigration :: Bool -- ^ Whether migration is restricted > + , algIgnoreSoftErrors :: Bool -- ^ Whether to always ignore soft errors > + , algEvacMode :: Bool -- ^ Consider only eavacation moves > + , algMinGain :: Double -- ^ Minimal gain per balancing step > + , algMinGainLimit :: Double -- ^ Limit below which minimal gain is > used > + } > -- > 2.0.0.526.g5318336 >
