Revision c324da14 src/Ganeti/HTools/Backend/Luxi.hs
b/src/Ganeti/HTools/Backend/Luxi.hs | ||
---|---|---|
104 | 104 |
L.Query (Qlang.ItemTypeOpCode Qlang.QRNode) |
105 | 105 |
["name", "mtotal", "mnode", "mfree", "dtotal", "dfree", |
106 | 106 |
"ctotal", "offline", "drained", "vm_capable", |
107 |
"ndp/spindle_count", "group.uuid", "tags"] Qlang.EmptyFilter |
|
107 |
"ndp/spindle_count", "group.uuid", "tags", |
|
108 |
"ndp/exclusive_storage"] Qlang.EmptyFilter |
|
108 | 109 |
|
109 | 110 |
-- | The input data for instance query. |
110 | 111 |
queryInstancesMsg :: L.LuxiOp |
... | ... | |
185 | 186 |
-- | Construct a node from a JSON object. |
186 | 187 |
parseNode :: NameAssoc -> [(JSValue, JSValue)] -> Result (String, Node.Node) |
187 | 188 |
parseNode ktg [ name, mtotal, mnode, mfree, dtotal, dfree |
188 |
, ctotal, offline, drained, vm_capable, spindles, g_uuid
|
|
189 |
, tags ] |
|
189 |
, ctotal, offline, drained, vm_capable, spindles, g_uuid |
|
190 |
, tags, excl_stor ]
|
|
190 | 191 |
= do |
191 | 192 |
xname <- annotateResult "Parsing new node" (fromJValWithStatus name) |
192 | 193 |
let convert a = genericConvert "Node" xname a |
... | ... | |
196 | 197 |
xspindles <- convert "spindles" spindles |
197 | 198 |
xgdx <- convert "group.uuid" g_uuid >>= lookupGroup ktg xname |
198 | 199 |
xtags <- convert "tags" tags |
200 |
xexcl_stor <- convert "exclusive_storage" excl_stor |
|
199 | 201 |
node <- if xoffline || xdrained || not xvm_capable |
200 |
then return $ Node.create xname 0 0 0 0 0 0 True xspindles xgdx |
|
202 |
then return $ |
|
203 |
Node.create xname 0 0 0 0 0 0 True xspindles xgdx False |
|
201 | 204 |
else do |
202 | 205 |
xmtotal <- convert "mtotal" mtotal |
203 | 206 |
xmnode <- convert "mnode" mnode |
... | ... | |
207 | 210 |
xctotal <- convert "ctotal" ctotal |
208 | 211 |
return . flip Node.setNodeTags xtags $ |
209 | 212 |
Node.create xname xmtotal xmnode xmfree xdtotal xdfree |
210 |
xctotal False xspindles xgdx |
|
213 |
xctotal False xspindles xgdx xexcl_stor
|
|
211 | 214 |
return (xname, node) |
212 | 215 |
|
213 | 216 |
parseNode _ v = fail ("Invalid node query result: " ++ show v) |
Also available in: Unified diff