Skip to content
Snippets Groups Projects
Commit e4d8071d authored by Iustin Pop's avatar Iustin Pop
Browse files

Text.hs: also save the group data when serialising


This should have been in the previous patches, but sent separate for
clarity.

The live-test script is updated to read the first node from the
cluster, now that the text files don't start anymore with the node
data.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarBalazs Lecz <leczb@google.com>
parent 10ef6b4e
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,15 @@ import qualified Ganeti.HTools.Group as Group
import qualified Ganeti.HTools.Node as Node
import qualified Ganeti.HTools.Instance as Instance
-- | Serialize a single group
serializeGroup :: Group.Group -> String
serializeGroup grp =
printf "%s|%s" (Group.name grp) (Group.uuid grp)
-- | Generate group file data from a group list
serializeGroups :: Group.List -> String
serializeGroups = unlines . map serializeGroup . Container.elems
-- | Serialize a single node
serializeNode :: Group.List -> Node.Node -> String
serializeNode gl node =
......@@ -89,9 +98,10 @@ serializeInstances nl =
-- | Generate complete cluster data from node and instance lists
serializeCluster :: Group.List -> Node.List -> Instance.List -> String
serializeCluster gl nl il =
let ndata = serializeNodes gl nl
let gdata = serializeGroups gl
ndata = serializeNodes gl nl
idata = serializeInstances nl il
in ndata ++ ['\n'] ++ idata
in gdata ++ ['\n'] ++ ndata ++ ['\n'] ++ idata
-- | Load a group from a field list.
loadGroup :: (Monad m) => [String] -> m (String, Group.Group)
......
#!/bin/bash
# Copyright (C) 2009 Google Inc.
# Copyright (C) 2009, 2010 Google Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -48,7 +48,7 @@ echo Testing hscan/luxi
echo Comparing hscan results...
diff -u $T/$RAPI.data $T/LOCAL.data
FN=$(head -n1 $T/$RAPI.data|cut -d \| -f1)
FN=$($CLUSTER head -n1 /var/lib/ganeti/ssconf_node_list)
FI=$($CLUSTER head -n1 /var/lib/ganeti/ssconf_instance_list)
......
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