diff --git a/src/Ganeti/Confd/Server.hs b/src/Ganeti/Confd/Server.hs index dd309897aad284272bd3a7d03fbebb89942915c7..29204a4efeaa113124b6a47dd3f47367a44d074d 100644 --- a/src/Ganeti/Confd/Server.hs +++ b/src/Ganeti/Confd/Server.hs @@ -6,7 +6,7 @@ {- -Copyright (C) 2011, 2012 Google Inc. +Copyright (C) 2011, 2012, 2013 Google Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -108,10 +108,6 @@ reloadRatelimitSec = fromIntegral C.confdConfigReloadRatelimit initialPoll :: ReloadModel initialPoll = ReloadPoll 0 --- | Initial server state. -initialState :: ServerState -initialState = ServerState initialPoll 0 nullFStat - -- | Reload status data type. data ConfigReload = ConfigToDate -- ^ No need to reload | ConfigReloaded -- ^ Configuration reloaded @@ -526,11 +522,14 @@ prepMain _ (af_family, bindaddr) = do -- | Main function. main :: MainFn (S.Family, S.SockAddr) PrepResult main _ _ (s, query_data, cref) = do - statemvar <- newMVar initialState + -- try to load the configuration, if possible + conf_file <- Path.clusterConfFile + (fstat, _) <- safeUpdateConfig conf_file nullFStat cref + ctime <- getCurrentTime + statemvar <- newMVar $ ServerState initialPoll ctime fstat hmac <- getClusterHmac -- Inotify setup inotify <- initINotify - conf_file <- Path.clusterConfFile let inotiaction = addNotifier inotify conf_file cref statemvar -- fork the timeout timer _ <- forkIO $ onTimeoutTimer inotiaction conf_file cref statemvar