LGTM, thanks
On Thu, Dec 12, 2013 at 5:20 PM, Klaus Aehlig <[email protected]> wrote: > Make luxid handle the QueryConfigValues call providing certain > simple status information about the cluster. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > src/Ganeti/Query/Server.hs | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/src/Ganeti/Query/Server.hs b/src/Ganeti/Query/Server.hs > index e44ed88..1e32e41 100644 > --- a/src/Ganeti/Query/Server.hs > +++ b/src/Ganeti/Query/Server.hs > @@ -36,6 +36,7 @@ import Control.Monad (forever, when, zipWithM, liftM) > import Data.Bits (bitSize) > import qualified Data.Set as Set (toList) > import Data.IORef > +import Data.Maybe (fromMaybe) > import qualified Text.JSON as J > import Text.JSON (encode, showJSON, JSValue(..)) > import System.Info (arch) > @@ -201,6 +202,19 @@ handleCall _ _ cfg (QueryNetworks names fields lock) = > handleClassicQuery cfg (Qlang.ItemTypeOpCode Qlang.QRNetwork) > (map Left names) fields lock > > +handleCall _ _ cfg (QueryConfigValues fields) = do > + let params = [ ("cluster_name", return . showJSON . clusterClusterName > + . configCluster $ cfg) > + , ("watcher_pause", liftM (maybe JSNull showJSON) > + QCluster.isWatcherPaused) > + , ("master_node", return . genericResult (const JSNull) > showJSON > + $ QCluster.clusterMasterNodeName cfg) > + , ("drain_flag", liftM showJSON isQueueOpen) > + ] :: [(String, IO JSValue)] > + let answer = map (fromMaybe (return JSNull) . flip lookup params) fields > + answerEval <- sequence answer > + return . Ok . showJSON $ answerEval > + > handleCall qlock qstat cfg (SubmitJobToDrainedQueue ops) = > do > let mcs = Config.getMasterCandidates cfg > -- > 1.8.5.1 > >
