Skip to content
Snippets Groups Projects
Commit 90d033ef authored by Iustin Pop's avatar Iustin Pop
Browse files

Add function for getting a group's merged disk params


… and use it in the Query implementation, removing the last
non-correct query field for Groups.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 1fc3812c
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,7 @@ module Ganeti.Config
, getGroup
, getGroupNdParams
, getGroupIpolicy
, getGroupDiskParams
, getGroupNodes
, getGroupInstances
, getGroupOfNode
......@@ -187,6 +188,13 @@ getGroupIpolicy :: ConfigData -> NodeGroup -> FilledIPolicy
getGroupIpolicy cfg ng =
fillIPolicy (clusterIpolicy $ configCluster cfg) (groupIpolicy ng)
-- | Computes a group\'s (merged) disk params.
getGroupDiskParams :: ConfigData -> NodeGroup -> DiskParams
getGroupDiskParams cfg ng =
Container $
fillDict (fromContainer . clusterDiskparams $ configCluster cfg)
(fromContainer $ groupDiskparams ng) []
-- | Get nodes of a given node group.
getGroupNodes :: ConfigData -> String -> [Node]
getGroupNodes cfg gname =
......
......@@ -54,7 +54,8 @@ groupFields =
"Custom node parameters",
FieldSimple (rsNormal . groupNdparams))
, (FieldDefinition "diskparams" "DiskParameters" QFTOther
"Disk parameters (merged)", FieldSimple (\_ -> rsNoData))
"Disk parameters (merged)",
FieldConfig (\cfg -> rsNormal . getGroupDiskParams cfg))
, (FieldDefinition "ipolicy" "InstancePolicy" QFTOther
"Instance policy limitations (merged)",
FieldConfig (\cfg ng -> rsNormal (getGroupIpolicy cfg ng)))
......
......@@ -175,9 +175,6 @@ queryInner cfg live (Query QRNode fields qfilter) wanted = runResultT $ do
return QueryResult { qresFields = fdefs, qresData = fdata }
queryInner cfg _ (Query QRGroup fields qfilter) wanted = return $ do
-- FIXME: want_diskparams is defaulted to false and not taken as parameter
-- This is because the type for DiskParams is right now too generic for merges
-- (or else I cannot see how to do this with curent implementation)
cfilter <- compileFilter groupFieldsMap qfilter
let selected = getSelectedFields groupFieldsMap fields
(fdefs, fgetters) = unzip selected
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment