diff --git a/src/Ganeti/HTools/CLI.hs b/src/Ganeti/HTools/CLI.hs index 6e40df79c075afc2402ee59843af5369002da94b..b0899448b7cc73c7307727c974754108165fc5e9 100644 --- a/src/Ganeti/HTools/CLI.hs +++ b/src/Ganeti/HTools/CLI.hs @@ -8,7 +8,7 @@ used in many other places and this is more IO oriented. {- -Copyright (C) 2009, 2010, 2011, 2012 Google Inc. +Copyright (C) 2009, 2010, 2011, 2012, 2013 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 @@ -82,6 +82,7 @@ module Ganeti.HTools.CLI , oStdSpec , oTieredSpec , oVerbose + , oPriority , genericOpts ) where @@ -98,6 +99,7 @@ import qualified Ganeti.Path as Path import Ganeti.HTools.Types import Ganeti.BasicTypes import Ganeti.Common as Common +import Ganeti.Types import Ganeti.Utils -- * Data types @@ -143,6 +145,7 @@ data Options = Options , optTieredSpec :: Maybe RSpec -- ^ Requested specs for tiered mode , optReplay :: Maybe String -- ^ Unittests: RNG state , optVerbose :: Int -- ^ Verbosity level + , optPriority :: Maybe OpSubmitPriority -- ^ OpCode submit priority } deriving Show -- | Default values for the command line options. @@ -187,6 +190,7 @@ defaultOptions = Options , optTieredSpec = Nothing , optReplay = Nothing , optVerbose = 1 + , optPriority = Nothing } -- | Abbreviation for the option type. @@ -518,6 +522,15 @@ oVerbose = "increase the verbosity level", OptComplNone) +oPriority :: OptType +oPriority = + (Option "" ["priority"] + (ReqArg (\ inp opts -> do + prio <- parseSubmitPriority inp + Ok opts { optPriority = Just prio }) "PRIO") + "set the priority of submitted jobs", + OptComplChoices (map fmtSubmitPriority [minBound..maxBound])) + -- | Generic options. genericOpts :: [GenericOptType Options] genericOpts = [ oShowVer