Revision 3190ad64 src/Ganeti/Confd/Server.hs
b/src/Ganeti/Confd/Server.hs | ||
---|---|---|
6 | 6 |
|
7 | 7 |
{- |
8 | 8 |
|
9 |
Copyright (C) 2011, 2012 Google Inc. |
|
9 |
Copyright (C) 2011, 2012, 2013 Google Inc.
|
|
10 | 10 |
|
11 | 11 |
This program is free software; you can redistribute it and/or modify |
12 | 12 |
it under the terms of the GNU General Public License as published by |
... | ... | |
108 | 108 |
initialPoll :: ReloadModel |
109 | 109 |
initialPoll = ReloadPoll 0 |
110 | 110 |
|
111 |
-- | Initial server state. |
|
112 |
initialState :: ServerState |
|
113 |
initialState = ServerState initialPoll 0 nullFStat |
|
114 |
|
|
115 | 111 |
-- | Reload status data type. |
116 | 112 |
data ConfigReload = ConfigToDate -- ^ No need to reload |
117 | 113 |
| ConfigReloaded -- ^ Configuration reloaded |
... | ... | |
526 | 522 |
-- | Main function. |
527 | 523 |
main :: MainFn (S.Family, S.SockAddr) PrepResult |
528 | 524 |
main _ _ (s, query_data, cref) = do |
529 |
statemvar <- newMVar initialState |
|
525 |
-- try to load the configuration, if possible |
|
526 |
conf_file <- Path.clusterConfFile |
|
527 |
(fstat, _) <- safeUpdateConfig conf_file nullFStat cref |
|
528 |
ctime <- getCurrentTime |
|
529 |
statemvar <- newMVar $ ServerState initialPoll ctime fstat |
|
530 | 530 |
hmac <- getClusterHmac |
531 | 531 |
-- Inotify setup |
532 | 532 |
inotify <- initINotify |
533 |
conf_file <- Path.clusterConfFile |
|
534 | 533 |
let inotiaction = addNotifier inotify conf_file cref statemvar |
535 | 534 |
-- fork the timeout timer |
536 | 535 |
_ <- forkIO $ onTimeoutTimer inotiaction conf_file cref statemvar |
Also available in: Unified diff