Revision d5665e10

b/src/Ganeti/Query/Server.hs
40 40
import qualified Text.JSON as J
41 41
import Text.JSON (encode, showJSON, JSValue(..))
42 42
import System.Info (arch)
43
import System.Directory
43 44

  
44 45
import qualified Ganeti.Constants as C
45 46
import qualified Ganeti.ConstantUtils as ConstantUtils (unFrozenSet)
......
56 57
import Ganeti.Luxi
57 58
import qualified Ganeti.Query.Language as Qlang
58 59
import qualified Ganeti.Query.Cluster as QCluster
59
import Ganeti.Path (queueDir, jobQueueLockFile)
60
import Ganeti.Path (queueDir, jobQueueLockFile, jobQueueDrainFile)
60 61
import Ganeti.Rpc
61 62
import Ganeti.Query.Query
62 63
import Ganeti.Query.Filter (makeSimpleFilter)
......
293 294
  _ <- executeRpcCall (masters ++ mcs) $ RpcCallSetWatcherPause time
294 295
  return . Ok . maybe JSNull showJSON $ time
295 296

  
297
handleCall _ _ cfg (SetDrainFlag value) = do
298
  let mcs = Config.getMasterCandidates cfg
299
  fpath <- jobQueueDrainFile
300
  if value
301
     then writeFile fpath ""
302
     else removeFile fpath
303
  _ <- executeRpcCall mcs $ RpcCallSetDrainFlag value
304
  return . Ok . showJSON $ True
305

  
296 306
handleCall _ _ _ op =
297 307
  return . Bad $
298 308
    GenericError ("Luxi call '" ++ strOfOp op ++ "' not implemented")

Also available in: Unified diff