Commit 6a3040b9 authored by Klaus Aehlig's avatar Klaus Aehlig

Make luxid activate the master IP on startup

This is the last task currently done by masterd, so makeing
luxid taking this over, we can get rid of masterd.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent fa320fef
......@@ -32,7 +32,7 @@ module Ganeti.Query.Server
import Control.Applicative
import Control.Concurrent
import Control.Exception
import Control.Monad (forever, when, zipWithM, liftM)
import Control.Monad (forever, when, zipWithM, liftM, void)
import Control.Monad.IO.Class
import Data.Bits (bitSize)
import qualified Data.Set as Set (toList)
......@@ -436,6 +436,21 @@ luxiHandler cfg = U.Handler { U.hParse = decodeLuxiCall
-- | Type alias for prepMain results
type PrepResult = (Server, IORef (Result ConfigData), JQStatus)
-- | Activate the master IP address.
activateMasterIP :: IO (Result ())
activateMasterIP = runResultT $ do
liftIO $ logDebug "Activating master IP address"
conf_file <- liftIO Path.clusterConfFile
config <- mkResultT $ Config.loadConfig conf_file
let mnp = Config.getMasterNetworkParameters config
masters = Config.getMasterNodes config
ems = clusterUseExternalMipScript $ configCluster config
liftIO . logDebug $ "Master IP params: " ++ show mnp
res <- liftIO . executeRpcCall masters $ RpcCallNodeActivateMasterIp mnp ems
_ <- liftIO $ logRpcErrors res
liftIO $ logDebug "finished activating master IP address"
return ()
-- | Check function for luxid.
checkMain :: CheckFn ()
checkMain _ = return $ Right ()
......@@ -467,6 +482,8 @@ main _ _ (server, cref, jq) = do
_ <- P.installHandler P.sigCHLD P.Ignore Nothing
_ <- forkIO . void $ activateMasterIP
finally
(forever $ U.listener (luxiHandler (qlock, jq, creader)) server)
(closeServer server)
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