DISK_SEPARATOR = _constants.DISK_SEPARATOR
IP_COMMAND_PATH = _constants.IP_COMMAND_PATH
+RPC_TMO_URGENT = _constants.RPC_TMO_URGENT
+RPC_TMO_FAST = _constants.RPC_TMO_FAST
+RPC_TMO_NORMAL = _constants.RPC_TMO_NORMAL
+RPC_TMO_SLOW = _constants.RPC_TMO_SLOW
+RPC_TMO_4HRS = _constants.RPC_TMO_4HRS
+RPC_TMO_1DAY = _constants.RPC_TMO_1DAY
+RPC_CONNECT_TIMEOUT = _constants.RPC_CONNECT_TIMEOUT
+
#: Key for job IDs in opcode result
JOB_IDS_KEY = "jobs"
(RPC_ENCODING_NONE,
RPC_ENCODING_ZLIB_BASE64) = range(2)
-# Various time constants for the timeout table
-RPC_TMO_URGENT = 60 # one minute
-RPC_TMO_FAST = 5 * 60 # five minutes
-RPC_TMO_NORMAL = 15 * 60 # 15 minutes
-RPC_TMO_SLOW = 3600 # one hour
-RPC_TMO_4HRS = 4 * 3600
-RPC_TMO_1DAY = 86400
-
-# Timeout for connecting to nodes (seconds)
-RPC_CONNECT_TIMEOUT = 5
-
# os related constants
OS_SCRIPT_CREATE = "create"
OS_SCRIPT_IMPORT = "import"
ConfdErrorType(..))
import qualified Ganeti.Confd.Types as Types
+{-# ANN module "HLint: ignore Use camelCase" #-}
+
-- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
htoolsProgs :: [String]
diskSeparator :: String
diskSeparator = AutoConf.diskSeparator
+-- * Timeout table
+--
+-- Various time constants for the timeout table
+
+rpcTmoUrgent :: Int
+rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
+
+rpcTmoFast :: Int
+rpcTmoFast = Types.rpcTimeoutToRaw Fast
+
+rpcTmoNormal :: Int
+rpcTmoNormal = Types.rpcTimeoutToRaw Normal
+
+rpcTmoSlow :: Int
+rpcTmoSlow = Types.rpcTimeoutToRaw Slow
+
+-- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
+-- in the 'Ganeti.THH.deCamelCase' function and generate the correct
+-- Python name.
+rpcTmo_4hrs :: Int
+rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
+
+-- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
+-- in the 'Ganeti.THH.deCamelCase' function and generate the correct
+-- Python name.
+rpcTmo_1day :: Int
+rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
+
+-- | Timeout for connecting to nodes (seconds)
+rpcConnectTimeout :: Int
+rpcConnectTimeout = 5
+
ipCommandPath :: String
ipCommandPath = AutoConf.ipPath
, RpcCallExportList(..)
, RpcResultExportList(..)
-
- , rpcTimeoutFromRaw -- FIXME: Not used anywhere
) where
import Control.Arrow (second)
type ERpcError = Either RpcError
--- | Basic timeouts for RPC calls.
-$(declareIADT "RpcTimeout"
- [ ( "Urgent", 'C.rpcTmoUrgent )
- , ( "Fast", 'C.rpcTmoFast )
- , ( "Normal", 'C.rpcTmoNormal )
- , ( "Slow", 'C.rpcTmoSlow )
- , ( "FourHours", 'C.rpcTmo4hrs )
- , ( "OneDay", 'C.rpcTmo1day )
- ])
-
-- | A generic class for RPC calls.
class (J.JSON a) => RpcCall a where
-- | Give the (Python) name of the procedure.
, diskAccessModeToRaw
, ReplaceDisksMode(..)
, replaceDisksModeToRaw
+ , RpcTimeout(..)
+ , rpcTimeoutFromRaw -- FIXME: no used anywhere
+ , rpcTimeoutToRaw
) where
import Control.Monad (liftM)
, ("ReplaceAuto", "replace_auto")
])
$(THH.makeJSONInstance ''ReplaceDisksMode)
+
+-- | Basic timeouts for RPC calls.
+$(THH.declareILADT "RpcTimeout"
+ [ ("Urgent", 60) -- 1 minute
+ , ("Fast", 5 * 60) -- 5 minutes
+ , ("Normal", 15 * 60) -- 15 minutes
+ , ("Slow", 3600) -- 1 hour
+ , ("FourHours", 4 * 3600) -- 4 hours
+ , ("OneDay", 86400) -- 1 day
+ ])