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