LGTM
On Mon, May 12, 2014 at 6:08 PM, 'Klaus Aehlig' via ganeti-devel < [email protected]> wrote: > Add a function to extract the MasterNetworkParameters from > the ConfigData. That will be needed to set up the master IP. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > src/Ganeti/Config.hs | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/src/Ganeti/Config.hs b/src/Ganeti/Config.hs > index 3f76565..71283c4 100644 > --- a/src/Ganeti/Config.hs > +++ b/src/Ganeti/Config.hs > @@ -36,6 +36,7 @@ module Ganeti.Config > , getInstancesIpByLink > , getMasterCandidates > , getMasterOrCandidates > + , getMasterNetworkParameters > , getOnlineNodes > , getNode > , getInstance > @@ -160,6 +161,18 @@ getMasterOrCandidates cfg = > let isMC r = (r == NRCandidate) || (r == NRMaster) > 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. > getOnlineNodes :: ConfigData -> [Node] > getOnlineNodes = filter (not . nodeOffline) . F.toList . configNodes > -- > 1.9.1.423.g4596e3a > >
