Revision c2fe6008
b/src/Ganeti/Query/Common.hs | ||
---|---|---|
39 | 39 |
, tagsFields |
40 | 40 |
, dictFieldGetter |
41 | 41 |
, buildNdParamField |
42 |
, getDefaultHypervisorSpec |
|
43 |
, getHvParamsFromCluster |
|
42 | 44 |
) where |
43 | 45 |
|
44 | 46 |
import qualified Data.Map as Map |
... | ... | |
47 | 49 |
|
48 | 50 |
import qualified Ganeti.Constants as C |
49 | 51 |
import Ganeti.Config |
52 |
import Ganeti.JSON |
|
50 | 53 |
import Ganeti.Objects |
51 | 54 |
import Ganeti.Rpc |
52 | 55 |
import Ganeti.Query.Language |
... | ... | |
176 | 179 |
desc = "The \"" ++ field ++ "\" node parameter" |
177 | 180 |
in (FieldDefinition full_name title qft desc, |
178 | 181 |
FieldConfig (ndParamGetter field), QffNormal) |
182 |
|
|
183 |
-- | Looks up the default hypervisor and its hvparams |
|
184 |
getDefaultHypervisorSpec :: ConfigData -> (Hypervisor, HvParams) |
|
185 |
getDefaultHypervisorSpec cfg = (hv, getHvParamsFromCluster cfg hv) |
|
186 |
where hv = getDefaultHypervisor cfg |
|
187 |
|
|
188 |
-- | Looks up the cluster's hvparams of the given hypervisor |
|
189 |
getHvParamsFromCluster :: ConfigData -> Hypervisor -> HvParams |
|
190 |
getHvParamsFromCluster cfg hv = |
|
191 |
fromMaybe (GenericContainer Map.empty) . |
|
192 |
Map.lookup (hypervisorToRaw hv) . |
|
193 |
fromContainer . clusterHvparams $ configCluster cfg |
b/src/Ganeti/Query/Node.hs | ||
---|---|---|
279 | 279 |
rpcres <- executeRpcCall good_nodes (RpcCallNodeInfo storage_units hvs) |
280 | 280 |
return $ fillUpList (fillPairFromMaybe rpcResultNodeBroken pickPairUnique) |
281 | 281 |
nodes rpcres |
282 |
|
|
283 |
-- | Looks up the default hypervisor and it's hvparams |
|
284 |
getDefaultHypervisorSpec :: ConfigData -> (Hypervisor, HvParams) |
|
285 |
getDefaultHypervisorSpec cfg = (hv, getHvParamsFromCluster cfg hv) |
|
286 |
where hv = getDefaultHypervisor cfg |
|
287 |
|
|
288 |
-- | Looks up the cluster's hvparams of the given hypervisor |
|
289 |
getHvParamsFromCluster :: ConfigData -> Hypervisor -> HvParams |
|
290 |
getHvParamsFromCluster cfg hv = |
|
291 |
fromMaybe (GenericContainer (Map.fromList [])) |
|
292 |
(Map.lookup (hypervisorToRaw hv) |
|
293 |
(fromContainer (clusterHvparams (configCluster cfg)))) |
Also available in: Unified diff