Commit bd1794b2 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix loading of plain instances via iallocator

Currently iallocator is broken when reading single-node instances (and
with an ugly error message). This patch fixes this case, by marking them
with secondary node “noSecondary” like the rest of the code.
parent 8a6f10ce
......@@ -55,9 +55,10 @@ parseInstance ktn n a = do
base <- parseBaseInstance n a
nodes <- fromObj "nodes" a
pnode <- readEitherString $ head nodes
snode <- readEitherString $ (head . tail) nodes
pidx <- lookupNode ktn n pnode
sidx <- lookupNode ktn n snode
let snodes = tail nodes
sidx <- (if null snodes then return Node.noSecondary
else (readEitherString $ head snodes) >>= lookupNode ktn n)
return (n, Instance.setBoth (snd base) pidx sidx)
parseNode :: String -> JSObject JSValue -> Result (String, Node.Node)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment