, oVerbose
) where
+import Control.Monad
import Data.Maybe (fromMaybe)
import qualified Data.Version
-import Monad
import System.Console.GetOpt
import System.IO
import System.Info
, maybeSaveData
) where
+import Control.Monad
import Data.Maybe (isJust, fromJust)
-import Monad
import System.FilePath
import System.IO
import System
rl_names <- extrReq "instances"
rl_insts <- mapM (Container.findByName map_i) rl_names
let rl_idx = map Instance.idx rl_insts
- rl_mode <- do
+ rl_mode <-
case extrReq "reloc_mode" of
Ok s | s == C.iallocatorMrelocKeep -> return KeepGroup
| s == C.iallocatorMrelocChange ->
"idx" -> printf "%4d" $ idx t
"name" -> alias t
"fqdn" -> name t
- "status" -> if offline t then "-"
- else if failN1 t then "*" else " "
+ "status" -> case () of
+ _ | offline t -> "-"
+ | failN1 t -> "*"
+ | otherwise -> " "
"tmem" -> printf "%5.0f" $ tMem t
"nmem" -> printf "%5d" $ nMem t
"xmem" -> printf "%5d" $ xMem t
-- a found key will be returned as is, not with default
Utils.fromObjWithDefault [(random_key, J.showJSON def_value)]
random_key (def_value+1) == Just def_value
- where _types = (def_value :: Integer)
+ where _types = def_value :: Integer
testUtils =
[ run prop_Utils_commaJoinSplit
case inst of
Nothing -> False
Just (_, i) ->
- (Instance.name i == name &&
- Instance.vcpus i == vcpus &&
- Instance.mem i == mem &&
- Instance.pNode i == pdx &&
- Instance.sNode i == (if null snode
- then Node.noSecondary
- else rsdx) &&
- Instance.auto_balance i == autobal &&
- isNothing fail1)
+ Instance.name i == name &&
+ Instance.vcpus i == vcpus &&
+ Instance.mem i == mem &&
+ Instance.pNode i == pdx &&
+ Instance.sNode i == (if null snode
+ then Node.noSecondary
+ else rsdx) &&
+ Instance.auto_balance i == autobal &&
+ isNothing fail1
prop_Text_Load_InstanceFail ktn fields =
length fields /= 9 ==>
prop_Node_rMem node inst =
-- ab = auto_balance, nb = non-auto_balance
-- we use -1 as the primary node of the instance
- let inst' = inst { Instance.pNode = (-1), Instance.auto_balance = True}
+ let inst' = inst { Instance.pNode = -1, Instance.auto_balance = True }
inst_ab = setInstanceSmallerThanNode node inst'
inst_nb = inst_ab { Instance.auto_balance = False }
-- now we have the two instances, identical except the
in length nodes == sum (map (length . snd) ng) &&
all (\(guuid, ns) -> all ((== guuid) . Node.group) ns) ng &&
length (nub onlyuuid) == length onlyuuid &&
- if null nodes then True else not (null ng)
+ (null nodes || not (null ng))
testNode =
[ run prop_Node_setAlias
module Main (main) where
+import Control.Monad
import Data.List
import Data.Maybe (isJust, fromJust)
-import Monad
import System (exitWith, ExitCode(..))
import System.IO
import qualified System
exitWith $ ExitFailure 1
input_data <- readFile (head args)
- r1 <- case (parseData input_data) of
+ r1 <- case parseData input_data of
Bad err -> do
hPutStrLn stderr $ "Error: " ++ err
exitWith $ ExitFailure 1
import Control.Concurrent (threadDelay)
import Control.Exception (bracket)
+import Control.Monad
import Data.List
import Data.Maybe (isJust, isNothing, fromJust)
import Data.IORef
-import Monad
import System (exitWith, ExitCode(..))
import System.IO
import System.Posix.Process
(optEvacMode opts)
let (Cluster.Table fin_nl fin_il fin_cv fin_plc) = fin_tbl
ord_plc = reverse fin_plc
- sol_msg = if null fin_plc
- then printf "No solution found\n"
- else if verbose > 2
- then printf "Final coefficients: overall %.8f, %s\n"
- fin_cv (Cluster.printStats fin_nl)
- else printf "Cluster score improved from %.8f to %.8f\n"
- ini_cv fin_cv
- ::String
+ sol_msg = case () of
+ _ | null fin_plc -> printf "No solution found\n"
+ | verbose > 2 ->
+ printf "Final coefficients: overall %.8f, %s\n"
+ fin_cv (Cluster.printStats fin_nl)
+ | otherwise ->
+ printf "Cluster score improved from %.8f to %.8f\n"
+ ini_cv fin_cv ::String
unless oneline $ putStr sol_msg
module Main (main) where
+import Control.Monad
import Data.Maybe (isJust, fromJust, fromMaybe)
-import Monad
import System (exitWith, ExitCode(..))
import System.IO
import System.FilePath
module Main (main) where
+import Control.Monad
import Data.Char (toUpper, isAlphaNum)
import Data.List
import Data.Maybe (isJust, fromJust)
import Data.Ord (comparing)
-import Monad
import System (exitWith, ExitCode(..))
import System.IO
import qualified System
-- | Ensure a value is quoted if needed
ensureQuoted :: String -> String
-ensureQuoted v = if not (all (\c -> (isAlphaNum c || c == '.')) v)
+ensureQuoted v = if not (all (\c -> isAlphaNum c || c == '.') v)
then '\'':v ++ "'"
else v