Revision 3daaab6c src/Ganeti/HTools/Backend/Rapi.hs

b/src/Ganeti/HTools/Backend/Rapi.hs
150 150
parseNode ktg a = do
151 151
  name <- tryFromObj "Parsing new node" a "name"
152 152
  let desc = "Node '" ++ name ++ "', error while parsing data"
153
      extract s = tryFromObj desc a s
153
      extract key = tryFromObj desc a key
154
      extractDef def key = fromObjWithDefault a key def
154 155
  offline <- extract "offline"
155 156
  drained <- extract "drained"
156 157
  vm_cap  <- annotateResult desc $ maybeFromObj a "vm_capable"
......
161 162
  guuid' <-  lookupGroup ktg name (fromMaybe defaultGroupID guuid)
162 163
  let live = not offline && vm_cap'
163 164
      lvextract def = eitherLive live def . extract
165
      lvextractDef def = eitherLive live def . extractDef def
164 166
  sptotal <- if excl_stor
165 167
             then lvextract 0 "sptotal"
166 168
             else tryFromObj desc (fromJSObject ndparams) "spindle_count"
167
  spfree <- lvextract 0 "spfree"
169
  spfree <- lvextractDef 0 "spfree"
168 170
  mtotal <- lvextract 0.0 "mtotal"
169 171
  mnode <- lvextract 0 "mnode"
170 172
  mfree <- lvextract 0 "mfree"
171
  dtotal <- lvextract 0.0 "dtotal"
172
  dfree <- lvextract 0 "dfree"
173
  dtotal <- lvextractDef 0.0 "dtotal"
174
  dfree <- lvextractDef 0 "dfree"
173 175
  ctotal <- lvextract 0.0 "ctotal"
174 176
  cnos <- lvextract 0 "cnos"
175 177
  tags <- extract "tags"

Also available in: Unified diff