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

Read auto_balance via Luxi


Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarAdeodato Simo <dato@google.com>
parent 93439b1c
No related branches found
No related tags found
No related merge requests found
...@@ -75,7 +75,8 @@ queryNodesMsg = ...@@ -75,7 +75,8 @@ queryNodesMsg =
queryInstancesMsg :: L.LuxiOp queryInstancesMsg :: L.LuxiOp
queryInstancesMsg = queryInstancesMsg =
L.QueryInstances [] ["name", "disk_usage", "be/memory", "be/vcpus", L.QueryInstances [] ["name", "disk_usage", "be/memory", "be/vcpus",
"status", "pnode", "snodes", "tags", "oper_ram"] False "status", "pnode", "snodes", "tags", "oper_ram",
"be/auto_balance"] False
-- | The input data for cluster query. -- | The input data for cluster query.
queryClusterInfoMsg :: L.LuxiOp queryClusterInfoMsg :: L.LuxiOp
...@@ -112,7 +113,8 @@ parseInstance :: NameAssoc ...@@ -112,7 +113,8 @@ parseInstance :: NameAssoc
-> JSValue -> JSValue
-> Result (String, Instance.Instance) -> Result (String, Instance.Instance)
parseInstance ktn (JSArray [ name, disk, mem, vcpus parseInstance ktn (JSArray [ name, disk, mem, vcpus
, status, pnode, snodes, tags, oram ]) = do , status, pnode, snodes, tags, oram
, auto_balance ]) = do
xname <- annotateResult "Parsing new instance" (fromJVal name) xname <- annotateResult "Parsing new instance" (fromJVal name)
let convert a = genericConvert "Instance" xname a let convert a = genericConvert "Instance" xname a
xdisk <- convert "disk_usage" disk xdisk <- convert "disk_usage" disk
...@@ -126,8 +128,9 @@ parseInstance ktn (JSArray [ name, disk, mem, vcpus ...@@ -126,8 +128,9 @@ parseInstance ktn (JSArray [ name, disk, mem, vcpus
else lookupNode ktn xname (fromJSString $ head xsnodes)) else lookupNode ktn xname (fromJSString $ head xsnodes))
xrunning <- convert "status" status xrunning <- convert "status" status
xtags <- convert "tags" tags xtags <- convert "tags" tags
xauto_balance <- convert "auto_balance" auto_balance
let inst = Instance.create xname xmem xdisk xvcpus let inst = Instance.create xname xmem xdisk xvcpus
xrunning xtags True xpnode snode xrunning xtags xauto_balance xpnode snode
return (xname, inst) return (xname, inst)
parseInstance _ v = fail ("Invalid instance query result: " ++ show v) parseInstance _ v = fail ("Invalid instance query result: " ++ show v)
......
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