From 786c514c804b60e7dae60780d0e83ee11a4da2a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com>
Date: Fri, 2 Mar 2012 11:50:55 +0100
Subject: [PATCH] htools/IAlloc: Adding loadData method for use as backend
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: RenΓ© Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 htools/Ganeti/HTools/IAlloc.hs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/htools/Ganeti/HTools/IAlloc.hs b/htools/Ganeti/HTools/IAlloc.hs
index a6a5b14c5..e2076e2aa 100644
--- a/htools/Ganeti/HTools/IAlloc.hs
+++ b/htools/Ganeti/HTools/IAlloc.hs
@@ -27,6 +27,7 @@ module Ganeti.HTools.IAlloc
   ( readRequest
   , runIAllocator
   , processRelocate
+  , loadData
   ) where
 
 import Data.Either ()
@@ -343,3 +344,10 @@ runIAllocator request =
           Bad msg -> (False, "Request failed: " ++ msg, JSArray [], Nothing)
       rstring = formatResponse ok info result
   in (cdata, rstring)
+
+-- | Load the data from an iallocation request file
+loadData :: FilePath -- ^ The path to the file
+         -> IO (Result ClusterData)
+loadData fp = do
+  Request _ cdata <- readRequest fp
+  return $ Ok cdata
-- 
GitLab