1 |
|
{-| Ganeti constants.
|
|
1 |
{-# OPTIONS -fno-warn-type-defaults #-}
|
|
2 |
{-| Constants contains the Haskell constants
|
2 |
3 |
|
3 |
|
This module reexports the Haskell constants and those generated from
|
4 |
|
Python.
|
|
4 |
The constants in this module are used in Haskell and are also
|
|
5 |
converted to 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.
|
5 |
14 |
|
6 |
15 |
-}
|
7 |
16 |
|
... | ... | |
25 |
34 |
02110-1301, USA.
|
26 |
35 |
|
27 |
36 |
-}
|
|
37 |
module Ganeti.Constants where
|
|
38 |
|
|
39 |
import Control.Arrow ((***))
|
|
40 |
import Data.List ((\\))
|
|
41 |
import Data.Map (Map)
|
|
42 |
import qualified Data.Map as Map (empty, fromList, keys, insert)
|
|
43 |
|
|
44 |
import qualified AutoConf
|
|
45 |
import Ganeti.ConstantUtils (PythonChar(..), PythonNone(..), FrozenSet,
|
|
46 |
Protocol(..), buildVersion)
|
|
47 |
import qualified Ganeti.ConstantUtils as ConstantUtils
|
|
48 |
import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
|
|
49 |
import qualified Ganeti.HTools.Types as Types
|
|
50 |
import Ganeti.Logging (SyslogUsage(..))
|
|
51 |
import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
|
|
52 |
import qualified Ganeti.Runtime as Runtime
|
|
53 |
import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
|
|
54 |
ExtraLogReason(..))
|
|
55 |
import Ganeti.THH (PyValueEx(..))
|
|
56 |
import Ganeti.Types
|
|
57 |
import qualified Ganeti.Types as Types
|
|
58 |
import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..),
|
|
59 |
ConfdReplyStatus(..), ConfdNodeRole(..),
|
|
60 |
ConfdErrorType(..))
|
|
61 |
import qualified Ganeti.Confd.Types as Types
|
|
62 |
|
|
63 |
{-# ANN module "HLint: ignore Use camelCase" #-}
|
|
64 |
|
|
65 |
-- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
|
|
66 |
|
|
67 |
htoolsProgs :: [String]
|
|
68 |
htoolsProgs = AutoConf.htoolsProgs
|
|
69 |
|
|
70 |
-- * 'autoconf' constants for Python only ('lib/constants.py')
|
|
71 |
|
|
72 |
drbdBarriers :: String
|
|
73 |
drbdBarriers = AutoConf.drbdBarriers
|
|
74 |
|
|
75 |
drbdNoMetaFlush :: Bool
|
|
76 |
drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
|
|
77 |
|
|
78 |
lvmStripecount :: Int
|
|
79 |
lvmStripecount = AutoConf.lvmStripecount
|
|
80 |
|
|
81 |
hasGnuLn :: Bool
|
|
82 |
hasGnuLn = AutoConf.hasGnuLn
|
|
83 |
|
|
84 |
-- * 'autoconf' constants for Python only ('lib/pathutils.py')
|
|
85 |
|
|
86 |
-- ** Build-time constants
|
|
87 |
|
|
88 |
exportDir :: String
|
|
89 |
exportDir = AutoConf.exportDir
|
|
90 |
|
|
91 |
osSearchPath :: [String]
|
|
92 |
osSearchPath = AutoConf.osSearchPath
|
|
93 |
|
|
94 |
esSearchPath :: [String]
|
|
95 |
esSearchPath = AutoConf.esSearchPath
|
|
96 |
|
|
97 |
sshConfigDir :: String
|
|
98 |
sshConfigDir = AutoConf.sshConfigDir
|
|
99 |
|
|
100 |
xenConfigDir :: String
|
|
101 |
xenConfigDir = AutoConf.xenConfigDir
|
|
102 |
|
|
103 |
sysconfdir :: String
|
|
104 |
sysconfdir = AutoConf.sysconfdir
|
|
105 |
|
|
106 |
toolsdir :: String
|
|
107 |
toolsdir = AutoConf.toolsdir
|
|
108 |
|
|
109 |
localstatedir :: String
|
|
110 |
localstatedir = AutoConf.localstatedir
|
|
111 |
|
|
112 |
-- ** Paths which don't change for a virtual cluster
|
|
113 |
|
|
114 |
pkglibdir :: String
|
|
115 |
pkglibdir = AutoConf.pkglibdir
|
|
116 |
|
|
117 |
sharedir :: String
|
|
118 |
sharedir = AutoConf.sharedir
|
|
119 |
|
|
120 |
-- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
|
|
121 |
|
|
122 |
manPages :: Map String Int
|
|
123 |
manPages = Map.fromList AutoConf.manPages
|
|
124 |
|
|
125 |
-- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
|
|
126 |
|
|
127 |
versionedsharedir :: String
|
|
128 |
versionedsharedir = AutoConf.versionedsharedir
|
|
129 |
|
|
130 |
-- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
|
|
131 |
|
|
132 |
gntScripts :: [String]
|
|
133 |
gntScripts = AutoConf.gntScripts
|
|
134 |
|
|
135 |
-- * Various versions
|
|
136 |
|
|
137 |
releaseVersion :: String
|
|
138 |
releaseVersion = AutoConf.packageVersion
|
|
139 |
|
|
140 |
versionMajor :: Int
|
|
141 |
versionMajor = AutoConf.versionMajor
|
|
142 |
|
|
143 |
versionMinor :: Int
|
|
144 |
versionMinor = AutoConf.versionMinor
|
|
145 |
|
|
146 |
versionRevision :: Int
|
|
147 |
versionRevision = AutoConf.versionRevision
|
|
148 |
|
|
149 |
dirVersion :: String
|
|
150 |
dirVersion = AutoConf.dirVersion
|
|
151 |
|
|
152 |
osApiV10 :: Int
|
|
153 |
osApiV10 = 10
|
|
154 |
|
|
155 |
osApiV15 :: Int
|
|
156 |
osApiV15 = 15
|
|
157 |
|
|
158 |
osApiV20 :: Int
|
|
159 |
osApiV20 = 20
|
|
160 |
|
|
161 |
osApiVersions :: FrozenSet Int
|
|
162 |
osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20]
|
|
163 |
|
|
164 |
exportVersion :: Int
|
|
165 |
exportVersion = 0
|
|
166 |
|
|
167 |
rapiVersion :: Int
|
|
168 |
rapiVersion = 2
|
|
169 |
|
|
170 |
configMajor :: Int
|
|
171 |
configMajor = AutoConf.versionMajor
|
|
172 |
|
|
173 |
configMinor :: Int
|
|
174 |
configMinor = AutoConf.versionMinor
|
|
175 |
|
|
176 |
-- | The configuration is supposed to remain stable across
|
|
177 |
-- revisions. Therefore, the revision number is cleared to '0'.
|
|
178 |
configRevision :: Int
|
|
179 |
configRevision = 0
|
|
180 |
|
|
181 |
configVersion :: Int
|
|
182 |
configVersion = buildVersion configMajor configMinor configRevision
|
|
183 |
|
|
184 |
-- | Similarly to the configuration (see 'configRevision'), the
|
|
185 |
-- protocols are supposed to remain stable across revisions.
|
|
186 |
protocolVersion :: Int
|
|
187 |
protocolVersion = buildVersion configMajor configMinor configRevision
|
|
188 |
|
|
189 |
-- * User separation
|
|
190 |
|
|
191 |
daemonsGroup :: String
|
|
192 |
daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
|
|
193 |
|
|
194 |
adminGroup :: String
|
|
195 |
adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
|
|
196 |
|
|
197 |
masterdUser :: String
|
|
198 |
masterdUser = Runtime.daemonUser GanetiMasterd
|
|
199 |
|
|
200 |
masterdGroup :: String
|
|
201 |
masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
|
|
202 |
|
|
203 |
rapiUser :: String
|
|
204 |
rapiUser = Runtime.daemonUser GanetiRapi
|
|
205 |
|
|
206 |
rapiGroup :: String
|
|
207 |
rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
|
|
208 |
|
|
209 |
confdUser :: String
|
|
210 |
confdUser = Runtime.daemonUser GanetiConfd
|
|
211 |
|
|
212 |
confdGroup :: String
|
|
213 |
confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
|
|
214 |
|
|
215 |
luxidUser :: String
|
|
216 |
luxidUser = Runtime.daemonUser GanetiLuxid
|
|
217 |
|
|
218 |
luxidGroup :: String
|
|
219 |
luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
|
|
220 |
|
|
221 |
nodedUser :: String
|
|
222 |
nodedUser = Runtime.daemonUser GanetiNoded
|
|
223 |
|
|
224 |
nodedGroup :: String
|
|
225 |
nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
|
|
226 |
|
|
227 |
mondUser :: String
|
|
228 |
mondUser = Runtime.daemonUser GanetiMond
|
|
229 |
|
|
230 |
mondGroup :: String
|
|
231 |
mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
|
|
232 |
|
|
233 |
sshLoginUser :: String
|
|
234 |
sshLoginUser = AutoConf.sshLoginUser
|
|
235 |
|
|
236 |
sshConsoleUser :: String
|
|
237 |
sshConsoleUser = AutoConf.sshConsoleUser
|
|
238 |
|
|
239 |
-- * Cpu pinning separators and constants
|
|
240 |
|
|
241 |
cpuPinningSep :: String
|
|
242 |
cpuPinningSep = ":"
|
|
243 |
|
|
244 |
cpuPinningAll :: String
|
|
245 |
cpuPinningAll = "all"
|
|
246 |
|
|
247 |
-- | Internal representation of "all"
|
|
248 |
cpuPinningAllVal :: Int
|
|
249 |
cpuPinningAllVal = -1
|
|
250 |
|
|
251 |
-- | One "all" entry in a CPU list means CPU pinning is off
|
|
252 |
cpuPinningOff :: [Int]
|
|
253 |
cpuPinningOff = [cpuPinningAllVal]
|
|
254 |
|
|
255 |
-- | A Xen-specific implementation detail is that there is no way to
|
|
256 |
-- actually say "use any cpu for pinning" in a Xen configuration file,
|
|
257 |
-- as opposed to the command line, where you can say
|
|
258 |
-- @
|
|
259 |
-- xm vcpu-pin <domain> <vcpu> all
|
|
260 |
-- @
|
|
261 |
--
|
|
262 |
-- The workaround used in Xen is "0-63" (see source code function
|
|
263 |
-- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@).
|
|
264 |
--
|
|
265 |
-- To support future changes, the following constant is treated as a
|
|
266 |
-- blackbox string that simply means "use any cpu for pinning under
|
|
267 |
-- xen".
|
|
268 |
cpuPinningAllXen :: String
|
|
269 |
cpuPinningAllXen = "0-63"
|
|
270 |
|
|
271 |
-- | A KVM-specific implementation detail - the following value is
|
|
272 |
-- used to set CPU affinity to all processors (--0 through --31), per
|
|
273 |
-- taskset man page.
|
|
274 |
--
|
|
275 |
-- FIXME: This only works for machines with up to 32 CPU cores
|
|
276 |
cpuPinningAllKvm :: Int
|
|
277 |
cpuPinningAllKvm = 0xFFFFFFFF
|
|
278 |
|
|
279 |
-- * Wipe
|
|
280 |
|
|
281 |
ddCmd :: String
|
|
282 |
ddCmd = "dd"
|
|
283 |
|
|
284 |
-- | 1GB
|
|
285 |
maxWipeChunk :: Int
|
|
286 |
maxWipeChunk = 1024
|
|
287 |
|
|
288 |
minWipeChunkPercent :: Int
|
|
289 |
minWipeChunkPercent = 10
|
|
290 |
|
|
291 |
-- * Directories
|
|
292 |
|
|
293 |
runDirsMode :: Int
|
|
294 |
runDirsMode = 0o775
|
|
295 |
|
|
296 |
secureDirMode :: Int
|
|
297 |
secureDirMode = 0o700
|
|
298 |
|
|
299 |
secureFileMode :: Int
|
|
300 |
secureFileMode = 0o600
|
|
301 |
|
|
302 |
adoptableBlockdevRoot :: String
|
|
303 |
adoptableBlockdevRoot = "/dev/disk/"
|
|
304 |
|
|
305 |
-- * 'autoconf' enable/disable
|
|
306 |
|
|
307 |
enableConfd :: Bool
|
|
308 |
enableConfd = AutoConf.enableConfd
|
|
309 |
|
|
310 |
enableMond :: Bool
|
|
311 |
enableMond = AutoConf.enableMond
|
|
312 |
|
|
313 |
enableRestrictedCommands :: Bool
|
|
314 |
enableRestrictedCommands = AutoConf.enableRestrictedCommands
|
|
315 |
|
|
316 |
enableSplitQuery :: Bool
|
|
317 |
enableSplitQuery = AutoConf.enableSplitQuery
|
|
318 |
|
|
319 |
-- * SSH constants
|
|
320 |
|
|
321 |
ssh :: String
|
|
322 |
ssh = "ssh"
|
|
323 |
|
|
324 |
scp :: String
|
|
325 |
scp = "scp"
|
|
326 |
|
|
327 |
-- * Daemons
|
|
328 |
|
|
329 |
confd :: String
|
|
330 |
confd = Runtime.daemonName GanetiConfd
|
|
331 |
|
|
332 |
masterd :: String
|
|
333 |
masterd = Runtime.daemonName GanetiMasterd
|
|
334 |
|
|
335 |
mond :: String
|
|
336 |
mond = Runtime.daemonName GanetiMond
|
|
337 |
|
|
338 |
noded :: String
|
|
339 |
noded = Runtime.daemonName GanetiNoded
|
|
340 |
|
|
341 |
luxid :: String
|
|
342 |
luxid = Runtime.daemonName GanetiLuxid
|
|
343 |
|
|
344 |
rapi :: String
|
|
345 |
rapi = Runtime.daemonName GanetiRapi
|
|
346 |
|
|
347 |
daemons :: FrozenSet String
|
|
348 |
daemons =
|
|
349 |
ConstantUtils.mkSet [confd,
|
|
350 |
luxid,
|
|
351 |
masterd,
|
|
352 |
mond,
|
|
353 |
noded,
|
|
354 |
rapi]
|
|
355 |
|
|
356 |
defaultConfdPort :: Int
|
|
357 |
defaultConfdPort = 1814
|
|
358 |
|
|
359 |
defaultMondPort :: Int
|
|
360 |
defaultMondPort = 1815
|
|
361 |
|
|
362 |
defaultNodedPort :: Int
|
|
363 |
defaultNodedPort = 1811
|
|
364 |
|
|
365 |
defaultRapiPort :: Int
|
|
366 |
defaultRapiPort = 5080
|
|
367 |
|
|
368 |
daemonsPorts :: Map String (Protocol, Int)
|
|
369 |
daemonsPorts =
|
|
370 |
Map.fromList [(confd, (Udp, defaultConfdPort)),
|
|
371 |
(mond, (Tcp, defaultMondPort)),
|
|
372 |
(noded, (Tcp, defaultNodedPort)),
|
|
373 |
(rapi, (Tcp, defaultRapiPort)),
|
|
374 |
(ssh, (Tcp, 22))]
|
|
375 |
|
|
376 |
firstDrbdPort :: Int
|
|
377 |
firstDrbdPort = 11000
|
|
378 |
|
|
379 |
lastDrbdPort :: Int
|
|
380 |
lastDrbdPort = 14999
|
|
381 |
|
|
382 |
daemonsLogbase :: Map String String
|
|
383 |
daemonsLogbase =
|
|
384 |
Map.fromList
|
|
385 |
[ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
|
|
386 |
|
|
387 |
daemonsExtraLogbase :: Map String (Map String String)
|
|
388 |
daemonsExtraLogbase =
|
|
389 |
Map.fromList $
|
|
390 |
map (Runtime.daemonName *** id)
|
|
391 |
[ (GanetiMond, Map.fromList
|
|
392 |
[ ("access", Runtime.daemonsExtraLogbase GanetiMond AccessLog)
|
|
393 |
, ("error", Runtime.daemonsExtraLogbase GanetiMond ErrorLog)
|
|
394 |
])
|
|
395 |
]
|
|
396 |
|
|
397 |
extraLogreasonAccess :: String
|
|
398 |
extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
|
|
399 |
|
|
400 |
extraLogreasonError :: String
|
|
401 |
extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
|
|
402 |
|
|
403 |
devConsole :: String
|
|
404 |
devConsole = ConstantUtils.devConsole
|
|
405 |
|
|
406 |
procMounts :: String
|
|
407 |
procMounts = "/proc/mounts"
|
|
408 |
|
|
409 |
-- * Luxi (Local UniX Interface) related constants
|
|
410 |
|
|
411 |
luxiEom :: PythonChar
|
|
412 |
luxiEom = PythonChar '\x03'
|
|
413 |
|
|
414 |
-- | Environment variable for the luxi override socket
|
|
415 |
luxiOverride :: String
|
|
416 |
luxiOverride = "FORCE_LUXI_SOCKET"
|
|
417 |
|
|
418 |
luxiOverrideMaster :: String
|
|
419 |
luxiOverrideMaster = "master"
|
|
420 |
|
|
421 |
luxiOverrideQuery :: String
|
|
422 |
luxiOverrideQuery = "query"
|
|
423 |
|
|
424 |
luxiVersion :: Int
|
|
425 |
luxiVersion = configVersion
|
|
426 |
|
|
427 |
-- * Syslog
|
|
428 |
|
|
429 |
syslogUsage :: String
|
|
430 |
syslogUsage = AutoConf.syslogUsage
|
|
431 |
|
|
432 |
syslogNo :: String
|
|
433 |
syslogNo = Logging.syslogUsageToRaw SyslogNo
|
|
434 |
|
|
435 |
syslogYes :: String
|
|
436 |
syslogYes = Logging.syslogUsageToRaw SyslogYes
|
|
437 |
|
|
438 |
syslogOnly :: String
|
|
439 |
syslogOnly = Logging.syslogUsageToRaw SyslogOnly
|
|
440 |
|
|
441 |
syslogSocket :: String
|
|
442 |
syslogSocket = "/dev/log"
|
|
443 |
|
|
444 |
exportConfFile :: String
|
|
445 |
exportConfFile = "config.ini"
|
|
446 |
|
|
447 |
-- * Xen
|
|
448 |
|
|
449 |
xenBootloader :: String
|
|
450 |
xenBootloader = AutoConf.xenBootloader
|
|
451 |
|
|
452 |
xenCmdXl :: String
|
|
453 |
xenCmdXl = "xl"
|
|
454 |
|
|
455 |
xenCmdXm :: String
|
|
456 |
xenCmdXm = "xm"
|
|
457 |
|
|
458 |
xenInitrd :: String
|
|
459 |
xenInitrd = AutoConf.xenInitrd
|
|
460 |
|
|
461 |
xenKernel :: String
|
|
462 |
xenKernel = AutoConf.xenKernel
|
|
463 |
|
|
464 |
-- FIXME: perhaps rename to 'validXenCommands' for consistency with
|
|
465 |
-- other constants
|
|
466 |
knownXenCommands :: FrozenSet String
|
|
467 |
knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
|
|
468 |
|
|
469 |
-- * KVM and socat
|
|
470 |
|
|
471 |
kvmPath :: String
|
|
472 |
kvmPath = AutoConf.kvmPath
|
|
473 |
|
|
474 |
kvmKernel :: String
|
|
475 |
kvmKernel = AutoConf.kvmKernel
|
|
476 |
|
|
477 |
socatEscapeCode :: String
|
|
478 |
socatEscapeCode = "0x1d"
|
|
479 |
|
|
480 |
socatPath :: String
|
|
481 |
socatPath = AutoConf.socatPath
|
|
482 |
|
|
483 |
socatUseCompress :: Bool
|
|
484 |
socatUseCompress = AutoConf.socatUseCompress
|
|
485 |
|
|
486 |
socatUseEscape :: Bool
|
|
487 |
socatUseEscape = AutoConf.socatUseEscape
|
|
488 |
|
|
489 |
-- * Console types
|
|
490 |
|
|
491 |
-- | Display a message for console access
|
|
492 |
consMessage :: String
|
|
493 |
consMessage = "msg"
|
|
494 |
|
|
495 |
-- | Console as SPICE server
|
|
496 |
consSpice :: String
|
|
497 |
consSpice = "spice"
|
|
498 |
|
|
499 |
-- | Console as SSH command
|
|
500 |
consSsh :: String
|
|
501 |
consSsh = "ssh"
|
|
502 |
|
|
503 |
-- | Console as VNC server
|
|
504 |
consVnc :: String
|
|
505 |
consVnc = "vnc"
|
|
506 |
|
|
507 |
consAll :: FrozenSet String
|
|
508 |
consAll = ConstantUtils.mkSet [consMessage, consSpice, consSsh, consVnc]
|
|
509 |
|
|
510 |
-- | RSA key bit length
|
|
511 |
--
|
|
512 |
-- For RSA keys more bits are better, but they also make operations
|
|
513 |
-- more expensive. NIST SP 800-131 recommends a minimum of 2048 bits
|
|
514 |
-- from the year 2010 on.
|
|
515 |
rsaKeyBits :: Int
|
|
516 |
rsaKeyBits = 2048
|
|
517 |
|
|
518 |
-- | Ciphers allowed for SSL connections.
|
|
519 |
--
|
|
520 |
-- For the format, see ciphers(1). A better way to disable ciphers
|
|
521 |
-- would be to use the exclamation mark (!), but socat versions below
|
|
522 |
-- 1.5 can't parse exclamation marks in options properly. When
|
|
523 |
-- modifying the ciphers, ensure not to accidentially add something
|
|
524 |
-- after it's been removed. Use the "openssl" utility to check the
|
|
525 |
-- allowed ciphers, e.g. "openssl ciphers -v HIGH:-DES".
|
|
526 |
opensslCiphers :: String
|
|
527 |
opensslCiphers = "HIGH:-DES:-3DES:-EXPORT:-ADH"
|
|
528 |
|
|
529 |
-- * X509
|
|
530 |
|
|
531 |
-- | commonName (CN) used in certificates
|
|
532 |
x509CertCn :: String
|
|
533 |
x509CertCn = "ganeti.example.com"
|
|
534 |
|
|
535 |
-- | Default validity of certificates in days
|
|
536 |
x509CertDefaultValidity :: Int
|
|
537 |
x509CertDefaultValidity = 365 * 5
|
|
538 |
|
|
539 |
x509CertSignatureHeader :: String
|
|
540 |
x509CertSignatureHeader = "X-Ganeti-Signature"
|
|
541 |
|
|
542 |
-- | Digest used to sign certificates ("openssl x509" uses SHA1 by default)
|
|
543 |
x509CertSignDigest :: String
|
|
544 |
x509CertSignDigest = "SHA1"
|
|
545 |
|
|
546 |
-- * Import/export daemon mode
|
|
547 |
|
|
548 |
iemExport :: String
|
|
549 |
iemExport = "export"
|
|
550 |
|
|
551 |
iemImport :: String
|
|
552 |
iemImport = "import"
|
|
553 |
|
|
554 |
-- * Import/export transport compression
|
|
555 |
|
|
556 |
iecGzip :: String
|
|
557 |
iecGzip = "gzip"
|
|
558 |
|
|
559 |
iecNone :: String
|
|
560 |
iecNone = "none"
|
|
561 |
|
|
562 |
iecAll :: [String]
|
|
563 |
iecAll = [iecGzip, iecNone]
|
|
564 |
|
|
565 |
ieCustomSize :: String
|
|
566 |
ieCustomSize = "fd"
|
|
567 |
|
|
568 |
-- * Import/export I/O
|
|
569 |
|
|
570 |
-- | Direct file I/O, equivalent to a shell's I/O redirection using
|
|
571 |
-- '<' or '>'
|
|
572 |
ieioFile :: String
|
|
573 |
ieioFile = "file"
|
|
574 |
|
|
575 |
-- | Raw block device I/O using "dd"
|
|
576 |
ieioRawDisk :: String
|
|
577 |
ieioRawDisk = "raw"
|
|
578 |
|
|
579 |
-- | OS definition import/export script
|
|
580 |
ieioScript :: String
|
|
581 |
ieioScript = "script"
|
|
582 |
|
|
583 |
-- * Values
|
|
584 |
|
|
585 |
valueDefault :: String
|
|
586 |
valueDefault = "default"
|
|
587 |
|
|
588 |
valueAuto :: String
|
|
589 |
valueAuto = "auto"
|
|
590 |
|
|
591 |
valueGenerate :: String
|
|
592 |
valueGenerate = "generate"
|
|
593 |
|
|
594 |
valueNone :: String
|
|
595 |
valueNone = "none"
|
|
596 |
|
|
597 |
valueTrue :: String
|
|
598 |
valueTrue = "true"
|
|
599 |
|
|
600 |
valueFalse :: String
|
|
601 |
valueFalse = "false"
|
|
602 |
|
|
603 |
valueHsNothing :: Map String PythonNone
|
|
604 |
valueHsNothing = Map.fromList [("Nothing", PythonNone)]
|
|
605 |
|
|
606 |
-- * Hooks
|
|
607 |
|
|
608 |
hooksNameCfgupdate :: String
|
|
609 |
hooksNameCfgupdate = "config-update"
|
|
610 |
|
|
611 |
hooksNameWatcher :: String
|
|
612 |
hooksNameWatcher = "watcher"
|
|
613 |
|
|
614 |
hooksPath :: String
|
|
615 |
hooksPath = "/sbin:/bin:/usr/sbin:/usr/bin"
|
|
616 |
|
|
617 |
hooksPhasePost :: String
|
|
618 |
hooksPhasePost = "post"
|
|
619 |
|
|
620 |
hooksPhasePre :: String
|
|
621 |
hooksPhasePre = "pre"
|
|
622 |
|
|
623 |
hooksVersion :: Int
|
|
624 |
hooksVersion = 2
|
|
625 |
|
|
626 |
-- * Hooks subject type (what object type does the LU deal with)
|
|
627 |
|
|
628 |
htypeCluster :: String
|
|
629 |
htypeCluster = "CLUSTER"
|
|
630 |
|
|
631 |
htypeGroup :: String
|
|
632 |
htypeGroup = "GROUP"
|
|
633 |
|
|
634 |
htypeInstance :: String
|
|
635 |
htypeInstance = "INSTANCE"
|
|
636 |
|
|
637 |
htypeNetwork :: String
|
|
638 |
htypeNetwork = "NETWORK"
|
|
639 |
|
|
640 |
htypeNode :: String
|
|
641 |
htypeNode = "NODE"
|
|
642 |
|
|
643 |
-- * Hkr
|
|
644 |
|
|
645 |
hkrSkip :: Int
|
|
646 |
hkrSkip = 0
|
|
647 |
|
|
648 |
hkrFail :: Int
|
|
649 |
hkrFail = 1
|
|
650 |
|
|
651 |
hkrSuccess :: Int
|
|
652 |
hkrSuccess = 2
|
|
653 |
|
|
654 |
-- * Storage types
|
|
655 |
|
|
656 |
stBlock :: String
|
|
657 |
stBlock = Types.storageTypeToRaw StorageBlock
|
|
658 |
|
|
659 |
stDiskless :: String
|
|
660 |
stDiskless = Types.storageTypeToRaw StorageDiskless
|
|
661 |
|
|
662 |
stExt :: String
|
|
663 |
stExt = Types.storageTypeToRaw StorageExt
|
|
664 |
|
|
665 |
stFile :: String
|
|
666 |
stFile = Types.storageTypeToRaw StorageFile
|
|
667 |
|
|
668 |
stLvmPv :: String
|
|
669 |
stLvmPv = Types.storageTypeToRaw StorageLvmPv
|
|
670 |
|
|
671 |
stLvmVg :: String
|
|
672 |
stLvmVg = Types.storageTypeToRaw StorageLvmVg
|
|
673 |
|
|
674 |
stRados :: String
|
|
675 |
stRados = Types.storageTypeToRaw StorageRados
|
|
676 |
|
|
677 |
storageTypes :: FrozenSet String
|
|
678 |
storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
|
|
679 |
|
|
680 |
-- | The set of storage types for which storage reporting is available
|
|
681 |
--
|
|
682 |
-- FIXME: Remove this, once storage reporting is available for all
|
|
683 |
-- types.
|
|
684 |
stsReport :: FrozenSet String
|
|
685 |
stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg]
|
|
686 |
|
|
687 |
-- * Storage fields
|
|
688 |
-- ** First two are valid in LU context only, not passed to backend
|
|
689 |
|
|
690 |
sfNode :: String
|
|
691 |
sfNode = "node"
|
|
692 |
|
|
693 |
sfType :: String
|
|
694 |
sfType = "type"
|
|
695 |
|
|
696 |
-- ** and the rest are valid in backend
|
|
697 |
|
|
698 |
sfAllocatable :: String
|
|
699 |
sfAllocatable = Types.storageFieldToRaw SFAllocatable
|
|
700 |
|
|
701 |
sfFree :: String
|
|
702 |
sfFree = Types.storageFieldToRaw SFFree
|
|
703 |
|
|
704 |
sfName :: String
|
|
705 |
sfName = Types.storageFieldToRaw SFName
|
|
706 |
|
|
707 |
sfSize :: String
|
|
708 |
sfSize = Types.storageFieldToRaw SFSize
|
|
709 |
|
|
710 |
sfUsed :: String
|
|
711 |
sfUsed = Types.storageFieldToRaw SFUsed
|
|
712 |
|
|
713 |
validStorageFields :: FrozenSet String
|
|
714 |
validStorageFields =
|
|
715 |
ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++
|
|
716 |
[sfNode, sfType]
|
|
717 |
|
|
718 |
modifiableStorageFields :: Map String (FrozenSet String)
|
|
719 |
modifiableStorageFields =
|
|
720 |
Map.fromList [(Types.storageTypeToRaw StorageLvmPv,
|
|
721 |
ConstantUtils.mkSet [sfAllocatable])]
|
|
722 |
|
|
723 |
-- * Storage operations
|
|
724 |
|
|
725 |
soFixConsistency :: String
|
|
726 |
soFixConsistency = "fix-consistency"
|
|
727 |
|
|
728 |
validStorageOperations :: Map String (FrozenSet String)
|
|
729 |
validStorageOperations =
|
|
730 |
Map.fromList [(Types.storageTypeToRaw StorageLvmVg,
|
|
731 |
ConstantUtils.mkSet [soFixConsistency])]
|
|
732 |
|
|
733 |
-- * Volume fields
|
|
734 |
|
|
735 |
vfDev :: String
|
|
736 |
vfDev = "dev"
|
|
737 |
|
|
738 |
vfInstance :: String
|
|
739 |
vfInstance = "instance"
|
|
740 |
|
|
741 |
vfName :: String
|
|
742 |
vfName = "name"
|
|
743 |
|
|
744 |
vfNode :: String
|
|
745 |
vfNode = "node"
|
|
746 |
|
|
747 |
vfPhys :: String
|
|
748 |
vfPhys = "phys"
|
|
749 |
|
|
750 |
vfSize :: String
|
|
751 |
vfSize = "size"
|
|
752 |
|
|
753 |
vfVg :: String
|
|
754 |
vfVg = "vg"
|
|
755 |
|
|
756 |
-- * Local disk status
|
|
757 |
|
|
758 |
ldsFaulty :: Int
|
|
759 |
ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty
|
|
760 |
|
|
761 |
ldsOkay :: Int
|
|
762 |
ldsOkay = Types.localDiskStatusToRaw DiskStatusOk
|
|
763 |
|
|
764 |
ldsUnknown :: Int
|
|
765 |
ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown
|
|
766 |
|
|
767 |
ldsNames :: Map Int String
|
|
768 |
ldsNames =
|
|
769 |
Map.fromList [ (Types.localDiskStatusToRaw ds,
|
|
770 |
localDiskStatusName ds) | ds <- [minBound..] ]
|
|
771 |
|
|
772 |
-- * Disk template types
|
|
773 |
|
|
774 |
dtDiskless :: String
|
|
775 |
dtDiskless = Types.diskTemplateToRaw DTDiskless
|
|
776 |
|
|
777 |
dtFile :: String
|
|
778 |
dtFile = Types.diskTemplateToRaw DTFile
|
|
779 |
|
|
780 |
dtSharedFile :: String
|
|
781 |
dtSharedFile = Types.diskTemplateToRaw DTSharedFile
|
|
782 |
|
|
783 |
dtPlain :: String
|
|
784 |
dtPlain = Types.diskTemplateToRaw DTPlain
|
|
785 |
|
|
786 |
dtBlock :: String
|
|
787 |
dtBlock = Types.diskTemplateToRaw DTBlock
|
|
788 |
|
|
789 |
dtDrbd8 :: String
|
|
790 |
dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
|
|
791 |
|
|
792 |
dtRbd :: String
|
|
793 |
dtRbd = Types.diskTemplateToRaw DTRbd
|
|
794 |
|
|
795 |
dtExt :: String
|
|
796 |
dtExt = Types.diskTemplateToRaw DTExt
|
|
797 |
|
|
798 |
-- | This is used to order determine the default disk template when
|
|
799 |
-- the list of enabled disk templates is inferred from the current
|
|
800 |
-- state of the cluster. This only happens on an upgrade from a
|
|
801 |
-- version of Ganeti that did not support the 'enabled_disk_templates'
|
|
802 |
-- so far.
|
|
803 |
diskTemplatePreference :: [String]
|
|
804 |
diskTemplatePreference =
|
|
805 |
map Types.diskTemplateToRaw
|
|
806 |
[DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
|
|
807 |
|
|
808 |
diskTemplates :: FrozenSet String
|
|
809 |
diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
|
|
810 |
|
|
811 |
-- | Disk templates that are enabled by default
|
|
812 |
defaultEnabledDiskTemplates :: [String]
|
|
813 |
defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
|
|
814 |
|
|
815 |
-- | Mapping of disk templates to storage types
|
|
816 |
mapDiskTemplateStorageType :: Map String String
|
|
817 |
mapDiskTemplateStorageType =
|
|
818 |
Map.fromList $
|
|
819 |
map (Types.diskTemplateToRaw *** Types.storageTypeToRaw)
|
|
820 |
[(DTBlock, StorageBlock),
|
|
821 |
(DTDrbd8, StorageLvmVg),
|
|
822 |
(DTExt, StorageExt),
|
|
823 |
(DTSharedFile, StorageFile),
|
|
824 |
(DTFile, StorageFile),
|
|
825 |
(DTDiskless, StorageDiskless),
|
|
826 |
(DTPlain, StorageLvmVg),
|
|
827 |
(DTRbd, StorageRados)]
|
|
828 |
|
|
829 |
-- | The set of network-mirrored disk templates
|
|
830 |
dtsIntMirror :: FrozenSet String
|
|
831 |
dtsIntMirror = ConstantUtils.mkSet [dtDrbd8]
|
|
832 |
|
|
833 |
-- | 'DTDiskless' is 'trivially' externally mirrored
|
|
834 |
dtsExtMirror :: FrozenSet String
|
|
835 |
dtsExtMirror =
|
|
836 |
ConstantUtils.mkSet $
|
|
837 |
map Types.diskTemplateToRaw [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd]
|
|
838 |
|
|
839 |
-- | The set of non-lvm-based disk templates
|
|
840 |
dtsNotLvm :: FrozenSet String
|
|
841 |
dtsNotLvm =
|
|
842 |
ConstantUtils.mkSet $
|
|
843 |
map Types.diskTemplateToRaw
|
|
844 |
[DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd]
|
|
845 |
|
|
846 |
-- | The set of disk templates which can be grown
|
|
847 |
dtsGrowable :: FrozenSet String
|
|
848 |
dtsGrowable =
|
|
849 |
ConstantUtils.mkSet $
|
|
850 |
map Types.diskTemplateToRaw
|
|
851 |
[DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd]
|
|
852 |
|
|
853 |
-- | The set of disk templates that allow adoption
|
|
854 |
dtsMayAdopt :: FrozenSet String
|
|
855 |
dtsMayAdopt =
|
|
856 |
ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain]
|
|
857 |
|
|
858 |
-- | The set of disk templates that *must* use adoption
|
|
859 |
dtsMustAdopt :: FrozenSet String
|
|
860 |
dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock]
|
|
861 |
|
|
862 |
-- | The set of disk templates that allow migrations
|
|
863 |
dtsMirrored :: FrozenSet String
|
|
864 |
dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror
|
|
865 |
|
|
866 |
-- | The set of file based disk templates
|
|
867 |
dtsFilebased :: FrozenSet String
|
|
868 |
dtsFilebased =
|
|
869 |
ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTSharedFile, DTFile]
|
|
870 |
|
|
871 |
-- | The set of disk templates that can be moved by copying
|
|
872 |
--
|
|
873 |
-- Note: a requirement is that they're not accessed externally or
|
|
874 |
-- shared between nodes; in particular, sharedfile is not suitable.
|
|
875 |
dtsCopyable :: FrozenSet String
|
|
876 |
dtsCopyable =
|
|
877 |
ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile]
|
|
878 |
|
|
879 |
-- | The set of disk templates that are supported by exclusive_storage
|
|
880 |
dtsExclStorage :: FrozenSet String
|
|
881 |
dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain]
|
|
882 |
|
|
883 |
-- | Templates for which we don't perform checks on free space
|
|
884 |
dtsNoFreeSpaceCheck :: FrozenSet String
|
|
885 |
dtsNoFreeSpaceCheck =
|
|
886 |
ConstantUtils.mkSet $
|
|
887 |
map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd]
|
|
888 |
|
|
889 |
dtsBlock :: FrozenSet String
|
|
890 |
dtsBlock =
|
|
891 |
ConstantUtils.mkSet $
|
|
892 |
map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt]
|
|
893 |
|
|
894 |
-- | The set of lvm-based disk templates
|
|
895 |
dtsLvm :: FrozenSet String
|
|
896 |
dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm
|
|
897 |
|
|
898 |
-- * Drbd
|
|
899 |
|
|
900 |
drbdHmacAlg :: String
|
|
901 |
drbdHmacAlg = "md5"
|
|
902 |
|
|
903 |
drbdDefaultNetProtocol :: String
|
|
904 |
drbdDefaultNetProtocol = "C"
|
|
905 |
|
|
906 |
drbdMigrationNetProtocol :: String
|
|
907 |
drbdMigrationNetProtocol = "C"
|
|
908 |
|
|
909 |
drbdStatusFile :: String
|
|
910 |
drbdStatusFile = "/proc/drbd"
|
|
911 |
|
|
912 |
-- | Size of DRBD meta block device
|
|
913 |
drbdMetaSize :: Int
|
|
914 |
drbdMetaSize = 128
|
|
915 |
|
|
916 |
-- * Drbd barrier types
|
|
917 |
|
|
918 |
drbdBDiskBarriers :: String
|
|
919 |
drbdBDiskBarriers = "b"
|
|
920 |
|
|
921 |
drbdBDiskDrain :: String
|
|
922 |
drbdBDiskDrain = "d"
|
|
923 |
|
|
924 |
drbdBDiskFlush :: String
|
|
925 |
drbdBDiskFlush = "f"
|
|
926 |
|
|
927 |
drbdBNone :: String
|
|
928 |
drbdBNone = "n"
|
|
929 |
|
|
930 |
-- | Valid barrier combinations: "n" or any non-null subset of "bfd"
|
|
931 |
drbdValidBarrierOpt :: FrozenSet (FrozenSet String)
|
|
932 |
drbdValidBarrierOpt =
|
|
933 |
ConstantUtils.mkSet
|
|
934 |
[ ConstantUtils.mkSet [drbdBNone]
|
|
935 |
, ConstantUtils.mkSet [drbdBDiskBarriers]
|
|
936 |
, ConstantUtils.mkSet [drbdBDiskDrain]
|
|
937 |
, ConstantUtils.mkSet [drbdBDiskFlush]
|
|
938 |
, ConstantUtils.mkSet [drbdBDiskDrain, drbdBDiskFlush]
|
|
939 |
, ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskDrain]
|
|
940 |
, ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush]
|
|
941 |
, ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush, drbdBDiskDrain]
|
|
942 |
]
|
|
943 |
|
|
944 |
-- | Rbd tool command
|
|
945 |
rbdCmd :: String
|
|
946 |
rbdCmd = "rbd"
|
|
947 |
|
|
948 |
-- * File backend driver
|
|
949 |
|
|
950 |
fdBlktap :: String
|
|
951 |
fdBlktap = Types.fileDriverToRaw FileBlktap
|
|
952 |
|
|
953 |
fdLoop :: String
|
|
954 |
fdLoop = Types.fileDriverToRaw FileLoop
|
|
955 |
|
|
956 |
fileDriver :: FrozenSet String
|
|
957 |
fileDriver =
|
|
958 |
ConstantUtils.mkSet $
|
|
959 |
map Types.fileDriverToRaw [minBound..]
|
|
960 |
|
|
961 |
-- | The set of drbd-like disk types
|
|
962 |
dtsDrbd :: FrozenSet String
|
|
963 |
dtsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
|
|
964 |
|
|
965 |
-- * Disk access mode
|
|
966 |
|
|
967 |
diskRdonly :: String
|
|
968 |
diskRdonly = Types.diskModeToRaw DiskRdOnly
|
|
969 |
|
|
970 |
diskRdwr :: String
|
|
971 |
diskRdwr = Types.diskModeToRaw DiskRdWr
|
|
972 |
|
|
973 |
diskAccessSet :: FrozenSet String
|
|
974 |
diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
|
|
975 |
|
|
976 |
-- * Disk replacement mode
|
|
977 |
|
|
978 |
replaceDiskAuto :: String
|
|
979 |
replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto
|
|
980 |
|
|
981 |
replaceDiskChg :: String
|
|
982 |
replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary
|
|
983 |
|
|
984 |
replaceDiskPri :: String
|
|
985 |
replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary
|
|
986 |
|
|
987 |
replaceDiskSec :: String
|
|
988 |
replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary
|
|
989 |
|
|
990 |
replaceModes :: FrozenSet String
|
|
991 |
replaceModes =
|
|
992 |
ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..]
|
|
993 |
|
|
994 |
-- * Instance export mode
|
|
995 |
|
|
996 |
exportModeLocal :: String
|
|
997 |
exportModeLocal = Types.exportModeToRaw ExportModeLocal
|
|
998 |
|
|
999 |
exportModeRemote :: String
|
|
1000 |
exportModeRemote = Types.exportModeToRaw ExportModeRemote
|
|
1001 |
|
|
1002 |
exportModes :: FrozenSet String
|
|
1003 |
exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
|
|
1004 |
|
|
1005 |
-- * Instance creation modes
|
|
1006 |
|
|
1007 |
instanceCreate :: String
|
|
1008 |
instanceCreate = Types.instCreateModeToRaw InstCreate
|
|
1009 |
|
|
1010 |
instanceImport :: String
|
|
1011 |
instanceImport = Types.instCreateModeToRaw InstImport
|
|
1012 |
|
|
1013 |
instanceRemoteImport :: String
|
|
1014 |
instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
|
|
1015 |
|
|
1016 |
instanceCreateModes :: FrozenSet String
|
|
1017 |
instanceCreateModes =
|
|
1018 |
ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
|
|
1019 |
|
|
1020 |
-- * Remote import/export handshake message and version
|
|
1021 |
|
|
1022 |
rieHandshake :: String
|
|
1023 |
rieHandshake = "Hi, I'm Ganeti"
|
|
1024 |
|
|
1025 |
rieVersion :: Int
|
|
1026 |
rieVersion = 0
|
|
1027 |
|
|
1028 |
-- | Remote import/export certificate validity (seconds)
|
|
1029 |
rieCertValidity :: Int
|
|
1030 |
rieCertValidity = 24 * 60 * 60
|
|
1031 |
|
|
1032 |
-- | Export only: how long to wait per connection attempt (seconds)
|
|
1033 |
rieConnectAttemptTimeout :: Int
|
|
1034 |
rieConnectAttemptTimeout = 20
|
|
1035 |
|
|
1036 |
-- | Export only: number of attempts to connect
|
|
1037 |
rieConnectRetries :: Int
|
|
1038 |
rieConnectRetries = 10
|
|
1039 |
|
|
1040 |
-- | Overall timeout for establishing connection
|
|
1041 |
rieConnectTimeout :: Int
|
|
1042 |
rieConnectTimeout = 180
|
|
1043 |
|
|
1044 |
-- | Give child process up to 5 seconds to exit after sending a signal
|
|
1045 |
childLingerTimeout :: Double
|
|
1046 |
childLingerTimeout = 5.0
|
|
1047 |
|
|
1048 |
-- * Import/export config options
|
|
1049 |
|
|
1050 |
inisectBep :: String
|
|
1051 |
inisectBep = "backend"
|
|
1052 |
|
|
1053 |
inisectExp :: String
|
|
1054 |
inisectExp = "export"
|
|
1055 |
|
|
1056 |
inisectHyp :: String
|
|
1057 |
inisectHyp = "hypervisor"
|
|
1058 |
|
|
1059 |
inisectIns :: String
|
|
1060 |
inisectIns = "instance"
|
|
1061 |
|
|
1062 |
inisectOsp :: String
|
|
1063 |
inisectOsp = "os"
|
|
1064 |
|
|
1065 |
-- * Dynamic device modification
|
|
1066 |
|
|
1067 |
ddmAdd :: String
|
|
1068 |
ddmAdd = Types.ddmFullToRaw DdmFullAdd
|
|
1069 |
|
|
1070 |
ddmModify :: String
|
|
1071 |
ddmModify = Types.ddmFullToRaw DdmFullModify
|
|
1072 |
|
|
1073 |
ddmRemove :: String
|
|
1074 |
ddmRemove = Types.ddmFullToRaw DdmFullRemove
|
|
1075 |
|
|
1076 |
ddmsValues :: FrozenSet String
|
|
1077 |
ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
|
|
1078 |
|
|
1079 |
ddmsValuesWithModify :: FrozenSet String
|
|
1080 |
ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
|
|
1081 |
|
|
1082 |
-- * Common exit codes
|
|
1083 |
|
|
1084 |
exitSuccess :: Int
|
|
1085 |
exitSuccess = 0
|
|
1086 |
|
|
1087 |
exitFailure :: Int
|
|
1088 |
exitFailure = ConstantUtils.exitFailure
|
|
1089 |
|
|
1090 |
exitNotcluster :: Int
|
|
1091 |
exitNotcluster = 5
|
|
1092 |
|
|
1093 |
exitNotmaster :: Int
|
|
1094 |
exitNotmaster = 11
|
|
1095 |
|
|
1096 |
exitNodesetupError :: Int
|
|
1097 |
exitNodesetupError = 12
|
|
1098 |
|
|
1099 |
-- | Need user confirmation
|
|
1100 |
exitConfirmation :: Int
|
|
1101 |
exitConfirmation = 13
|
|
1102 |
|
|
1103 |
-- | Exit code for query operations with unknown fields
|
|
1104 |
exitUnknownField :: Int
|
|
1105 |
exitUnknownField = 14
|
|
1106 |
|
|
1107 |
-- * Tags
|
|
1108 |
|
|
1109 |
tagCluster :: String
|
|
1110 |
tagCluster = Types.tagKindToRaw TagKindCluster
|
|
1111 |
|
|
1112 |
tagInstance :: String
|
|
1113 |
tagInstance = Types.tagKindToRaw TagKindInstance
|
|
1114 |
|
|
1115 |
tagNetwork :: String
|
|
1116 |
tagNetwork = Types.tagKindToRaw TagKindNetwork
|
|
1117 |
|
|
1118 |
tagNode :: String
|
|
1119 |
tagNode = Types.tagKindToRaw TagKindNode
|
|
1120 |
|
|
1121 |
tagNodegroup :: String
|
|
1122 |
tagNodegroup = Types.tagKindToRaw TagKindGroup
|
|
1123 |
|
|
1124 |
validTagTypes :: FrozenSet String
|
|
1125 |
validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
|
|
1126 |
|
|
1127 |
maxTagLen :: Int
|
|
1128 |
maxTagLen = 128
|
|
1129 |
|
|
1130 |
maxTagsPerObj :: Int
|
|
1131 |
maxTagsPerObj = 4096
|
|
1132 |
|
|
1133 |
-- * Others
|
|
1134 |
|
|
1135 |
defaultBridge :: String
|
|
1136 |
defaultBridge = "xen-br0"
|
|
1137 |
|
|
1138 |
defaultOvs :: String
|
|
1139 |
defaultOvs = "switch1"
|
|
1140 |
|
|
1141 |
-- | 60 MiB/s, expressed in KiB/s
|
|
1142 |
classicDrbdSyncSpeed :: Int
|
|
1143 |
classicDrbdSyncSpeed = 60 * 1024
|
|
1144 |
|
|
1145 |
ip4AddressAny :: String
|
|
1146 |
ip4AddressAny = "0.0.0.0"
|
|
1147 |
|
|
1148 |
ip4AddressLocalhost :: String
|
|
1149 |
ip4AddressLocalhost = "127.0.0.1"
|
|
1150 |
|
|
1151 |
ip6AddressAny :: String
|
|
1152 |
ip6AddressAny = "::"
|
|
1153 |
|
|
1154 |
ip6AddressLocalhost :: String
|
|
1155 |
ip6AddressLocalhost = "::1"
|
|
1156 |
|
|
1157 |
ip4Version :: Int
|
|
1158 |
ip4Version = 4
|
|
1159 |
|
|
1160 |
ip6Version :: Int
|
|
1161 |
ip6Version = 6
|
|
1162 |
|
|
1163 |
validIpVersions :: FrozenSet Int
|
|
1164 |
validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version]
|
|
1165 |
|
|
1166 |
tcpPingTimeout :: Int
|
|
1167 |
tcpPingTimeout = 10
|
|
1168 |
|
|
1169 |
defaultVg :: String
|
|
1170 |
defaultVg = "xenvg"
|
|
1171 |
|
|
1172 |
defaultDrbdHelper :: String
|
|
1173 |
defaultDrbdHelper = "/bin/true"
|
|
1174 |
|
|
1175 |
minVgSize :: Int
|
|
1176 |
minVgSize = 20480
|
|
1177 |
|
|
1178 |
defaultMacPrefix :: String
|
|
1179 |
defaultMacPrefix = "aa:00:00"
|
|
1180 |
|
|
1181 |
-- | Default maximum instance wait time (seconds)
|
|
1182 |
defaultShutdownTimeout :: Int
|
|
1183 |
defaultShutdownTimeout = 120
|
|
1184 |
|
|
1185 |
-- | Node clock skew (seconds)
|
|
1186 |
nodeMaxClockSkew :: Int
|
|
1187 |
nodeMaxClockSkew = 150
|
|
1188 |
|
|
1189 |
-- | Time for an intra-cluster disk transfer to wait for a connection
|
|
1190 |
diskTransferConnectTimeout :: Int
|
|
1191 |
diskTransferConnectTimeout = 60
|
|
1192 |
|
|
1193 |
-- | Disk index separator
|
|
1194 |
diskSeparator :: String
|
|
1195 |
diskSeparator = AutoConf.diskSeparator
|
|
1196 |
|
|
1197 |
ipCommandPath :: String
|
|
1198 |
ipCommandPath = AutoConf.ipPath
|
|
1199 |
|
|
1200 |
-- | Key for job IDs in opcode result
|
|
1201 |
jobIdsKey :: String
|
|
1202 |
jobIdsKey = "jobs"
|
|
1203 |
|
|
1204 |
-- * Runparts results
|
|
1205 |
|
|
1206 |
runpartsErr :: Int
|
|
1207 |
runpartsErr = 2
|
|
1208 |
|
|
1209 |
runpartsRun :: Int
|
|
1210 |
runpartsRun = 1
|
|
1211 |
|
|
1212 |
runpartsSkip :: Int
|
|
1213 |
runpartsSkip = 0
|
|
1214 |
|
|
1215 |
runpartsStatus :: [Int]
|
|
1216 |
runpartsStatus = [runpartsErr, runpartsRun, runpartsSkip]
|
|
1217 |
|
|
1218 |
-- * RPC
|
|
1219 |
|
|
1220 |
rpcEncodingNone :: Int
|
|
1221 |
rpcEncodingNone = 0
|
|
1222 |
|
|
1223 |
rpcEncodingZlibBase64 :: Int
|
|
1224 |
rpcEncodingZlibBase64 = 1
|
|
1225 |
|
|
1226 |
-- * Timeout table
|
|
1227 |
--
|
|
1228 |
-- Various time constants for the timeout table
|
|
1229 |
|
|
1230 |
rpcTmoUrgent :: Int
|
|
1231 |
rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
|
|
1232 |
|
|
1233 |
rpcTmoFast :: Int
|
|
1234 |
rpcTmoFast = Types.rpcTimeoutToRaw Fast
|
|
1235 |
|
|
1236 |
rpcTmoNormal :: Int
|
|
1237 |
rpcTmoNormal = Types.rpcTimeoutToRaw Normal
|
|
1238 |
|
|
1239 |
rpcTmoSlow :: Int
|
|
1240 |
rpcTmoSlow = Types.rpcTimeoutToRaw Slow
|
|
1241 |
|
|
1242 |
-- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
|
|
1243 |
-- in the 'Ganeti.THH.deCamelCase' function and generate the correct
|
|
1244 |
-- Python name.
|
|
1245 |
rpcTmo_4hrs :: Int
|
|
1246 |
rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
|
|
1247 |
|
|
1248 |
-- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
|
|
1249 |
-- in the 'Ganeti.THH.deCamelCase' function and generate the correct
|
|
1250 |
-- Python name.
|
|
1251 |
rpcTmo_1day :: Int
|
|
1252 |
rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
|
|
1253 |
|
|
1254 |
-- | Timeout for connecting to nodes (seconds)
|
|
1255 |
rpcConnectTimeout :: Int
|
|
1256 |
rpcConnectTimeout = 5
|
|
1257 |
|
|
1258 |
-- OS
|
|
1259 |
|
|
1260 |
osScriptCreate :: String
|
|
1261 |
osScriptCreate = "create"
|
|
1262 |
|
|
1263 |
osScriptExport :: String
|
|
1264 |
osScriptExport = "export"
|
|
1265 |
|
|
1266 |
osScriptImport :: String
|
|
1267 |
osScriptImport = "import"
|
|
1268 |
|
|
1269 |
osScriptRename :: String
|
|
1270 |
osScriptRename = "rename"
|
|
1271 |
|
|
1272 |
osScriptVerify :: String
|
|
1273 |
osScriptVerify = "verify"
|
|
1274 |
|
|
1275 |
osScripts :: [String]
|
|
1276 |
osScripts = [osScriptCreate, osScriptExport, osScriptImport, osScriptRename,
|
|
1277 |
osScriptVerify]
|
|
1278 |
|
|
1279 |
osApiFile :: String
|
|
1280 |
osApiFile = "ganeti_api_version"
|
|
1281 |
|
|
1282 |
osVariantsFile :: String
|
|
1283 |
osVariantsFile = "variants.list"
|
|
1284 |
|
|
1285 |
osParametersFile :: String
|
|
1286 |
osParametersFile = "parameters.list"
|
|
1287 |
|
|
1288 |
osValidateParameters :: String
|
|
1289 |
osValidateParameters = "parameters"
|
|
1290 |
|
|
1291 |
osValidateCalls :: FrozenSet String
|
|
1292 |
osValidateCalls = ConstantUtils.mkSet [osValidateParameters]
|
|
1293 |
|
|
1294 |
-- | External Storage (ES) related constants
|
|
1295 |
|
|
1296 |
esActionAttach :: String
|
|
1297 |
esActionAttach = "attach"
|
|
1298 |
|
|
1299 |
esActionCreate :: String
|
|
1300 |
esActionCreate = "create"
|
|
1301 |
|
|
1302 |
esActionDetach :: String
|
|
1303 |
esActionDetach = "detach"
|
|
1304 |
|
|
1305 |
esActionGrow :: String
|
|
1306 |
esActionGrow = "grow"
|
|
1307 |
|
|
1308 |
esActionRemove :: String
|
|
1309 |
esActionRemove = "remove"
|
|
1310 |
|
|
1311 |
esActionSetinfo :: String
|
|
1312 |
esActionSetinfo = "setinfo"
|
|
1313 |
|
|
1314 |
esActionVerify :: String
|
|
1315 |
esActionVerify = "verify"
|
|
1316 |
|
|
1317 |
esScriptCreate :: String
|
|
1318 |
esScriptCreate = esActionCreate
|
|
1319 |
|
|
1320 |
esScriptRemove :: String
|
|
1321 |
esScriptRemove = esActionRemove
|
|
1322 |
|
|
1323 |
esScriptGrow :: String
|
|
1324 |
esScriptGrow = esActionGrow
|
|
1325 |
|
|
1326 |
esScriptAttach :: String
|
|
1327 |
esScriptAttach = esActionAttach
|
|
1328 |
|
|
1329 |
esScriptDetach :: String
|
|
1330 |
esScriptDetach = esActionDetach
|
|
1331 |
|
|
1332 |
esScriptSetinfo :: String
|
|
1333 |
esScriptSetinfo = esActionSetinfo
|
|
1334 |
|
|
1335 |
esScriptVerify :: String
|
|
1336 |
esScriptVerify = esActionVerify
|
|
1337 |
|
|
1338 |
esScripts :: FrozenSet String
|
|
1339 |
esScripts =
|
|
1340 |
ConstantUtils.mkSet [esScriptAttach,
|
|
1341 |
esScriptCreate,
|
|
1342 |
esScriptDetach,
|
|
1343 |
esScriptGrow,
|
|
1344 |
esScriptRemove,
|
|
1345 |
esScriptSetinfo,
|
|
1346 |
esScriptVerify]
|
|
1347 |
|
|
1348 |
esParametersFile :: String
|
|
1349 |
esParametersFile = "parameters.list"
|
|
1350 |
|
|
1351 |
-- * Reboot types
|
|
1352 |
|
|
1353 |
instanceRebootSoft :: String
|
|
1354 |
instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
|
|
1355 |
|
|
1356 |
instanceRebootHard :: String
|
|
1357 |
instanceRebootHard = Types.rebootTypeToRaw RebootHard
|
|
1358 |
|
|
1359 |
instanceRebootFull :: String
|
|
1360 |
instanceRebootFull = Types.rebootTypeToRaw RebootFull
|
|
1361 |
|
|
1362 |
rebootTypes :: FrozenSet String
|
|
1363 |
rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
|
|
1364 |
|
|
1365 |
-- * Instance reboot behaviors
|
|
1366 |
|
|
1367 |
instanceRebootAllowed :: String
|
|
1368 |
instanceRebootAllowed = "reboot"
|
|
1369 |
|
|
1370 |
instanceRebootExit :: String
|
|
1371 |
instanceRebootExit = "exit"
|
|
1372 |
|
|
1373 |
rebootBehaviors :: [String]
|
|
1374 |
rebootBehaviors = [instanceRebootAllowed, instanceRebootExit]
|
|
1375 |
|
|
1376 |
-- * VTypes
|
|
1377 |
|
|
1378 |
vtypeBool :: VType
|
|
1379 |
vtypeBool = VTypeBool
|