Statistics
| Branch: | Tag: | Revision:

root / lib / constants.py @ a8083063

History | View | Annotate | Download (3.2 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
CLUSTER_NAME_FILE = DATA_DIR + "/cluster-name"
36
SSL_CERT_FILE = DATA_DIR + "/server.pem"
37
HYPERCONF_FILE = DATA_DIR + "/hypervisor"
38
WATCHER_STATEFILE = DATA_DIR + "/restart_state"
39

    
40
ETC_DIR = "/etc/ganeti"
41

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

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

    
56
OS_DIR = "/srv/ganeti/os"
57
EXPORT_DIR = "/srv/ganeti/export"
58

    
59
EXPORT_CONF_FILE = "config.ini"
60

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

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

    
72
HKR_SKIP = 0
73
HKR_FAIL = 1
74
HKR_SUCCESS = 2
75

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

    
82
# instance creation modem
83
INSTANCE_CREATE = "create"
84
INSTANCE_IMPORT = "import"
85

    
86
DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN,
87
                            DT_LOCAL_RAID1, DT_REMOTE_RAID1])
88

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

    
104
MASTER_CONFIGFILES = [MASTER_CRON_LINK,
105
                      "/etc/rc2.d/S21%s" % MASTER_INITD_NAME]
106

    
107
NODE_CONFIGFILES = [NODE_INITD_SCRIPT,
108
                    "/etc/rc2.d/S20%s" % NODE_INITD_NAME,
109
                    "/etc/rc0.d/K80%s" % NODE_INITD_NAME]
110

    
111
# import/export config options
112
INISECT_EXP = "export"
113
INISECT_INS = "instance"