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