From 64b0309a4d5a9cd830fd8b1723f0811a11e5754d Mon Sep 17 00:00:00 2001 From: Dimitris Aragiorgis <dimara@grnet.gr> Date: Thu, 28 Feb 2013 03:29:33 +0200 Subject: [PATCH] Fix confd issue regarding --no-lvm-storage If cluster is initialized with --no-lvm-storage then volume_group_name does not exist in config.data. Thus we must define it as optional in confd. Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr> [iustin@google.com: fixed Haskell RPC definition] Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- src/Ganeti/Objects.hs | 3 ++- src/Ganeti/Query/Node.hs | 3 ++- src/Ganeti/Query/Server.hs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Ganeti/Objects.hs b/src/Ganeti/Objects.hs index 51d166a91..760b1b416 100644 --- a/src/Ganeti/Objects.hs +++ b/src/Ganeti/Objects.hs @@ -574,7 +574,8 @@ $(buildObject "Cluster" "cluster" $ , simpleField "highest_used_port" [t| Int |] , simpleField "tcpudp_port_pool" [t| [Int] |] , simpleField "mac_prefix" [t| String |] - , simpleField "volume_group_name" [t| String |] + , optionalField $ + simpleField "volume_group_name" [t| String |] , simpleField "reserved_lvs" [t| [String] |] , optionalField $ simpleField "drbd_usermode_helper" [t| String |] diff --git a/src/Ganeti/Query/Node.hs b/src/Ganeti/Query/Node.hs index aa4f0edd3..b187a6f96 100644 --- a/src/Ganeti/Query/Node.hs +++ b/src/Ganeti/Query/Node.hs @@ -31,6 +31,7 @@ module Ganeti.Query.Node import Control.Applicative import Data.List +import Data.Maybe import qualified Data.Map as Map import qualified Text.JSON as J @@ -221,7 +222,7 @@ 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] + let vgs = maybeToList . clusterVolumeGroupName $ configCluster cfg hvs = [getDefaultHypervisor cfg] step n (bn, gn, em) = let ndp' = getNodeNdParams cfg n diff --git a/src/Ganeti/Query/Server.hs b/src/Ganeti/Query/Server.hs index 07fbce0fd..9176a1a1f 100644 --- a/src/Ganeti/Query/Server.hs +++ b/src/Ganeti/Query/Server.hs @@ -116,7 +116,8 @@ handleCall cdata QueryClusterInfo = , ("master_netmask", showJSON $ clusterMasterNetmask cluster) , ("use_external_mip_script", showJSON $ clusterUseExternalMipScript cluster) - , ("volume_group_name", showJSON $ clusterVolumeGroupName cluster) + , ("volume_group_name", + maybe JSNull showJSON (clusterVolumeGroupName cluster)) , ("drbd_usermode_helper", maybe JSNull showJSON (clusterDrbdUsermodeHelper cluster)) , ("file_storage_dir", showJSON $ clusterFileStorageDir cluster) -- GitLab