Commit d605e261 authored by Petr Pudlak's avatar Petr Pudlak
Browse files

Rename getClient/Server to getLuxiClient/Server



Later they will be split into LUXI-specific and general parts.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 71a4c605
......@@ -272,7 +272,7 @@ readData :: String -- ^ Unix socket to use as source
-> IO (Result JSValue, Result JSValue, Result JSValue, Result JSValue)
readData master =
E.bracket
(L.getClient master)
(L.getLuxiClient master)
L.closeClient
(\s -> do
nodes <- queryNodes s
......
......@@ -463,7 +463,7 @@ main opts args = do
iniData <- exitIfBad "when parsing auto-repair tags" iniDataRes
-- First step: check all pending repairs, see if they are completed.
iniData' <- bracket (L.getClient master) L.closeClient $
iniData' <- bracket (L.getLuxiClient master) L.closeClient $
forM iniData . processPending
-- Second step: detect any problems.
......@@ -476,7 +476,7 @@ main opts args = do
ArHealthy _ -> doRepair c jobDelay i
_ -> const (return i)
repairDone <- bracket (L.getClient master) L.closeClient $
repairDone <- bracket (L.getLuxiClient master) L.closeClient $
forM (zip iniData' repairs) . maybeRepair
-- Print some stats and exit.
......
......@@ -192,7 +192,7 @@ execJobSet anno master nl il cref (js:jss) = do
descr = map (\(_, idx, _, _) -> Container.nameOf il idx) js
logfn = putStrLn . ("Got job IDs" ++) . commaJoin . map (show . fromJobId)
putStrLn $ "Executing jobset for instances " ++ commaJoin descr
jrs <- bracket (L.getClient master) L.closeClient $
jrs <- bracket (L.getLuxiClient master) L.closeClient $
Jobs.execJobsWait jobs logfn
case jrs of
Bad x -> return $ Bad x
......
......@@ -444,7 +444,7 @@ isQueueOpen = liftM not (jobQueueDrainFile >>= doesFileExist)
startJobs :: [QueuedJob] -> IO ()
startJobs jobs = do
socketpath <- defaultMasterSocket
client <- getClient socketpath
client <- getLuxiClient socketpath
pickupResults <- mapM (flip callMethod client . PickupJob . qjId) jobs
let failures = map show $ justBad pickupResults
unless (null failures)
......
......@@ -34,8 +34,8 @@ module Ganeti.Luxi
, makeJobId
, RecvResult(..)
, strOfOp
, getClient
, getServer
, getLuxiClient
, getLuxiServer
, acceptClient
, closeClient
, closeServer
......
......@@ -369,7 +369,7 @@ prepMain _ _ = do
socket_path <- Path.defaultQuerySocket
cleanupSocket socket_path
s <- describeError "binding to the Luxi socket"
Nothing (Just socket_path) $ getServer True socket_path
Nothing (Just socket_path) $ getLuxiServer True socket_path
cref <- newIORef (Bad "Configuration not yet loaded")
jq <- emptyJQStatus
return (socket_path, s, cref, jq)
......
......@@ -30,8 +30,8 @@ module Ganeti.UDSServer
, RecvResult(..)
, MsgKeys(..)
, strOfKey
, getClient
, getServer
, getLuxiClient
, getLuxiServer
, acceptClient
, closeClient
, closeServer
......@@ -107,8 +107,8 @@ data Client = Client { socket :: Handle -- ^ The socket of the client
}
-- | Connects to the master daemon and returns a luxi Client.
getClient :: String -> IO Client
getClient path = do
getLuxiClient :: String -> IO Client
getLuxiClient path = do
s <- S.socket S.AF_UNIX S.Stream S.defaultProtocol
withTimeout luxiDefCtmo "creating luxi connection" $
S.connect s (S.SockAddrUnix path)
......@@ -117,8 +117,8 @@ getClient path = do
return Client { socket=h, rbuf=rf }
-- | Creates and returns a server endpoint.
getServer :: Bool -> FilePath -> IO S.Socket
getServer setOwner path = do
getLuxiServer :: Bool -> FilePath -> IO S.Socket
getLuxiServer setOwner path = do
s <- S.socket S.AF_UNIX S.Stream S.defaultProtocol
S.bindSocket s (S.SockAddrUnix path)
when setOwner . setOwnerAndGroupFromNames path GanetiLuxid $
......
......@@ -131,7 +131,7 @@ prop_ClientServer dnschars = monadicIO $ do
-- we need to create the server first, otherwise (if we do it in the
-- forked thread) the client could try to connect to it before it's
-- ready
server <- run $ Luxi.getServer False fpath
server <- run $ Luxi.getLuxiServer False fpath
-- fork the server responder
_ <- run . forkIO $
bracket
......@@ -140,7 +140,7 @@ prop_ClientServer dnschars = monadicIO $ do
luxiServerPong
replies <- run $
bracket
(Luxi.getClient fpath)
(Luxi.getLuxiClient fpath)
Luxi.closeClient
(`luxiClientPong` msgs)
stop $ replies ==? msgs
......
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