Revision bf028b21
b/src/Ganeti/HTools/Backend/Rapi.hs | ||
---|---|---|
166 | 166 |
dtotal <- extract "dtotal" |
167 | 167 |
dfree <- extract "dfree" |
168 | 168 |
ctotal <- extract "ctotal" |
169 |
return $ Node.create name mtotal mnode mfree
|
|
169 |
return $ Node.create name mtotal mnode mfree |
|
170 | 170 |
dtotal dfree ctotal False spindles guuid' |
171 | 171 |
return (name, node) |
172 | 172 |
|
... | ... | |
182 | 182 |
return (uuid, Group.create name uuid apol ipol tags) |
183 | 183 |
|
184 | 184 |
-- | Parse cluster data from the info resource. |
185 |
parseCluster :: JSObject JSValue -> Result ([String], IPolicy) |
|
185 |
parseCluster :: JSObject JSValue -> Result ([String], IPolicy, String)
|
|
186 | 186 |
parseCluster obj = do |
187 | 187 |
let obj' = fromJSObject obj |
188 | 188 |
extract s = tryFromObj "Parsing cluster data" obj' s |
189 |
master <- extract "master" |
|
189 | 190 |
tags <- extract "tags" |
190 | 191 |
ipolicy <- extract "ipolicy" |
191 |
return (tags, ipolicy) |
|
192 |
return (tags, ipolicy, master)
|
|
192 | 193 |
|
193 | 194 |
-- | Loads the raw cluster data from an URL. |
194 | 195 |
readDataHttp :: String -- ^ Cluster or URL to use as source |
... | ... | |
229 | 230 |
let (node_names, node_idx) = assignIndices node_data |
230 | 231 |
inst_data <- inst_body >>= getInstances node_names |
231 | 232 |
let (_, inst_idx) = assignIndices inst_data |
232 |
(tags, ipolicy) <- info_body >>= |
|
233 |
(fromJResult "Parsing cluster info" . decodeStrict) >>= |
|
234 |
parseCluster |
|
235 |
return (ClusterData group_idx node_idx inst_idx tags ipolicy) |
|
233 |
(tags, ipolicy, master) <- |
|
234 |
info_body >>= |
|
235 |
(fromJResult "Parsing cluster info" . decodeStrict) >>= |
|
236 |
parseCluster |
|
237 |
node_idx' <- setMaster node_names node_idx master |
|
238 |
return (ClusterData group_idx node_idx' inst_idx tags ipolicy) |
|
236 | 239 |
|
237 | 240 |
-- | Top level function for data loading. |
238 | 241 |
loadData :: String -- ^ Cluster or URL to use as source |
Also available in: Unified diff