Add an utility function for triples
[ganeti-local] / hscan.hs
index 5189b58..2a6981d 100644 (file)
--- a/hscan.hs
+++ b/hscan.hs
@@ -2,6 +2,27 @@
 
 -}
 
+{-
+
+Copyright (C) 2009 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
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.
+
+-}
+
 module Main (main) where
 
 import Data.List
@@ -73,7 +94,7 @@ options =
     ]
 
 -- | Generate node file data from node objects
-serializeNodes :: Cluster.NodeList -> String -> String
+serializeNodes :: Node.List -> String -> String
 serializeNodes nl csf =
     let nodes = Container.elems nl
         nlines = map
@@ -91,7 +112,7 @@ serializeNodes nl csf =
     in unlines nlines
 
 -- | Generate instance file data from instance objects
-serializeInstances :: Cluster.NodeList -> Cluster.InstanceList
+serializeInstances :: Node.List -> Instance.List
                    -> String -> String
 serializeInstances nl il csf =
     let instances = Container.elems il
@@ -99,8 +120,8 @@ serializeInstances nl il csf =
                  (\inst ->
                       let
                           iname = Instance.name inst ++ csf
-                          pnode = cNameOf nl $ Instance.pnode inst
-                          snode = cNameOf nl $ Instance.snode inst
+                          pnode = Container.nameOf nl $ Instance.pnode inst
+                          snode = Container.nameOf nl $ Instance.snode inst
                       in
                         printf "%s|%d|%d|%s|%s|%s"
                                iname (Instance.mem inst) (Instance.dsk inst)
@@ -111,7 +132,7 @@ serializeInstances nl il csf =
     in unlines nlines
 
 -- | Return a one-line summary of cluster state
-printCluster :: Cluster.NodeList -> Cluster.InstanceList
+printCluster :: Node.List -> Instance.List
              -> String
 printCluster nl il =
     let (bad_nodes, bad_instances) = Cluster.computeBadItems nl il