Commit 7d6e577c authored by Petr Pudlak's avatar Petr Pudlak
Browse files

Log asynchronous WConfd tasks and include the serial number



This makes debugging more informative and makes more clear how
configuration distribution gets aggregated.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 579bd910
...@@ -73,7 +73,8 @@ loadConfigFromFile path = withLockedFile path $ \_ -> do ...@@ -73,7 +73,8 @@ loadConfigFromFile path = withLockedFile path $ \_ -> do
writeConfigToFile :: (MonadBase IO m, MonadError GanetiException m, MonadLog m) writeConfigToFile :: (MonadBase IO m, MonadError GanetiException m, MonadLog m)
=> ConfigData -> FilePath -> FStat -> m FStat => ConfigData -> FilePath -> FStat -> m FStat
writeConfigToFile cfg path oldstat = do writeConfigToFile cfg path oldstat = do
logDebug "Async. config. writer: Commencing write" logDebug $ "Async. config. writer: Commencing write\
\ serial no " ++ show (serialOf cfg)
r <- toErrorBase $ atomicUpdateLockedFile_ path oldstat doWrite r <- toErrorBase $ atomicUpdateLockedFile_ path oldstat doWrite
logDebug "Async. config. writer: written" logDebug "Async. config. writer: written"
return r return r
...@@ -161,8 +162,11 @@ distMCsAsyncTask ents cpath cdRef = ...@@ -161,8 +162,11 @@ distMCsAsyncTask ents cpath cdRef =
\ to master candidates" \ to master candidates"
$ do $ do
cd <- liftBase (csConfigData <$> cdRef) :: ResultG ConfigData cd <- liftBase (csConfigData <$> cdRef) :: ResultG ConfigData
logDebug $ "Distributing the configuration to master candidates,\
\ serial no " ++ show (serialOf cd)
fupload <- prepareRpcCallUploadFile ents cpath fupload <- prepareRpcCallUploadFile ents cpath
execRpcCallAndLog (getMasterCandidates cd) fupload execRpcCallAndLog (getMasterCandidates cd) fupload
logDebug "Successfully finished distributing the configuration"
-- | Construct an asynchronous worker whose action is to construct SSConf -- | Construct an asynchronous worker whose action is to construct SSConf
-- and distribute it to master candidates. -- and distribute it to master candidates.
...@@ -177,7 +181,12 @@ distSSConfAsyncTask cdRef = ...@@ -177,7 +181,12 @@ distSSConfAsyncTask cdRef =
$ \oldssc -> do $ \oldssc -> do
cd <- liftBase (csConfigData <$> cdRef) :: ResultG ConfigData cd <- liftBase (csConfigData <$> cdRef) :: ResultG ConfigData
let ssc = mkSSConf cd let ssc = mkSSConf cd
when (oldssc /= ssc) if oldssc == ssc
$ execRpcCallAndLog (getOnlineNodes cd) then logDebug "SSConf unchanged, not distributing"
else do
logDebug $ "Starting the distribution of SSConf\
\ serial no " ++ show (serialOf cd)
execRpcCallAndLog (getOnlineNodes cd)
(RpcCallWriteSsconfFiles ssc) (RpcCallWriteSsconfFiles ssc)
logDebug "Successfully finished distributing SSConf"
return ssc return ssc
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