Commit 77676415 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

When updating job queue, support virtual paths



When replicating parts of the job queue, allow for virtual
paths in the RPC call. In this way, replication will also
work correctly in a vcluster setup. Note that makeVirtualPath
lives in IO, and hence cannot be part of the pure encoding
function of the RPC.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent 4a43365c
......@@ -92,6 +92,7 @@ import Ganeti.Rpc (executeRpcCall, ERpcError, logRpcErrors,
import Ganeti.THH
import Ganeti.Types
import Ganeti.Utils
import Ganeti.VCluster (makeVirtualPath)
-- * Data types
......@@ -397,8 +398,9 @@ replicateJob :: FilePath -> [Node] -> QueuedJob -> IO [(Node, ERpcError ())]
replicateJob rootdir mastercandidates job = do
let filename = liveJobFile rootdir . qjId $ job
content = Text.JSON.encode . Text.JSON.showJSON $ job
filename' <- makeVirtualPath filename
callresult <- executeRpcCall mastercandidates
$ RpcCallJobqueueUpdate filename content
$ RpcCallJobqueueUpdate filename' content
let result = map (second (() <$)) callresult
logRpcErrors result
return result
......@@ -442,8 +444,9 @@ allocateJobIds mastercandidates lock n =
logError msg
return . Bad $ msg
Right () -> do
serial' <- makeVirtualPath serial
_ <- executeRpcCall mastercandidates
$ RpcCallJobqueueUpdate serial serial_content
$ RpcCallJobqueueUpdate serial' serial_content
putMVar lock ()
return $ mapM makeJobId [(current+1)..(current+n)]
......
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