Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ a8083063

History | View | Annotate | Download (3.2 kB)

1 a8083063 Iustin Pop
#!/usr/bin/python
2 a8083063 Iustin Pop
#
3 a8083063 Iustin Pop
4 a8083063 Iustin Pop
# Copyright (C) 2006, 2007 Google Inc.
5 a8083063 Iustin Pop
#
6 a8083063 Iustin Pop
# This program is free software; you can redistribute it and/or modify
7 a8083063 Iustin Pop
# it under the terms of the GNU General Public License as published by
8 a8083063 Iustin Pop
# the Free Software Foundation; either version 2 of the License, or
9 a8083063 Iustin Pop
# (at your option) any later version.
10 a8083063 Iustin Pop
#
11 a8083063 Iustin Pop
# This program is distributed in the hope that it will be useful, but
12 a8083063 Iustin Pop
# WITHOUT ANY WARRANTY; without even the implied warranty of
13 a8083063 Iustin Pop
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 a8083063 Iustin Pop
# General Public License for more details.
15 a8083063 Iustin Pop
#
16 a8083063 Iustin Pop
# You should have received a copy of the GNU General Public License
17 a8083063 Iustin Pop
# along with this program; if not, write to the Free Software
18 a8083063 Iustin Pop
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 a8083063 Iustin Pop
# 02110-1301, USA.
20 a8083063 Iustin Pop
21 a8083063 Iustin Pop
22 a8083063 Iustin Pop
"""Module holding different constants."""
23 a8083063 Iustin Pop
24 a8083063 Iustin Pop
# various versions
25 a8083063 Iustin Pop
CONFIG_VERSION = 2
26 a8083063 Iustin Pop
PROTOCOL_VERSION = 2
27 a8083063 Iustin Pop
RELEASE_VERSION = "1.2a1"
28 a8083063 Iustin Pop
OS_API_VERSION = 4
29 a8083063 Iustin Pop
EXPORT_VERSION = 0
30 a8083063 Iustin Pop
31 a8083063 Iustin Pop
32 a8083063 Iustin Pop
# file paths
33 a8083063 Iustin Pop
DATA_DIR = "/var/lib/ganeti"
34 a8083063 Iustin Pop
CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
35 a8083063 Iustin Pop
CLUSTER_NAME_FILE = DATA_DIR + "/cluster-name"
36 a8083063 Iustin Pop
SSL_CERT_FILE = DATA_DIR + "/server.pem"
37 a8083063 Iustin Pop
HYPERCONF_FILE = DATA_DIR + "/hypervisor"
38 a8083063 Iustin Pop
WATCHER_STATEFILE = DATA_DIR + "/restart_state"
39 a8083063 Iustin Pop
40 a8083063 Iustin Pop
ETC_DIR = "/etc/ganeti"
41 a8083063 Iustin Pop
42 a8083063 Iustin Pop
MASTER_CRON_FILE = ETC_DIR + "/master-cron"
43 a8083063 Iustin Pop
MASTER_CRON_LINK = "/etc/cron.d/ganeti-master-cron"
44 a8083063 Iustin Pop
NODE_INITD_SCRIPT = "/etc/init.d/ganeti"
45 a8083063 Iustin Pop
NODE_INITD_NAME = "ganeti"
46 a8083063 Iustin Pop
DEFAULT_NODED_PORT = 1811
47 a8083063 Iustin Pop
FIRST_DRBD_PORT = 11000
48 a8083063 Iustin Pop
LAST_DRBD_PORT = 14999
49 a8083063 Iustin Pop
MASTER_INITD_SCRIPT = "/etc/init.d/ganeti-master"
50 a8083063 Iustin Pop
MASTER_INITD_NAME = "ganeti-master"
51 a8083063 Iustin Pop
52 a8083063 Iustin Pop
LOG_DIR = "/var/log/ganeti"
53 a8083063 Iustin Pop
LOG_OS_DIR = LOG_DIR + "/os"
54 a8083063 Iustin Pop
LOG_NODESERVER = LOG_DIR + "/node-daemon.log"
55 a8083063 Iustin Pop
56 a8083063 Iustin Pop
OS_DIR = "/srv/ganeti/os"
57 a8083063 Iustin Pop
EXPORT_DIR = "/srv/ganeti/export"
58 a8083063 Iustin Pop
59 a8083063 Iustin Pop
EXPORT_CONF_FILE = "config.ini"
60 a8083063 Iustin Pop
61 a8083063 Iustin Pop
# hooks-related constants
62 a8083063 Iustin Pop
HOOKS_BASE_DIR = "/etc/ganeti/hooks"
63 a8083063 Iustin Pop
HOOKS_PHASE_PRE = "pre"
64 a8083063 Iustin Pop
HOOKS_PHASE_POST = "post"
65 a8083063 Iustin Pop
HOOKS_VERSION = 1
66 a8083063 Iustin Pop
67 a8083063 Iustin Pop
# hooks subject type (what object type does the LU deal with)
68 a8083063 Iustin Pop
HTYPE_CLUSTER = "CLUSTER"
69 a8083063 Iustin Pop
HTYPE_NODE = "NODE"
70 a8083063 Iustin Pop
HTYPE_INSTANCE = "INSTANCE"
71 a8083063 Iustin Pop
72 a8083063 Iustin Pop
HKR_SKIP = 0
73 a8083063 Iustin Pop
HKR_FAIL = 1
74 a8083063 Iustin Pop
HKR_SUCCESS = 2
75 a8083063 Iustin Pop
76 a8083063 Iustin Pop
# disk template types
77 a8083063 Iustin Pop
DT_DISKLESS = "diskless"
78 a8083063 Iustin Pop
DT_PLAIN = "plain"
79 a8083063 Iustin Pop
DT_LOCAL_RAID1 = "local_raid1"
80 a8083063 Iustin Pop
DT_REMOTE_RAID1 = "remote_raid1"
81 a8083063 Iustin Pop
82 a8083063 Iustin Pop
# instance creation modem
83 a8083063 Iustin Pop
INSTANCE_CREATE = "create"
84 a8083063 Iustin Pop
INSTANCE_IMPORT = "import"
85 a8083063 Iustin Pop
86 a8083063 Iustin Pop
DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN,
87 a8083063 Iustin Pop
                            DT_LOCAL_RAID1, DT_REMOTE_RAID1])
