Skip to content
Snippets Groups Projects
Commit f40fe08c authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

In Luxi, set the master correctly


The cluster data contains the information about the master
node. Use this information to set the isMaster bit correctly.

Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 09ab9fb2
No related branches found
No related tags found
No related merge requests found
...@@ -210,13 +210,14 @@ parseNode ktg [ name, mtotal, mnode, mfree, dtotal, dfree ...@@ -210,13 +210,14 @@ parseNode ktg [ name, mtotal, mnode, mfree, dtotal, dfree
parseNode _ v = fail ("Invalid node query result: " ++ show v) parseNode _ v = fail ("Invalid node query result: " ++ show v)
-- | Parses the cluster tags. -- | Parses the cluster tags.
getClusterData :: JSValue -> Result ([String], IPolicy) getClusterData :: JSValue -> Result ([String], IPolicy, String)
getClusterData (JSObject obj) = do getClusterData (JSObject obj) = do
let errmsg = "Parsing cluster info" let errmsg = "Parsing cluster info"
obj' = fromJSObject obj obj' = fromJSObject obj
ctags <- tryFromObj errmsg obj' "tags" ctags <- tryFromObj errmsg obj' "tags"
cpol <- tryFromObj errmsg obj' "ipolicy" cpol <- tryFromObj errmsg obj' "ipolicy"
return (ctags, cpol) master <- tryFromObj errmsg obj' "master"
return (ctags, cpol, master)
getClusterData _ = Bad "Cannot parse cluster info, not a JSON record" getClusterData _ = Bad "Cannot parse cluster info, not a JSON record"
...@@ -265,8 +266,9 @@ parseData (groups, nodes, instances, cinfo) = do ...@@ -265,8 +266,9 @@ parseData (groups, nodes, instances, cinfo) = do
let (node_names, node_idx) = assignIndices node_data let (node_names, node_idx) = assignIndices node_data
inst_data <- instances >>= getInstances node_names inst_data <- instances >>= getInstances node_names
let (_, inst_idx) = assignIndices inst_data let (_, inst_idx) = assignIndices inst_data
(ctags, cpol) <- cinfo >>= getClusterData (ctags, cpol, master) <- cinfo >>= getClusterData
return (ClusterData group_idx node_idx inst_idx ctags cpol) node_idx' <- setMaster node_names node_idx master
return (ClusterData group_idx node_idx' inst_idx ctags cpol)
-- | Top level function for data loading. -- | Top level function for data loading.
loadData :: String -- ^ Unix socket to use as source loadData :: String -- ^ Unix socket to use as source
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment