From afcd5a0b9f1d337006bb1291d0cb1a07ce5a9248 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 16 Dec 2010 13:02:31 +0100 Subject: [PATCH] Text.hs: also read cluster tags from the data file This means that a file with the correct information is as accurate as the other backends (Luxi, Rapi). Serialization of tags is in the next patch. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Balazs Lecz <leczb@google.com> --- Ganeti/HTools/Text.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Ganeti/HTools/Text.hs b/Ganeti/HTools/Text.hs index bc3e83f54..9875d7550 100644 --- a/Ganeti/HTools/Text.hs +++ b/Ganeti/HTools/Text.hs @@ -168,18 +168,19 @@ parseData :: String -- ^ Text data -> Result (Group.List, Node.List, Instance.List, [String]) parseData fdata = do let flines = lines fdata - (glines, nlines, ilines) <- + (glines, nlines, ilines, ctags) <- case sepSplit "" flines of - [a, b, c] -> Ok (a, b, c) + [a, b, c, d] -> Ok (a, b, c, d) xs -> Bad $ printf "Invalid format of the input file: %d sections\ - \ instead of 3" (length xs) + \ instead of 4" (length xs) {- group file: name uuid -} (ktg, gl) <- loadTabular glines loadGroup {- node file: name t_mem n_mem f_mem t_disk f_disk -} (ktn, nl) <- loadTabular nlines (loadNode ktg) {- instance file: name mem disk status pnode snode -} (_, il) <- loadTabular ilines (loadInst ktn) - return (gl, nl, il, []) + {- the tags are simply line-based, no processing needed -} + return (gl, nl, il, ctags) -- | Top level function for data loading loadData :: String -- ^ Path to the text file -- GitLab