Fix confd issue regarding --no-lvm-storage
authorDimitris Aragiorgis <dimara@grnet.gr>
Thu, 28 Feb 2013 01:29:33 +0000 (03:29 +0200)
committerIustin Pop <iustin@google.com>
Mon, 4 Mar 2013 10:35:43 +0000 (11:35 +0100)
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
src/Ganeti/Query/Node.hs
src/Ganeti/Query/Server.hs

index 51d166a..760b1b4 100644 (file)
@@ -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           |]
index aa4f0ed..b187a6f 100644 (file)
@@ -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
index 07fbce0..9176a1a 100644 (file)
@@ -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)