From 5850e9902c90fd543a6c15cd454fd3799661361f Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 15 Mar 2012 18:48:47 +0100
Subject: [PATCH] htools: Fix some compiler warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 htools/Ganeti/HTools/Cluster.hs | 15 +++++++--------
 htools/Ganeti/HTools/Utils.hs   |  7 +++----
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/htools/Ganeti/HTools/Cluster.hs b/htools/Ganeti/HTools/Cluster.hs
index e9e423afd..9500aeafa 100644
--- a/htools/Ganeti/HTools/Cluster.hs
+++ b/htools/Ganeti/HTools/Cluster.hs
@@ -1260,8 +1260,8 @@ computeMoves i inam mv c d =
     ReplacePrimary _ -> (printf "f r:%s f" c, [mig, rep c, mig])
   where morf = if Instance.isRunning i then "migrate" else "failover"
         mig = printf "%s -f %s" morf inam::String
-        mig_any = printf "%s -f -n %s %s" morf c inam
-        rep n = printf "replace-disks -n %s %s" n inam
+        mig_any = printf "%s -f -n %s %s" morf c inam::String
+        rep n = printf "replace-disks -n %s %s" n inam::String
 
 -- | Converts a placement to string format.
 printSolutionLine :: Node.List     -- ^ The node list
@@ -1285,14 +1285,13 @@ printSolutionLine nl il nmlen imlen plc pos =
       (moves, cmds) =  computeMoves inst inam mv npri nsec
       -- FIXME: this should check instead/also the disk template
       ostr = if old_sec == Node.noSecondary
-               then printf "%s" opri
-               else printf "%s:%s" opri osec
+               then printf "%s" opri::String
+               else printf "%s:%s" opri osec::String
       nstr = if s == Node.noSecondary
-               then printf "%s" npri
-               else printf "%s:%s" npri nsec
+               then printf "%s" npri::String
+               else printf "%s:%s" npri nsec::String
   in (printf "  %3d. %-*s %-*s => %-*s %12.8f a=%s"
-      pos imlen inam pmlen (ostr::String)
-      pmlen (nstr::String) c moves,
+      pos imlen inam pmlen ostr pmlen nstr c moves,
       cmds)
 
 -- | Return the instance and involved nodes in an instance move.
diff --git a/htools/Ganeti/HTools/Utils.hs b/htools/Ganeti/HTools/Utils.hs
index 2bc73600d..d47f58143 100644
--- a/htools/Ganeti/HTools/Utils.hs
+++ b/htools/Ganeti/HTools/Utils.hs
@@ -2,7 +2,7 @@
 
 {-
 
-Copyright (C) 2009, 2010, 2011 Google Inc.
+Copyright (C) 2009, 2010, 2011, 2012 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
@@ -40,7 +40,6 @@ module Ganeti.HTools.Utils
 
 import Data.Char (toUpper)
 import Data.List
-import Data.Ratio ((%))
 
 import Debug.Trace
 
@@ -178,8 +177,8 @@ parseUnitValue unit
   | unit == "T" || upper == "TB"  = return $ mbFactor * kbDecimal * kbDecimal
   | otherwise = fail $ "Unknown unit '" ++ unit ++ "'"
   where upper = map toUpper unit
-        kbBinary = 1024
-        kbDecimal = 1000
+        kbBinary = 1024 :: Rational
+        kbDecimal = 1000 :: Rational
         decToBin = kbDecimal / kbBinary -- factor for 1K conversion
         mbFactor = decToBin * decToBin -- twice the factor for just 1K
 
-- 
GitLab