Revision 5e26a86e src/Ganeti/WConfd/Server.hs
b/src/Ganeti/WConfd/Server.hs | ||
---|---|---|
34 | 34 |
import Control.Exception |
35 | 35 |
import Control.Monad |
36 | 36 |
import Control.Monad.Error |
37 |
import System.Directory (doesFileExist) |
|
37 | 38 |
|
38 | 39 |
import Ganeti.BasicTypes |
39 | 40 |
import Ganeti.Daemon |
41 |
import Ganeti.Logging (logInfo) |
|
40 | 42 |
import Ganeti.Locking.Allocation |
43 |
import Ganeti.Locking.Locks |
|
41 | 44 |
import qualified Ganeti.Path as Path |
42 | 45 |
import Ganeti.THH.RPC |
43 | 46 |
import Ganeti.UDSServer |
... | ... | |
69 | 72 |
-- TODO: Lock the configuration file so that running the daemon twice fails? |
70 | 73 |
conf_file <- Path.clusterConfFile |
71 | 74 |
|
75 |
lock_file <- Path.lockStatusFile |
|
76 |
lock_file_present <- doesFileExist lock_file |
|
77 |
when (not lock_file_present) |
|
78 |
$ logInfo "No saved lock status; assuming all locks free" |
|
72 | 79 |
dhOpt <- runResultT $ do |
73 | 80 |
(cdata, cstat) <- loadConfigFromFile conf_file |
74 |
-- TODO: read current lock allocation from disk |
|
81 |
lock <- if lock_file_present |
|
82 |
then loadLockAllocation lock_file |
|
83 |
else return emptyAllocation |
|
75 | 84 |
mkDaemonHandle conf_file |
76 | 85 |
(mkConfigState cdata) |
77 |
emptyAllocation
|
|
86 |
lock
|
|
78 | 87 |
(saveConfigAsyncTask conf_file cstat) |
79 | 88 |
dh <- withError (strMsg . ("Initialization of the daemon failed" ++) . show) |
80 | 89 |
dhOpt |
Also available in: Unified diff