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

Extend Text format by marking the master node


Sometimes, e.g., for hroller, it is necessary to know which node
is the master node. Therefore this information has to be included
in the text format as well. Since we never use an offline node as
master node, we can put this information can be put in the "is
offline" field; as old versions only check this field for equality
to "Y", using "M" to indicate the master is compatible in both
directions. This also leaves room to add more roles in the future,
should we need them.

Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 0da22bc3
No related branches found
No related tags found
No related merge requests found
......@@ -83,7 +83,8 @@ serializeNode gl node =
printf "%s|%.0f|%d|%d|%.0f|%d|%.0f|%c|%s|%d" (Node.name node)
(Node.tMem node) (Node.nMem node) (Node.fMem node)
(Node.tDsk node) (Node.fDsk node) (Node.tCpu node)
(if Node.offline node then 'Y' else 'N')
(if Node.offline node then 'Y' else
if Node.isMaster node then 'M' else 'N')
(Group.uuid grp)
(Node.spindleCount node)
where grp = Container.find (Node.group node) gl
......@@ -196,7 +197,8 @@ loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu, spindles] = do
vfd <- tryRead name fd
vtc <- tryRead name tc
vspindles <- tryRead name spindles
return $ Node.create name vtm vnm vfm vtd vfd vtc False vspindles gdx
return . flip Node.setMaster (fo == "M") $
Node.create name vtm vnm vfm vtd vfd vtc False vspindles gdx
return (name, new_node)
loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu] =
......
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