diff --git a/htools/Ganeti/HTools/Text.hs b/htools/Ganeti/HTools/Text.hs index c01376e590a8e1f224a3662244aadc5de3b5c7b8..4c861fabe050c03c1589e17ee0f6b52ab8e0fb3a 100644 --- a/htools/Ganeti/HTools/Text.hs +++ b/htools/Ganeti/HTools/Text.hs @@ -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. diff --git a/man/htools.rst b/man/htools.rst index 3449b4ef04e8c0c40bb67d8e4a728f726a096618..338b99c6465c387209284e938b991fdf57c8dec2 100644 --- a/man/htools.rst +++ b/man/htools.rst @@ -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