Revision 8c72f711 src/Ganeti/HTools/Backend/IAlloc.hs
b/src/Ganeti/HTools/Backend/IAlloc.hs | ||
---|---|---|
133 | 133 |
vm_capable <- annotateResult desc $ maybeFromObj a "vm_capable" |
134 | 134 |
let vm_capable' = fromMaybe True vm_capable |
135 | 135 |
gidx <- lookupGroup ktg n guuid |
136 |
node <- if offline || drained || not vm_capable' |
|
137 |
then return $ Node.create n 0 0 0 0 0 0 True 0 gidx False |
|
138 |
else do |
|
139 |
mtotal <- extract "total_memory" |
|
140 |
mnode <- extract "reserved_memory" |
|
141 |
mfree <- extract "free_memory" |
|
142 |
dtotal <- extract "total_disk" |
|
143 |
dfree <- extract "free_disk" |
|
144 |
ctotal <- extract "total_cpus" |
|
145 |
ndparams <- extract "ndparams" >>= asJSObject |
|
146 |
spindles <- tryFromObj desc (fromJSObject ndparams) |
|
147 |
"spindle_count" |
|
148 |
excl_stor <- tryFromObj desc (fromJSObject ndparams) |
|
149 |
"exclusive_storage" |
|
150 |
return $ Node.create n mtotal mnode mfree |
|
151 |
dtotal dfree ctotal False spindles gidx excl_stor |
|
136 |
ndparams <- extract "ndparams" >>= asJSObject |
|
137 |
spindles <- tryFromObj desc (fromJSObject ndparams) "spindle_count" |
|
138 |
excl_stor <- tryFromObj desc (fromJSObject ndparams) "exclusive_storage" |
|
139 |
let live = not offline && not drained && vm_capable' |
|
140 |
lvextract def = eitherLive live def . extract |
|
141 |
mtotal <- lvextract 0.0 "total_memory" |
|
142 |
mnode <- lvextract 0 "reserved_memory" |
|
143 |
mfree <- lvextract 0 "free_memory" |
|
144 |
dtotal <- lvextract 0.0 "total_disk" |
|
145 |
dfree <- lvextract 0 "free_disk" |
|
146 |
ctotal <- lvextract 0.0 "total_cpus" |
|
147 |
let node = Node.create n mtotal mnode mfree dtotal dfree ctotal (not live) |
|
148 |
spindles gidx excl_stor |
|
152 | 149 |
return (n, node) |
153 | 150 |
|
154 | 151 |
-- | Parses a group as found in the cluster group list. |
Also available in: Unified diff