88 a8083063 Iustin Pop
89 a8083063 Iustin Pop
# file groups
90 a8083063 Iustin Pop
CLUSTER_CONF_FILES = ["/etc/hosts",
91 a8083063 Iustin Pop
                      "/etc/ssh/ssh_known_hosts",
92 a8083063 Iustin Pop
                      "/etc/ssh/ssh_host_dsa_key",
93 a8083063 Iustin Pop
                      "/etc/ssh/ssh_host_dsa_key.pub",
94 a8083063 Iustin Pop
                      "/etc/ssh/ssh_host_rsa_key",
95 a8083063 Iustin Pop
                      "/etc/ssh/ssh_host_rsa_key.pub",
96 a8083063 Iustin Pop
                      "/root/.ssh/authorized_keys",
97 a8083063 Iustin Pop
                      "/root/.ssh/id_dsa",
98 a8083063 Iustin Pop
                      "/root/.ssh/id_dsa.pub",
99 a8083063 Iustin Pop
                      CLUSTER_CONF_FILE,
100 a8083063 Iustin Pop
                      SSL_CERT_FILE,
101 a8083063 Iustin Pop
                      MASTER_CRON_FILE,
102 a8083063 Iustin Pop
                      ]
103 a8083063 Iustin Pop
104 a8083063 Iustin Pop
MASTER_CONFIGFILES = [MASTER_CRON_LINK,
105 a8083063 Iustin Pop
                      "/etc/rc2.d/S21%s" % MASTER_INITD_NAME]
106 a8083063 Iustin Pop
107 a8083063 Iustin Pop
NODE_CONFIGFILES = [NODE_INITD_SCRIPT,
108 a8083063 Iustin Pop
                    "/etc/rc2.d/S20%s" % NODE_INITD_NAME,
109 a8083063 Iustin Pop
                    "/etc/rc0.d/K80%s" % NODE_INITD_NAME]
110 a8083063 Iustin Pop
111 a8083063 Iustin Pop
# import/export config options
112 a8083063 Iustin Pop
INISECT_EXP = "export"
113 a8083063 Iustin Pop
INISECT_INS = "instance"