Revision 8c72f711 src/Ganeti/HTools/Backend/Rapi.hs
b/src/Ganeti/HTools/Backend/Rapi.hs | ||
---|---|---|
160 | 160 |
excl_stor <- tryFromObj desc (fromJSObject ndparams) "exclusive_storage" |
161 | 161 |
guuid <- annotateResult desc $ maybeFromObj a "group.uuid" |
162 | 162 |
guuid' <- lookupGroup ktg name (fromMaybe defaultGroupID guuid) |
163 |
node <- if offline || drained || not vm_cap' |
|
164 |
then return $ Node.create name 0 0 0 0 0 0 True 0 guuid' False |
|
165 |
else do |
|
166 |
mtotal <- extract "mtotal" |
|
167 |
mnode <- extract "mnode" |
|
168 |
mfree <- extract "mfree" |
|
169 |
dtotal <- extract "dtotal" |
|
170 |
dfree <- extract "dfree" |
|
171 |
ctotal <- extract "ctotal" |
|
172 |
tags <- extract "tags" |
|
173 |
return . flip Node.setNodeTags tags $ |
|
174 |
Node.create name mtotal mnode mfree dtotal dfree ctotal False |
|
175 |
spindles guuid' excl_stor |
|
163 |
let live = not offline && not drained && vm_cap' |
|
164 |
lvextract def = eitherLive live def . extract |
|
165 |
mtotal <- lvextract 0.0 "mtotal" |
|
166 |
mnode <- lvextract 0 "mnode" |
|
167 |
mfree <- lvextract 0 "mfree" |
|
168 |
dtotal <- lvextract 0.0 "dtotal" |
|
169 |
dfree <- lvextract 0 "dfree" |
|
170 |
ctotal <- lvextract 0.0 "ctotal" |
|
171 |
tags <- extract "tags" |
|
172 |
let node = flip Node.setNodeTags tags $ |
|
173 |
Node.create name mtotal mnode mfree dtotal dfree ctotal (not live) |
|
174 |
spindles guuid' excl_stor |
|
176 | 175 |
return (name, node) |
177 | 176 |
|
178 | 177 |
-- | Construct a group from a JSON object. |
Also available in: Unified diff