diff --git a/Ganeti/HTools/Text.hs b/Ganeti/HTools/Text.hs index 2b2c725ff2fb5c3d084a187e80441f7931084903..11c2770db7ba7fdf6c5a3b2497d2fa534b41f0ab 100644 --- a/Ganeti/HTools/Text.hs +++ b/Ganeti/HTools/Text.hs @@ -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) diff --git a/live-test.sh b/live-test.sh index c2a6d2fa0a97f3b997921fb4a5d40ab37272eaa2..37683317da94e334c659dbe38eaac88a0ccb6f42 100755 --- a/live-test.sh +++ b/live-test.sh @@ -1,6 +1,6 @@ #!/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)