Revision 179c0828 htools/Ganeti/HTools/Luxi.hs
b/htools/Ganeti/HTools/Luxi.hs | ||
---|---|---|
88 | 88 |
queryGroupsMsg = |
89 | 89 |
L.QueryGroups [] ["uuid", "name", "alloc_policy"] False |
90 | 90 |
|
91 |
-- | Wraper over callMethod doing node query.
|
|
91 |
-- | Wraper over 'callMethod' doing node query.
|
|
92 | 92 |
queryNodes :: L.Client -> IO (Result JSValue) |
93 | 93 |
queryNodes = L.callMethod queryNodesMsg |
94 | 94 |
|
95 |
-- | Wraper over callMethod doing instance query.
|
|
95 |
-- | Wraper over 'callMethod' doing instance query.
|
|
96 | 96 |
queryInstances :: L.Client -> IO (Result JSValue) |
97 | 97 |
queryInstances = L.callMethod queryInstancesMsg |
98 | 98 |
|
99 |
-- | Wrapper over 'callMethod' doing cluster information query. |
|
99 | 100 |
queryClusterInfo :: L.Client -> IO (Result JSValue) |
100 | 101 |
queryClusterInfo = L.callMethod queryClusterInfoMsg |
101 | 102 |
|
... | ... | |
167 | 168 |
|
168 | 169 |
parseNode _ v = fail ("Invalid node query result: " ++ show v) |
169 | 170 |
|
171 |
-- | Parses the cluster tags. |
|
170 | 172 |
getClusterTags :: JSValue -> Result [String] |
171 | 173 |
getClusterTags v = do |
172 | 174 |
let errmsg = "Parsing cluster info" |
173 | 175 |
obj <- annotateResult errmsg $ asJSObject v |
174 | 176 |
tryFromObj errmsg (fromJSObject obj) "tags" |
175 | 177 |
|
178 |
-- | Parses the cluster groups. |
|
176 | 179 |
getGroups :: JSValue -> Result [(String, Group.Group)] |
177 | 180 |
getGroups arr = toArray arr >>= mapM parseGroup |
178 | 181 |
|
182 |
-- | Parses a given group information. |
|
179 | 183 |
parseGroup :: JSValue -> Result (String, Group.Group) |
180 | 184 |
parseGroup (JSArray [ uuid, name, apol ]) = do |
181 | 185 |
xname <- annotateResult "Parsing new group" (fromJVal name) |
Also available in: Unified diff