Commit 6dc0cb59 authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

Add 'daemonsPorts' and related constants



* add 'daemonsPorts' and related constants used in the construction of
  the 'Map' that maps each daemon to its corresponding protocol and
  port.  This breaks constant 'daemonsPortsGanetiNoded' which is
  automatically generated from the Python dictionary 'DAEMONS_PORTS'

* replace reference from constant 'daemonsPortsGanetiNoded' to
  'defaultNodedPort' because constant 'daemonsPortsGanetiNoded' was a
  tuple containing the protocol and the port for node daemon, but only
  the port was needed.  And because this tuple was making Haskell to
  Python constant generation more difficult, it is preferable to
  replace this tuple with the actual port and use it directly, in
  module 'Ganeti.Rpc'
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent cd0359bc
......@@ -36,6 +36,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
module Ganeti.HsConstants where
import Data.Map (Map)
import qualified Data.Map as Map (fromList)
import AutoConf
import Ganeti.ConstantUtils
......@@ -140,6 +143,26 @@ daemons =
noded,
rapi]
defaultConfdPort :: Int
defaultConfdPort = 1814
defaultMondPort :: Int
defaultMondPort = 1815
defaultNodedPort :: Int
defaultNodedPort = 1811
defaultRapiPort :: Int
defaultRapiPort = 5080
daemonsPorts :: Map String (Protocol, Int)
daemonsPorts =
Map.fromList [(confd, (Udp, defaultConfdPort)),
(mond, (Tcp, defaultMondPort)),
(noded, (Tcp, defaultNodedPort)),
(rapi, (Tcp, defaultRapiPort)),
(ssh, (Tcp, 22))]
-- * Possible values for NodeGroup.alloc_policy
allocPolicyLastResort :: String
......
......@@ -162,7 +162,7 @@ data HttpClientRequest = HttpClientRequest
prepareUrl :: (RpcCall a) => Node -> a -> String
prepareUrl node call =
let node_ip = nodePrimaryIp node
port = snd C.daemonsPortsGanetiNoded
port = C.defaultNodedPort
path_prefix = "https://" ++ node_ip ++ ":" ++ show port
in path_prefix ++ "/" ++ rpcCallName call
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment