Revision 84835174 htools/Ganeti/Config.hs
b/htools/Ganeti/Config.hs | ||
---|---|---|
92 | 92 |
-- | Get instances of a given node. |
93 | 93 |
getNodeInstances :: ConfigData -> String -> ([Instance], [Instance]) |
94 | 94 |
getNodeInstances cfg nname = |
95 |
let all_inst = M.elems . configInstances $ cfg |
|
95 |
let all_inst = M.elems . fromContainer . configInstances $ cfg
|
|
96 | 96 |
pri_inst = filter ((== nname) . instPrimaryNode) all_inst |
97 | 97 |
sec_inst = filter ((nname `S.member`) . instSecondaryNodes) all_inst |
98 | 98 |
in (pri_inst, sec_inst) |
... | ... | |
100 | 100 |
-- | Returns the default cluster link. |
101 | 101 |
getDefaultNicLink :: ConfigData -> String |
102 | 102 |
getDefaultNicLink = |
103 |
nicpLink . (M.! C.ppDefault) . clusterNicparams . configCluster |
|
103 |
nicpLink . (M.! C.ppDefault) . fromContainer . |
|
104 |
clusterNicparams . configCluster |
|
104 | 105 |
|
105 | 106 |
-- | Returns instances of a given link. |
106 | 107 |
getInstancesIpByLink :: LinkIpMap -> String -> [String] |
... | ... | |
123 | 124 |
|
124 | 125 |
-- | Looks up a node. |
125 | 126 |
getNode :: ConfigData -> String -> Result Node |
126 |
getNode cfg name = getItem "Node" name (configNodes cfg) |
|
127 |
getNode cfg name = getItem "Node" name (fromContainer $ configNodes cfg)
|
|
127 | 128 |
|
128 | 129 |
-- | Looks up an instance. |
129 | 130 |
getInstance :: ConfigData -> String -> Result Instance |
130 |
getInstance cfg name = getItem "Instance" name (configInstances cfg) |
|
131 |
getInstance cfg name = |
|
132 |
getItem "Instance" name (fromContainer $ configInstances cfg) |
|
131 | 133 |
|
132 | 134 |
-- | Looks up an instance's primary node. |
133 | 135 |
getInstPrimaryNode :: ConfigData -> String -> Result Node |
... | ... | |
183 | 185 |
buildLinkIpInstnameMap :: ConfigData -> LinkIpMap |
184 | 186 |
buildLinkIpInstnameMap cfg = |
185 | 187 |
let cluster = configCluster cfg |
186 |
instances = M.elems . configInstances $ cfg |
|
187 |
defparams = (M.!) (clusterNicparams cluster) C.ppDefault |
|
188 |
instances = M.elems . fromContainer . configInstances $ cfg
|
|
189 |
defparams = (M.!) (fromContainer $ clusterNicparams cluster) C.ppDefault
|
|
188 | 190 |
nics = concatMap (\i -> [(instName i, nic) | nic <- instNics i]) |
189 | 191 |
instances |
190 | 192 |
in foldl' (\accum (iname, nic) -> |
Also available in: Unified diff