Commit e181c8cd authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Add function to get master IP parameters from configuration



Add a function to extract the MasterNetworkParameters from
the ConfigData. That will be needed to set up the master IP.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent ee483117
...@@ -36,6 +36,7 @@ module Ganeti.Config ...@@ -36,6 +36,7 @@ module Ganeti.Config
, getInstancesIpByLink , getInstancesIpByLink
, getMasterCandidates , getMasterCandidates
, getMasterOrCandidates , getMasterOrCandidates
, getMasterNetworkParameters
, getOnlineNodes , getOnlineNodes
, getNode , getNode
, getInstance , getInstance
...@@ -161,6 +162,18 @@ getMasterOrCandidates cfg = ...@@ -161,6 +162,18 @@ getMasterOrCandidates cfg =
let isMC r = (r == NRCandidate) || (r == NRMaster) let isMC r = (r == NRCandidate) || (r == NRMaster)
in filter (isMC . getNodeRole cfg) . F.toList . configNodes $ cfg in filter (isMC . getNodeRole cfg) . F.toList . configNodes $ cfg
-- | Get the network parameters for the master IP address.
getMasterNetworkParameters :: ConfigData -> MasterNetworkParameters
getMasterNetworkParameters cfg =
let cluster = configCluster cfg
in MasterNetworkParameters
{ masterNetworkParametersUuid = clusterMasterNode cluster
, masterNetworkParametersIp = clusterMasterIp cluster
, masterNetworkParametersNetmask = clusterMasterNetmask cluster
, masterNetworkParametersNetdev = clusterMasterNetdev cluster
, masterNetworkParametersIpFamily = clusterPrimaryIpFamily cluster
}
-- | Get the list of online nodes. -- | Get the list of online nodes.
getOnlineNodes :: ConfigData -> [Node] getOnlineNodes :: ConfigData -> [Node]
getOnlineNodes = filter (not . nodeOffline) . F.toList . configNodes getOnlineNodes = filter (not . nodeOffline) . F.toList . configNodes
......
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