Revision 0eb83d70 src/Ganeti/HTools/Backend/Rapi.hs

b/src/Ganeti/HTools/Backend/Rapi.hs
157 157
  spindles <- tryFromObj desc (fromJSObject ndparams) "spindle_count"
158 158
  guuid   <- annotateResult desc $ maybeFromObj a "group.uuid"
159 159
  guuid' <-  lookupGroup ktg name (fromMaybe defaultGroupID guuid)
160
  node <- if offline || drained || not vm_cap'
161
            then return $ Node.create name 0 0 0 0 0 0 True 0 guuid'
162
            else do
163
              mtotal  <- extract "mtotal"
164
              mnode   <- extract "mnode"
165
              mfree   <- extract "mfree"
166
              dtotal  <- extract "dtotal"
167
              dfree   <- extract "dfree"
168
              ctotal  <- extract "ctotal"
169
              return $ Node.create name mtotal mnode mfree
170
                     dtotal dfree ctotal False spindles guuid'
160
  let live = not offline && not drained && vm_cap'
161
      lvextract def = eitherLive live def . extract
162
  mtotal <- lvextract 0.0 "mtotal"
163
  mnode <- lvextract 0 "mnode"
164
  mfree <- lvextract 0 "mfree"
165
  dtotal <- lvextract 0.0 "dtotal"
166
  dfree <- lvextract 0 "dfree"
167
  ctotal <- lvextract 0.0 "ctotal"
168
  let node = Node.create name mtotal mnode mfree dtotal dfree ctotal (not live)
169
             spindles guuid'
171 170
  return (name, node)
172 171

  
173 172
-- | Construct a group from a JSON object.

Also available in: Unified diff