Revision b5a96995
b/src/Ganeti/JQueue.hs | ||
---|---|---|
49 | 49 |
, allocateJobIds |
50 | 50 |
, allocateJobId |
51 | 51 |
, writeJobToDisk |
52 |
, replicateJob |
|
52 | 53 |
, isQueueOpen |
53 | 54 |
) where |
54 | 55 |
|
... | ... | |
74 | 75 |
import Ganeti.Objects (Node) |
75 | 76 |
import Ganeti.OpCodes |
76 | 77 |
import Ganeti.Path |
77 |
import Ganeti.Rpc (executeRpcCall, RpcCallJobqueueUpdate(..)) |
|
78 |
import Ganeti.Rpc (executeRpcCall, ERpcError, logRpcErrors, |
|
79 |
RpcCallJobqueueUpdate(..)) |
|
78 | 80 |
import Ganeti.THH |
79 | 81 |
import Ganeti.Types |
80 | 82 |
import Ganeti.Utils |
... | ... | |
347 | 349 |
tryAndLogIOError (atomicWriteFile filename content) |
348 | 350 |
("Failed to write " ++ filename) Ok |
349 | 351 |
|
352 |
-- | Replicate a job to all master candidates. |
|
353 |
replicateJob :: FilePath -> [Node] -> QueuedJob -> IO [(Node, ERpcError ())] |
|
354 |
replicateJob rootdir mastercandidates job = do |
|
355 |
let filename = liveJobFile rootdir . qjId $ job |
|
356 |
content = Text.JSON.encode . Text.JSON.showJSON $ job |
|
357 |
result <- executeRpcCall mastercandidates |
|
358 |
$ RpcCallJobqueueUpdate filename content |
|
359 |
logRpcErrors result |
|
360 |
return result |
|
361 |
|
|
350 | 362 |
-- | Read the job serial number from disk. |
351 | 363 |
readSerialFromDisk :: IO (Result JobId) |
352 | 364 |
readSerialFromDisk = do |
Also available in: Unified diff