root / src / Ganeti / HsConstants.hs @ 6dc0cb59
History | View | Annotate | Download (5.3 kB)
1 |
{-| HsConstants contains the Haskell constants |
---|---|
2 |
|
3 |
This is a transitional module complementary to 'Ganeti.Constants'. It |
4 |
is intended to contain the Haskell constants that are meant to be |
5 |
generated in Python. |
6 |
|
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 |
13 |
imported. |
14 |
|
15 |
-} |
16 |
|
17 |
{- |
18 |
|
19 |
Copyright (C) 2013 Google Inc. |
20 |
|
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. |
25 |
|
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. |
30 |
|
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 |
34 |
02110-1301, USA. |
35 |
|
36 |
-} |
37 |
module Ganeti.HsConstants where |
38 |
|
39 |
import Data.Map (Map) |
40 |
import qualified Data.Map as Map (fromList) |
41 |
|
42 |
import AutoConf |
43 |
import Ganeti.ConstantUtils |
44 |
|
45 |
-- * Admin states |
46 |
|
47 |
adminstDown :: String |
48 |
adminstDown = "down" |
49 |
|
50 |
adminstOffline :: String |
51 |
adminstOffline = "offline" |
52 |
|
53 |
adminstUp :: String |
54 |
adminstUp = "up" |
55 |
|
56 |
adminstAll :: FrozenSet String |
57 |
adminstAll = mkSet [adminstDown, adminstOffline, adminstUp] |
58 |
|
59 |
-- * User separation |
60 |
|
61 |
daemonsGroup :: String |
62 |
daemonsGroup = AutoConf.daemonsGroup |
63 |
|
64 |
adminGroup :: String |
65 |
adminGroup = AutoConf.adminGroup |
66 |
|
67 |
masterdUser :: String |
68 |
masterdUser = AutoConf.masterdUser |
69 |
|
70 |
masterdGroup :: String |
71 |
masterdGroup = AutoConf.masterdGroup |
72 |
|
73 |
rapiUser :: String |
74 |
rapiUser = AutoConf.rapiUser |
75 |
|
76 |
rapiGroup :: String |
77 |
rapiGroup = AutoConf.rapiGroup |
78 |
|
79 |
confdUser :: String |
80 |
confdUser = AutoConf.confdUser |
81 |
|
82 |
confdGroup :: String |
83 |
confdGroup = AutoConf.confdGroup |
84 |
|
85 |
luxidUser :: String |
86 |
luxidUser = AutoConf.luxidUser |
87 |
|
88 |
luxidGroup :: String |
89 |
luxidGroup = AutoConf.luxidGroup |
90 |
|
91 |
nodedUser :: String |
92 |
nodedUser = AutoConf.nodedUser |
93 |
|
94 |
nodedGroup :: String |
95 |
nodedGroup = AutoConf.nodedGroup |
96 |
|
97 |
mondUser :: String |
98 |
mondUser = AutoConf.mondUser |
99 |
|
100 |
mondGroup :: String |
101 |
mondGroup = AutoConf.mondGroup |
102 |
|
103 |
sshLoginUser :: String |
104 |
sshLoginUser = AutoConf.sshLoginUser |
105 |
|
106 |
sshConsoleUser :: String |
107 |
sshConsoleUser = AutoConf.sshConsoleUser |
108 |
|
109 |
-- * SSH constants |
110 |
|
111 |
ssh :: String |
112 |
ssh = "ssh" |
113 |
|
114 |
scp :: String |
115 |
scp = "scp" |
116 |
|
117 |
-- * Daemons |
118 |
|
119 |
confd :: String |
120 |
confd = "ganeti-confd" |
121 |
|
122 |
masterd :: String |
123 |
masterd = "ganeti-masterd" |
124 |
|
125 |
mond :: String |
126 |
mond = "ganeti-mond" |
127 |
|
128 |
noded :: String |
129 |
noded = "ganeti-noded" |
130 |
|
131 |
luxid :: String |
132 |
luxid = "ganeti-luxid" |
133 |
|
134 |
rapi :: String |
135 |
rapi = "ganeti-rapi" |
136 |
|
137 |
daemons :: FrozenSet String |
138 |
daemons = |
139 |
mkSet [confd, |
140 |
luxid, |
141 |
masterd, |
142 |
mond, |
143 |
noded, |
144 |
rapi] |
145 |
|
146 |
defaultConfdPort :: Int |
147 |
defaultConfdPort = 1814 |
148 |
|
149 |
defaultMondPort :: Int |
150 |
defaultMondPort = 1815 |
151 |
|
152 |
defaultNodedPort :: Int |
153 |
defaultNodedPort = 1811 |
154 |
|
155 |
defaultRapiPort :: Int |
156 |
defaultRapiPort = 5080 |
157 |
|
158 |
daemonsPorts :: Map String (Protocol, Int) |
159 |
daemonsPorts = |
160 |
Map.fromList [(confd, (Udp, defaultConfdPort)), |
161 |
(mond, (Tcp, defaultMondPort)), |
162 |
(noded, (Tcp, defaultNodedPort)), |
163 |
(rapi, (Tcp, defaultRapiPort)), |
164 |
(ssh, (Tcp, 22))] |
165 |
|
166 |
-- * Possible values for NodeGroup.alloc_policy |
167 |
|
168 |
allocPolicyLastResort :: String |
169 |
allocPolicyLastResort = "last_resort" |
170 |
|
171 |
allocPolicyPreferred :: String |
172 |
allocPolicyPreferred = "preferred" |
173 |
|
174 |
allocPolicyUnallocable :: String |
175 |
allocPolicyUnallocable = "unallocable" |
176 |
|
177 |
validAllocPolicies :: [String] |
178 |
validAllocPolicies = |
179 |
[allocPolicyLastResort, |
180 |
allocPolicyPreferred, |
181 |
allocPolicyUnallocable] |
182 |
|
183 |
-- | Temporary external/shared storage parameters |
184 |
blockdevDriverManual :: String |
185 |
blockdevDriverManual = "manual" |
186 |
|
187 |
-- * Auto-repair tag prefixes |
188 |
|
189 |
autoRepairTagPrefix :: String |
190 |
autoRepairTagPrefix = "ganeti:watcher:autorepair:" |
191 |
|
192 |
autoRepairTagEnabled :: String |
193 |
autoRepairTagEnabled = autoRepairTagPrefix |
194 |
|
195 |
autoRepairTagPending :: String |
196 |
autoRepairTagPending = autoRepairTagPrefix ++ "pending:" |
197 |
|
198 |
autoRepairTagResult :: String |
199 |
autoRepairTagResult = autoRepairTagPrefix ++ "result:" |
200 |
|
201 |
autoRepairTagSuspended :: String |
202 |
autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:" |
203 |
|
204 |
-- * Auto-repair levels |
205 |
|
206 |
autoRepairFailover :: String |
207 |
autoRepairFailover = "failover" |
208 |
|
209 |
autoRepairFixStorage :: String |
210 |
autoRepairFixStorage = "fix-storage" |
211 |
|
212 |
autoRepairMigrate :: String |
213 |
autoRepairMigrate = "migrate" |
214 |
|
215 |
autoRepairReinstall :: String |
216 |
autoRepairReinstall = "reinstall" |
217 |
|
218 |
autoRepairAllTypes :: FrozenSet String |
219 |
autoRepairAllTypes = |
220 |
mkSet [autoRepairFailover, |
221 |
autoRepairFixStorage, |
222 |
autoRepairMigrate, |
223 |
autoRepairReinstall] |
224 |
|
225 |
-- * Auto-repair results |
226 |
|
227 |
autoRepairEnoperm :: String |
228 |
autoRepairEnoperm = "enoperm" |
229 |
|
230 |
autoRepairFailure :: String |
231 |
autoRepairFailure = "failure" |
232 |
|
233 |
autoRepairSuccess :: String |
234 |
autoRepairSuccess = "success" |
235 |
|
236 |
autoRepairAllResults :: FrozenSet String |
237 |
autoRepairAllResults = |
238 |
mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess] |
239 |
|
240 |
-- | The version identifier for builtin data collectors |
241 |
builtinDataCollectorVersion :: String |
242 |
builtinDataCollectorVersion = "B" |