Revision 96f9b0a6 src/Ganeti/HTools/Backend/Rapi.hs

b/src/Ganeti/HTools/Backend/Rapi.hs
156 156
  vm_cap  <- annotateResult desc $ maybeFromObj a "vm_capable"
157 157
  let vm_cap' = fromMaybe True vm_cap
158 158
  ndparams <- extract "ndparams" >>= asJSObject
159
  spindles <- tryFromObj desc (fromJSObject ndparams) "spindle_count"
160 159
  excl_stor <- tryFromObj desc (fromJSObject ndparams) "exclusive_storage"
161 160
  guuid   <- annotateResult desc $ maybeFromObj a "group.uuid"
162 161
  guuid' <-  lookupGroup ktg name (fromMaybe defaultGroupID guuid)
163 162
  let live = not offline && not drained && vm_cap'
164 163
      lvextract def = eitherLive live def . extract
164
  sptotal <- if excl_stor
165
             then lvextract 0 "sptotal"
166
             else tryFromObj desc (fromJSObject ndparams) "spindle_count"
167
  spfree <- lvextract 0 "spfree"
165 168
  mtotal <- lvextract 0.0 "mtotal"
166 169
  mnode <- lvextract 0 "mnode"
167 170
  mfree <- lvextract 0 "mfree"
......
171 174
  tags <- extract "tags"
172 175
  let node = flip Node.setNodeTags tags $
173 176
             Node.create name mtotal mnode mfree dtotal dfree ctotal (not live)
174
             spindles guuid' excl_stor
177
             sptotal spfree guuid' excl_stor
175 178
  return (name, node)
176 179

  
177 180
-- | Construct a group from a JSON object.

Also available in: Unified diff