Revision 319322a7 htools/Ganeti/Rpc.hs

b/htools/Ganeti/Rpc.hs
70 70
  ) where
71 71

  
72 72
import Control.Arrow (second)
73
import qualified Data.Map as Map
74
import Data.Maybe (fromMaybe)
73 75
import qualified Text.JSON as J
74 76
import Text.JSON.Pretty (pp_value)
75 77

  
......
343 345
$(buildObject "RpcCallNodeInfo" "rpcCallNodeInfo"
344 346
  [ simpleField "volume_groups" [t| [String] |]
345 347
  , simpleField "hypervisors" [t| [Hypervisor] |]
348
  , simpleField "exclusive_storage" [t| Map.Map String Bool |]
346 349
  ])
347 350

  
348 351
$(buildObject "VgInfo" "vgInfo"
......
371 374
  rpcCallName _          = "node_info"
372 375
  rpcCallTimeout _       = rpcTimeoutToRaw Urgent
373 376
  rpcCallAcceptOffline _ = False
374
  rpcCallData _ call     = J.encode
377
  rpcCallData n call     = J.encode
375 378
    ( rpcCallNodeInfoVolumeGroups call
376 379
    , rpcCallNodeInfoHypervisors call
377
    , False
380
    , fromMaybe (error $ "Programmer error: missing parameter for node named "
381
                         ++ nodeName n)
382
                $ Map.lookup (nodeName n) (rpcCallNodeInfoExclusiveStorage call)
378 383
    )
379 384

  
380 385
instance Rpc RpcCallNodeInfo RpcResultNodeInfo where

Also available in: Unified diff