Skip to content
Snippets Groups Projects
Commit 9d775204 authored by Iustin Pop's avatar Iustin Pop
Browse files

Ignore nodes which are not vm_capable

This break compatibility with Ganeti pre-2.3.
parent 92d43268
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{- {-
Copyright (C) 2009 Google Inc. Copyright (C) 2009, 2010 Google Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -53,7 +53,7 @@ toArray v = ...@@ -53,7 +53,7 @@ toArray v =
queryNodesMsg :: L.LuxiOp queryNodesMsg :: L.LuxiOp
queryNodesMsg = queryNodesMsg =
L.QueryNodes [] ["name", "mtotal", "mnode", "mfree", "dtotal", "dfree", L.QueryNodes [] ["name", "mtotal", "mnode", "mfree", "dtotal", "dfree",
"ctotal", "offline", "drained"] False "ctotal", "offline", "drained", "vm_capable"] False
-- | The input data for instance query. -- | The input data for instance query.
queryInstancesMsg :: L.LuxiOp queryInstancesMsg :: L.LuxiOp
...@@ -114,13 +114,14 @@ getNodes arr = toArray arr >>= mapM parseNode ...@@ -114,13 +114,14 @@ getNodes arr = toArray arr >>= mapM parseNode
-- | Construct a node from a JSON object. -- | Construct a node from a JSON object.
parseNode :: JSValue -> Result (String, Node.Node) parseNode :: JSValue -> Result (String, Node.Node)
parseNode (JSArray [ name, mtotal, mnode, mfree, dtotal, dfree parseNode (JSArray [ name, mtotal, mnode, mfree, dtotal, dfree
, ctotal, offline, drained ]) , ctotal, offline, drained, vm_capable ])
= do = do
xname <- annotateResult "Parsing new node" (fromJVal name) xname <- annotateResult "Parsing new node" (fromJVal name)
let convert v = annotateResult ("Node '" ++ xname ++ "'") (fromJVal v) let convert v = annotateResult ("Node '" ++ xname ++ "'") (fromJVal v)
xoffline <- convert offline xoffline <- convert offline
xdrained <- convert drained xdrained <- convert drained
node <- (if xoffline || xdrained xvm_capable <- convert vm_capable
node <- (if xoffline || xdrained || not xvm_capable
then return $ Node.create xname 0 0 0 0 0 0 True then return $ Node.create xname 0 0 0 0 0 0 True
else do else do
xmtotal <- convert mtotal xmtotal <- convert mtotal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment