Revision 8bc34c7b htools/Ganeti/HTools/Rapi.hs
b/htools/Ganeti/HTools/Rapi.hs | ||
---|---|---|
4 | 4 |
|
5 | 5 |
{- |
6 | 6 |
|
7 |
Copyright (C) 2009, 2010, 2011 Google Inc. |
|
7 |
Copyright (C) 2009, 2010, 2011, 2012 Google Inc.
|
|
8 | 8 |
|
9 | 9 |
This program is free software; you can redistribute it and/or modify |
10 | 10 |
it under the terms of the GNU General Public License as published by |
... | ... | |
137 | 137 |
drained <- extract "drained" |
138 | 138 |
vm_cap <- annotateResult desc $ maybeFromObj a "vm_capable" |
139 | 139 |
let vm_cap' = fromMaybe True vm_cap |
140 |
ndparams <- extract "ndparams" >>= asJSObject |
|
141 |
spindles <- tryFromObj desc (fromJSObject ndparams) "spindle_count" |
|
140 | 142 |
guuid <- annotateResult desc $ maybeFromObj a "group.uuid" |
141 | 143 |
guuid' <- lookupGroup ktg name (fromMaybe defaultGroupID guuid) |
142 | 144 |
node <- if offline || drained || not vm_cap' |
143 |
then return $ Node.create name 0 0 0 0 0 0 True guuid' |
|
145 |
then return $ Node.create name 0 0 0 0 0 0 True 0 guuid'
|
|
144 | 146 |
else do |
145 | 147 |
mtotal <- extract "mtotal" |
146 | 148 |
mnode <- extract "mnode" |
... | ... | |
149 | 151 |
dfree <- extract "dfree" |
150 | 152 |
ctotal <- extract "ctotal" |
151 | 153 |
return $ Node.create name mtotal mnode mfree |
152 |
dtotal dfree ctotal False guuid' |
|
154 |
dtotal dfree ctotal False spindles guuid'
|
|
153 | 155 |
return (name, node) |
154 | 156 |
|
155 | 157 |
-- | Construct a group from a JSON object. |
Also available in: Unified diff