Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ 38242904

History | View | Annotate | Download (3.1 kB)

1
#!/usr/bin/python
2
#
3

    
4
# Copyright (C) 2006, 2007 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
# various versions
25
CONFIG_VERSION = 2
26
PROTOCOL_VERSION = 2
27
RELEASE_VERSION = "1.2a1"
28
OS_API_VERSION = 4
29
EXPORT_VERSION = 0
30

    
31

    
32
# file paths
33
DATA_DIR = "/var/lib/ganeti"
34
CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
35
SSL_CERT_FILE = DATA_DIR + "/server.pem"
36
HYPERCONF_FILE = DATA_DIR + "/hypervisor"
37
WATCHER_STATEFILE = DATA_DIR + "/restart_state"
38

    
39
ETC_DIR = "/etc/ganeti"
40

    
41
MASTER_CRON_FILE = ETC_DIR + "/master-cron"
42
MASTER_CRON_LINK = "/etc/cron.d/ganeti-master-cron"
43
NODE_INITD_SCRIPT = "/etc/init.d/ganeti"
44
NODE_INITD_NAME = "ganeti"
45
DEFAULT_NODED_PORT = 1811
46
FIRST_DRBD_PORT = 11000
47
LAST_DRBD_PORT = 14999
48
MASTER_SCRIPT = "ganeti-master"
49

    
50
LOG_DIR = "/var/log/ganeti"
51
LOG_OS_DIR = LOG_DIR + "/os"
52
LOG_NODESERVER = LOG_DIR + "/node-daemon.log"
53

    
54
OS_DIR = "/srv/ganeti/os"
55
EXPORT_DIR = "/srv/ganeti/export"
56

    
57
EXPORT_CONF_FILE = "config.ini"
58

    
59
# hooks-related constants
60
HOOKS_BASE_DIR = "/etc/ganeti/hooks"
61
HOOKS_PHASE_PRE = "pre"
62
HOOKS_PHASE_POST = "post"
63
HOOKS_VERSION = 1
64

    
65
# hooks subject type (what object type does the LU deal with)
66
HTYPE_CLUSTER = "CLUSTER"
67
HTYPE_NODE = "NODE"
68
HTYPE_INSTANCE = "INSTANCE"
69

    
70
HKR_SKIP = 0
71
HKR_FAIL = 1
72
HKR_SUCCESS = 2
73

    
74
# disk template types
75
DT_DISKLESS = "diskless"
76
DT_PLAIN = "plain"
77
DT_LOCAL_RAID1 = "local_raid1"
78
DT_REMOTE_RAID1 = "remote_raid1"
79

    
80
# instance creation modem
81
INSTANCE_CREATE = "create"
82
INSTANCE_IMPORT = "import"
83

    
84
DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN,
85
                            DT_LOCAL_RAID1, DT_REMOTE_RAID1])
86

    
87
# file groups
88
CLUSTER_CONF_FILES = ["/etc/hosts",
89
                      "/etc/ssh/ssh_known_hosts",
90
                      "/etc/ssh/ssh_host_dsa_key",
91
                      "/etc/ssh/ssh_host_dsa_key.pub",
92
                      "/etc/ssh/ssh_host_rsa_key",
93
                      "/etc/ssh/ssh_host_rsa_key.pub",
94
                      "/root/.ssh/authorized_keys",
95
                      "/root/.ssh/id_dsa",
96
                      "/root/.ssh/id_dsa.pub",
97
                      CLUSTER_CONF_FILE,
98
                      SSL_CERT_FILE,
99
                      MASTER_CRON_FILE,
100
                      ]
101

    
102
MASTER_CONFIGFILES = [MASTER_CRON_LINK,]
103

    
104
NODE_CONFIGFILES = [NODE_INITD_SCRIPT,
105
                    "/etc/rc2.d/S20%s" % NODE_INITD_NAME,
106
                    "/etc/rc0.d/K80%s" % NODE_INITD_NAME]
107

    
108
# import/export config options
109
INISECT_EXP = "export"
110
INISECT_INS = "instance"
111

    
112
# common exit codes
113
EXIT_NOTMASTER = 11