root / lib / constants.py @ 93f1e606
History | View | Annotate | Download (2.9 kB)
1 |
#
|
---|---|
2 |
#
|
3 |
|
4 |
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
|
5 |
#
|
6 |
# This program is free software; you can redistribute it and/or modify
|
7 |
# it under the terms of the GNU General Public License as published by
|
8 |
# the Free Software Foundation; either version 2 of the License, or
|
9 |
# (at your option) any later version.
|
10 |
#
|
11 |
# This program is distributed in the hope that it will be useful, but
|
12 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
# General Public License for more details.
|
15 |
#
|
16 |
# You should have received a copy of the GNU General Public License
|
17 |
# along with this program; if not, write to the Free Software
|
18 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
19 |
# 02110-1301, USA.
|
20 |
|
21 |
|
22 |
"""Module holding different constants."""
|
23 |
|
24 |
# pylint: disable=W0401,W0614
|
25 |
#
|
26 |
# The modules 'ganeti._constants' and 'ganeti._vcsversion' are meant
|
27 |
# to be re-exported but pylint complains because the imported names
|
28 |
# are not actually used in this module.
|
29 |
|
30 |
import re |
31 |
import socket |
32 |
|
33 |
from ganeti._constants import * |
34 |
from ganeti._vcsversion import * |
35 |
from ganeti import compat |
36 |
from ganeti import pathutils |
37 |
|
38 |
ALLOCATABLE_KEY = "allocatable"
|
39 |
FAILED_KEY = "failed"
|
40 |
|
41 |
DAEMONS_LOGFILES = \ |
42 |
dict((daemon, pathutils.GetLogFilename(DAEMONS_LOGBASE[daemon]))
|
43 |
for daemon in DAEMONS_LOGBASE) |
44 |
|
45 |
DAEMONS_EXTRA_LOGFILES = \ |
46 |
dict((daemon, dict((extra, |
47 |
pathutils.GetLogFilename(DAEMONS_EXTRA_LOGBASE[daemon][extra])) |
48 |
for extra in DAEMONS_EXTRA_LOGBASE[daemon])) |
49 |
for daemon in DAEMONS_EXTRA_LOGBASE) |
50 |
|
51 |
# When the Xen toolstack used is "xl", live migration requires the source host
|
52 |
# to connect to the target host via ssh (xl runs this command). We need to pass
|
53 |
# the command xl runs some extra info so that it can use Ganeti's key
|
54 |
# verification and not fail. Note that this string is incomplete: it must be
|
55 |
# filled with the cluster name before being used.
|
56 |
XL_SSH_CMD = ("ssh -l %s -oGlobalKnownHostsFile=%s"
|
57 |
" -oUserKnownHostsFile=/dev/null"
|
58 |
" -oCheckHostIp=no -oStrictHostKeyChecking=yes"
|
59 |
" -oHostKeyAlias=%%s") % (SSH_LOGIN_USER,
|
60 |
pathutils.SSH_KNOWN_HOSTS_FILE) |
61 |
|
62 |
IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
|
63 |
|
64 |
# External script validation mask
|
65 |
EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
|
66 |
|
67 |
JOB_ID_TEMPLATE = r"\d+"
|
68 |
JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
|
69 |
|
70 |
# HVC_DEFAULTS contains one value 'HV_VNC_PASSWORD_FILE' which is not
|
71 |
# a constant because it depends on an environment variable that is
|
72 |
# used for VClusters. Therefore, it cannot be automatically generated
|
73 |
# by Haskell at compilation time (given that this environment variable
|
74 |
# might be different at runtime).
|
75 |
HVC_DEFAULTS[HT_XEN_HVM][HV_VNC_PASSWORD_FILE] = pathutils.VNC_PASSWORD_FILE |
76 |
|
77 |
# Do not re-export imported modules
|
78 |
del re, socket, pathutils, compat
|