1 {-| HsConstants contains the Haskell constants
3 This is a transitional module complementary to 'Ganeti.Constants'. It
4 is intended to contain the Haskell constants that are meant to be
7 Do not write any definitions in this file other than constants. Do
8 not even write helper functions. The definitions in this module are
9 automatically stripped to build the Makefile.am target
10 'ListConstants.hs'. If there are helper functions in this module,
11 they will also be dragged and it will cause compilation to fail.
12 Therefore, all helper functions should go to a separate module and
19 Copyright (C) 2013 Google Inc.
21 This program is free software; you can redistribute it and/or modify
22 it under the terms of the GNU General Public License as published by
23 the Free Software Foundation; either version 2 of the License, or
24 (at your option) any later version.
26 This program is distributed in the hope that it will be useful, but
27 WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 General Public License for more details.
31 You should have received a copy of the GNU General Public License
32 along with this program; if not, write to the Free Software
33 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
37 module Ganeti.HsConstants where
40 import qualified Data.Map as Map (fromList)
43 import Ganeti.ConstantUtils (FrozenSet, Protocol(..))
44 import qualified Ganeti.ConstantUtils as ConstantUtils (mkSet, exitFailure)
45 import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
47 import qualified Ganeti.Runtime as Runtime
54 adminstOffline :: String
55 adminstOffline = "offline"
60 adminstAll :: FrozenSet String
61 adminstAll = mkSet [adminstDown, adminstOffline, adminstUp]
65 daemonsGroup :: String
66 daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
69 adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
72 masterdUser = Runtime.daemonUser GanetiMasterd
74 masterdGroup :: String
75 masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
78 rapiUser = Runtime.daemonUser GanetiRapi
81 rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
84 confdUser = Runtime.daemonUser GanetiConfd
87 confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
90 luxidUser = Runtime.daemonUser GanetiLuxid
93 luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
96 nodedUser = Runtime.daemonUser GanetiNoded
99 nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
102 mondUser = Runtime.daemonUser GanetiMond
105 mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
107 sshLoginUser :: String
108 sshLoginUser = AutoConf.sshLoginUser
110 sshConsoleUser :: String
111 sshConsoleUser = AutoConf.sshConsoleUser
124 confd = Runtime.daemonName GanetiConfd
127 masterd = Runtime.daemonName GanetiMasterd
130 mond = Runtime.daemonName GanetiMond
133 noded = Runtime.daemonName GanetiNoded
136 luxid = Runtime.daemonName GanetiLuxid
139 rapi = Runtime.daemonName GanetiRapi
141 daemons :: FrozenSet String
150 defaultConfdPort :: Int
151 defaultConfdPort = 1814
153 defaultMondPort :: Int
154 defaultMondPort = 1815
156 defaultNodedPort :: Int
157 defaultNodedPort = 1811
159 defaultRapiPort :: Int
160 defaultRapiPort = 5080
162 daemonsPorts :: Map String (Protocol, Int)
164 Map.fromList [(confd, (Udp, defaultConfdPort)),
165 (mond, (Tcp, defaultMondPort)),
166 (noded, (Tcp, defaultNodedPort)),
167 (rapi, (Tcp, defaultRapiPort)),
170 extraLogreasonAccess :: String
171 extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
173 extraLogreasonError :: String
174 extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
176 -- * Possible values for NodeGroup.alloc_policy
178 allocPolicyLastResort :: String
179 allocPolicyLastResort = "last_resort"
181 allocPolicyPreferred :: String
182 allocPolicyPreferred = "preferred"
184 allocPolicyUnallocable :: String
185 allocPolicyUnallocable = "unallocable"
187 validAllocPolicies :: [String]
189 [allocPolicyLastResort,
190 allocPolicyPreferred,
191 allocPolicyUnallocable]
193 -- | Temporary external/shared storage parameters
194 blockdevDriverManual :: String
195 blockdevDriverManual = "manual"
197 -- * Auto-repair tag prefixes
199 autoRepairTagPrefix :: String
200 autoRepairTagPrefix = "ganeti:watcher:autorepair:"
202 autoRepairTagEnabled :: String
203 autoRepairTagEnabled = autoRepairTagPrefix
205 autoRepairTagPending :: String
206 autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
208 autoRepairTagResult :: String
209 autoRepairTagResult = autoRepairTagPrefix ++ "result:"
211 autoRepairTagSuspended :: String
212 autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
214 -- * Auto-repair levels
216 autoRepairFailover :: String
217 autoRepairFailover = "failover"
219 autoRepairFixStorage :: String
220 autoRepairFixStorage = "fix-storage"
222 autoRepairMigrate :: String
223 autoRepairMigrate = "migrate"
225 autoRepairReinstall :: String
226 autoRepairReinstall = "reinstall"
228 autoRepairAllTypes :: FrozenSet String
230 mkSet [autoRepairFailover,
231 autoRepairFixStorage,
235 -- * Auto-repair results
237 autoRepairEnoperm :: String
238 autoRepairEnoperm = "enoperm"
240 autoRepairFailure :: String
241 autoRepairFailure = "failure"
243 autoRepairSuccess :: String
244 autoRepairSuccess = "success"
246 autoRepairAllResults :: FrozenSet String
247 autoRepairAllResults =
248 mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
250 -- | The version identifier for builtin data collectors
251 builtinDataCollectorVersion :: String
252 builtinDataCollectorVersion = "B"