.. as the other daemons already do.

Also add a more detailed error description, in the case binding to the
socket fails.

Not cleaning up the socket prevented the daemon to start in certain
situations.

Signed-off-by: Petr Pudlak <[email protected]>
---
 src/Ganeti/Metad/ConfigServer.hs | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Ganeti/Metad/ConfigServer.hs b/src/Ganeti/Metad/ConfigServer.hs
index c202cd6..fa492f1 100644
--- a/src/Ganeti/Metad/ConfigServer.hs
+++ b/src/Ganeti/Metad/ConfigServer.hs
@@ -41,7 +41,7 @@ import Text.JSON
 import System.IO.Error (isEOFError)
 
 import Ganeti.Path as Path
-import Ganeti.Daemon (DaemonOptions)
+import Ganeti.Daemon (DaemonOptions, cleanupSocket, describeError)
 import qualified Ganeti.Logging as Logging
 import Ganeti.Runtime (GanetiDaemon(..))
 import Ganeti.UDSServer (Client, ConnectConfig(..), Server, ServerConfig(..))
@@ -93,7 +93,9 @@ acceptClients config server =
 start :: DaemonOptions -> MVar InstanceParams -> IO ()
 start _ config = do
      socket_path <- Path.defaultMetadSocket
-     server <- UDSServer.connectServer metadConfig True socket_path
+     cleanupSocket socket_path
+     server <- describeError "binding to the socket" Nothing (Just socket_path)
+               $ UDSServer.connectServer metadConfig True socket_path
      finally
        (acceptClients config server)
        (UDSServer.closeServer server)
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to