X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/e77bc89b8b1d26948ab88b317c496f5276b63bc3..a7667ba6ea248be5ed63d24d5b74a4c92be69385:/htools/Ganeti/HTools/Luxi.hs diff --git a/htools/Ganeti/HTools/Luxi.hs b/htools/Ganeti/HTools/Luxi.hs index 74dd984..77d5614 100644 --- a/htools/Ganeti/HTools/Luxi.hs +++ b/htools/Ganeti/HTools/Luxi.hs @@ -4,7 +4,7 @@ {- -Copyright (C) 2009, 2010, 2011 Google Inc. +Copyright (C) 2009, 2010, 2011, 2012 Google Inc. 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 @@ -99,7 +99,7 @@ queryNodesMsg :: L.LuxiOp queryNodesMsg = L.Query L.QRNode ["name", "mtotal", "mnode", "mfree", "dtotal", "dfree", "ctotal", "offline", "drained", "vm_capable", - "group.uuid"] () + "ndp/spindle_count", "group.uuid"] () -- | The input data for instance query. queryInstancesMsg :: L.LuxiOp @@ -115,7 +115,7 @@ queryClusterInfoMsg = L.QueryClusterInfo -- | The input data for node group query. queryGroupsMsg :: L.LuxiOp queryGroupsMsg = - L.Query L.QRGroup ["uuid", "name", "alloc_policy"] () + L.Query L.QRGroup ["uuid", "name", "alloc_policy", "ipolicy"] () -- | Wraper over 'callMethod' doing node query. queryNodes :: L.Client -> IO (Result JSValue) @@ -175,16 +175,17 @@ getNodes ktg arr = extractArray arr >>= mapM (parseNode ktg) -- | Construct a node from a JSON object. parseNode :: NameAssoc -> [(JSValue, JSValue)] -> Result (String, Node.Node) parseNode ktg [ name, mtotal, mnode, mfree, dtotal, dfree - , ctotal, offline, drained, vm_capable, g_uuid ] + , ctotal, offline, drained, vm_capable, spindles, g_uuid ] = do xname <- annotateResult "Parsing new node" (fromJValWithStatus name) let convert a = genericConvert "Node" xname a xoffline <- convert "offline" offline xdrained <- convert "drained" drained xvm_capable <- convert "vm_capable" vm_capable + xspindles <- convert "spindles" spindles xgdx <- convert "group.uuid" g_uuid >>= lookupGroup ktg xname node <- if xoffline || xdrained || not xvm_capable - then return $ Node.create xname 0 0 0 0 0 0 True xgdx + then return $ Node.create xname 0 0 0 0 0 0 True xspindles xgdx else do xmtotal <- convert "mtotal" mtotal xmnode <- convert "mnode" mnode @@ -193,7 +194,7 @@ parseNode ktg [ name, mtotal, mnode, mfree, dtotal, dfree xdfree <- convert "dfree" dfree xctotal <- convert "ctotal" ctotal return $ Node.create xname xmtotal xmnode xmfree - xdtotal xdfree xctotal False xgdx + xdtotal xdfree xctotal False xspindles xgdx return (xname, node) parseNode _ v = fail ("Invalid node query result: " ++ show v) @@ -215,12 +216,13 @@ getGroups jsv = extractArray jsv >>= mapM parseGroup -- | Parses a given group information. parseGroup :: [(JSValue, JSValue)] -> Result (String, Group.Group) -parseGroup [uuid, name, apol] = do +parseGroup [uuid, name, apol, ipol] = do xname <- annotateResult "Parsing new group" (fromJValWithStatus name) let convert a = genericConvert "Group" xname a xuuid <- convert "uuid" uuid xapol <- convert "alloc_policy" apol - return (xuuid, Group.create xname xuuid xapol) + xipol <- convert "ipolicy" ipol + return (xuuid, Group.create xname xuuid xapol xipol) parseGroup v = fail ("Invalid group query result: " ++ show v)