Commit f951bd09 authored by Iustin Pop's avatar Iustin Pop
Browse files

htools: support spindles in text load/save



If missing, we'll default to 1 spindle.

This also updates the text file format with the ipolicy, which was
forgotten.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 34ace266
......@@ -78,11 +78,12 @@ serializeNode :: Group.List -- ^ The list of groups (needed for group uuid)
-> Node.Node -- ^ The node to be serialised
-> String
serializeNode gl node =
printf "%s|%.0f|%d|%d|%.0f|%d|%.0f|%c|%s" (Node.name 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')
(Group.uuid grp)
(Node.spindleCount node)
where grp = Container.find (Node.group node) gl
-- | Generate node file data from node objects.
......@@ -177,7 +178,7 @@ loadNode :: (Monad m) =>
-> [String] -- ^ Input data as a list of fields
-> m (String, Node.Node) -- ^ The result, a tuple o node name
-- and node object
loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu] = do
loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu, spindles] = do
gdx <- lookupGroup ktg name gu
new_node <-
if any (== "?") [tm,nm,fm,td,fd,tc] || fo == "Y" then
......@@ -189,8 +190,13 @@ loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu] = do
vtd <- tryRead name td
vfd <- tryRead name fd
vtc <- tryRead name tc
return $ Node.create name vtm vnm vfm vtd vfd vtc False 1 gdx
vspindles <- tryRead name spindles
return $ 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] =
loadNode ktg [name, tm, nm, fm, td, fd, tc, fo, gu, "1"]
loadNode _ s = fail $ "Invalid/incomplete node data: '" ++ show s ++ "'"
-- | Load an instance from a field list.
......
......@@ -156,6 +156,7 @@ support all options. Some common options are:
- node physical cores
- offline field (as ``Y`` or ``N``)
- group UUID
- node spindle count
The third section contains instance data, with the fields:
......@@ -170,8 +171,23 @@ support all options. Some common options are:
- instance disk type (e.g. ``plain`` or ``drbd``)
- instance tags
The fourth and last section contains the cluster tags, with one tag
per line (no columns/no column processing).
The fourth section contains the cluster tags, with one tag per line
(no columns/no column processing).
The fifth section contains the ipolicies of the cluster and the node
groups, in the following format (separated by ``|``):
- owner (empty if cluster, group name otherwise)
- standard, min, max instance specs, containing the following values
separated by commas:
- memory size
- cpu count
- disk size
- disk count
- nic count
- disk templates
- vcpu ratio
- spindle ratio
-m *cluster*
Backend specification: collect data directly from the *cluster* given
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment