Now that WConfD has a livelock file of its own,
it needs to ignore it in clean up operations.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 src/Ganeti/WConfd/DeathDetection.hs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/Ganeti/WConfd/DeathDetection.hs 
b/src/Ganeti/WConfd/DeathDetection.hs
index 7145b99..ecfb5ce 100644
--- a/src/Ganeti/WConfd/DeathDetection.hs
+++ b/src/Ganeti/WConfd/DeathDetection.hs
@@ -66,10 +66,13 @@ cleanupLocksTask :: WConfdMonadInt ()
 cleanupLocksTask = forever . runResultT $ do
   logDebug "Death detection timer fired"
   owners <- liftM L.lockOwners readLockAllocation
+  mylivelock <- liftM dhLivelock daemonHandle
   logDebug $ "Current lock owners: " ++ show owners
   let cleanupIfDead owner = do
         let fpath = ciLockFile owner
-        died <- liftIO (isDead fpath)
+        died <- if fpath == mylivelock
+                  then return False
+                  else liftIO (isDead fpath)
         when died $ do
           logInfo $ show owner ++ " died, releasing locks and reservations"
           persCleanup persistentTempRes owner
@@ -81,7 +84,9 @@ cleanupLocksTask = forever . runResultT $ do
   remainingFiles <- liftIO listLiveLocks
   logDebug $ "Livelockfiles remaining: " ++ show remainingFiles
   let cleanupStaleIfDead fpath = do
-        died <- liftIO (isDead fpath)
+        died <- if fpath == mylivelock
+                  then return False
+                  else liftIO (isDead fpath)
         when died $ do
           logInfo $ "Cleaning up stale file " ++ fpath
           _ <- liftIO . E.try $ removeFile fpath
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to