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: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
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)
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
(Group.uuid grp)
(Node.spindleCount node)
where grp = Container.find (Node.group node) gl
vfd <- tryRead name fd
vtc <- tryRead name tc
vspindles <- tryRead name spindles
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] =
return (name, new_node)
loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu] =