Skip to content
Snippets Groups Projects
Commit ae960018 authored by Helga Velroyen's avatar Helga Velroyen
Browse files

More fields for network queries


This adds more fields to the network queries:
- group_cnt, free_count, reserved_count, and map

Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent f601723c
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ module Ganeti.Query.Network
import qualified Data.Map as Map
import Ganeti.Config
import Ganeti.Network
import Ganeti.Objects
import Ganeti.Query.Language
import Ganeti.Query.Common
......@@ -54,9 +55,22 @@ networkFields =
FieldSimple (rsMaybeUnavail . networkMacPrefix), QffNormal)
, (FieldDefinition "network_type" "NetworkType" QFTOther "Network type",
FieldSimple (rsMaybeUnavail . networkNetworkType), QffNormal)
, (FieldDefinition "free_count" "FreeCount" QFTOther "Number of free IPs",
FieldSimple (rsMaybeNoData . fmap getFreeCount . createAddressPool),
QffNormal)
, (FieldDefinition "map" "Map" QFTText "Map of the network's reserved IPs",
FieldSimple (rsMaybeNoData . fmap getMap . createAddressPool),
QffNormal)
, (FieldDefinition "reserved_count" "ReservedCount" QFTOther
"Number of reserved IPs",
FieldSimple (rsMaybeNoData . fmap getReservedCount . createAddressPool),
QffNormal)
, (FieldDefinition "group_list" "GroupList" QFTOther "List of node groups",
FieldConfig (\cfg -> rsNormal . getGroupConnections cfg . networkUuid),
QffNormal)
QffNormal)
, (FieldDefinition "group_cnt" "GroupCount" QFTOther "Number of node groups",
FieldConfig (\cfg -> rsNormal . length . getGroupConnections cfg
. networkUuid), QffNormal)
] ++
uuidFields "Network" ++
serialFields "Network" ++
......@@ -68,5 +82,4 @@ networkFieldsMap =
Map.fromList $ map (\v@(f, _, _) -> (fdefName f, v)) networkFields
-- TODO: the following fields are not implemented yet: external_reservations,
-- free_count, group_cnt, inst_cnt, inst_list, map, reserved_count, serial_no,
-- tags, uuid
-- inst_cnt, inst_list
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