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

rapi, luxi: treat drained nodes as offline

Commit e97f211e changed the iallocator backend to handle drained nodes as
offline. This commit completes that change by making the rapi and luxi
backend do the same (the text backend ignores any '?' values which are
returned by ganeti when nodes have problems, so it doesn't need this
change).
parent 1cea2e1e
......@@ -131,10 +131,10 @@ parseNode (JSArray [ name, mtotal, mnode, mfree, dtotal, dfree
xname <- annotateResult "Parsing new node" (fromJVal name)
let convert v = annotateResult ("Node '" ++ xname ++ "'") (fromJVal v)
xoffline <- convert offline
node <- (if xoffline
xdrained <- convert drained
node <- (if xoffline || xdrained
then return $ Node.create xname 0 0 0 0 0 0 True
else do
xdrained <- convert drained
xmtotal <- convert mtotal
xmnode <- convert mnode
xmfree <- convert mfree
......@@ -142,7 +142,7 @@ parseNode (JSArray [ name, mtotal, mnode, mfree, dtotal, dfree
xdfree <- convert dfree
xctotal <- convert ctotal
return $ Node.create xname xmtotal xmnode xmfree
xdtotal xdfree xctotal (xoffline || xdrained))
xdtotal xdfree xctotal False)
return (xname, node)
parseNode v = fail ("Invalid node query result: " ++ show v)
......
......@@ -98,10 +98,10 @@ parseNode a = do
name <- tryFromObj "Parsing new node" a "name"
let extract s = tryFromObj ("Node '" ++ name ++ "'") a s
offline <- extract "offline"
node <- (if offline
drained <- extract "drained"
node <- (if offline || drained
then return $ Node.create name 0 0 0 0 0 0 True
else do
drained <- extract "drained"
mtotal <- extract "mtotal"
mnode <- extract "mnode"
mfree <- extract "mfree"
......@@ -109,7 +109,7 @@ parseNode a = do
dfree <- extract "dfree"
ctotal <- extract "ctotal"
return $ Node.create name mtotal mnode mfree
dtotal dfree ctotal (offline || drained))
dtotal dfree ctotal False)
return (name, node)
-- | Builds the cluster data from an URL.
......
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