LGTM

On Wed, Dec 12, 2012 at 11:28 AM, Iustin Pop <ius...@google.com> wrote:

> Signed-off-by: Iustin Pop <ius...@google.com>
> ---
>  htools/Ganeti/Query/Node.hs  |   14 ++++++++++++++
>  htools/Ganeti/Query/Query.hs |   15 ---------------
>  2 files changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/htools/Ganeti/Query/Node.hs b/htools/Ganeti/Query/Node.hs
> index 8809c31..d324c39 100644
> --- a/htools/Ganeti/Query/Node.hs
> +++ b/htools/Ganeti/Query/Node.hs
> @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor,
> Boston, MA
>  module Ganeti.Query.Node
>    ( NodeRuntime
>    , nodeFieldsMap
> +  , maybeCollectLiveData
>    ) where
>
>  import Control.Applicative
> @@ -210,3 +211,16 @@ nodeFields =
>  nodeFieldsMap :: FieldMap Node NodeRuntime
>  nodeFieldsMap =
>    Map.fromList $ map (\v@(f, _, _) -> (fdefName f, v)) nodeFields
> +
> +-- | Collect live data from RPC query if enabled.
> +--
> +-- FIXME: Check which fields we actually need and possibly send empty
> +-- hvs/vgs if no info from hypervisor/volume group respectively is
> +-- required
> +maybeCollectLiveData:: Bool -> ConfigData -> [Node] -> IO [(Node,
> NodeRuntime)]
> +maybeCollectLiveData False _ nodes =
> +  return $ zip nodes (repeat $ Left (RpcResultError "Live data disabled"))
> +maybeCollectLiveData True cfg nodes = do
> +  let vgs = [clusterVolumeGroupName $ configCluster cfg]
> +      hvs = [getDefaultHypervisor cfg]
> +  executeRpcCall nodes (RpcCallNodeInfo vgs hvs)
> diff --git a/htools/Ganeti/Query/Query.hs b/htools/Ganeti/Query/Query.hs
> index 026b552..eb448a3 100644
> --- a/htools/Ganeti/Query/Query.hs
> +++ b/htools/Ganeti/Query/Query.hs
> @@ -65,7 +65,6 @@ import Ganeti.Config
>  import Ganeti.Errors
>  import Ganeti.JQueue
>  import Ganeti.JSON
> -import Ganeti.Rpc
>  import Ganeti.Objects
>  import Ganeti.Query.Common
>  import Ganeti.Query.Filter
> @@ -105,20 +104,6 @@ getSelectedFields :: FieldMap a b  -- ^ Defined fields
>  getSelectedFields defined =
>    map (\name -> fromMaybe (mkUnknownFDef name) $ name `Map.lookup`
> defined)
>
> --- | Collect live data from RPC query if enabled.
> --- FIXME: Check which fields we actually need and possibly send empty
> --- hvs/vgs if no info from hypervisor/volume group respectively
> --- is required
> -maybeCollectLiveData:: Bool -> ConfigData -> [Node] -> IO [(Node,
> NodeRuntime)]
> -
> -maybeCollectLiveData False _ nodes =
> -  return $ zip nodes (repeat $ Left (RpcResultError "Live data disabled"))
> -
> -maybeCollectLiveData True cfg nodes = do
> -  let vgs = [clusterVolumeGroupName $ configCluster cfg]
> -      hvs = [getDefaultHypervisor cfg]
> -  executeRpcCall nodes (RpcCallNodeInfo vgs hvs)
> -
>  -- | Check whether list of queried fields contains live fields.
>  needsLiveData :: [FieldGetter a b] -> Bool
>  needsLiveData = any isRuntimeField
> --
> 1.7.10.4
>
>

Reply via email to