Statistics
| Branch: | Tag: | Revision:

root / lib / pathutils.py @ 49a924bc

History | View | Annotate | Download (5.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 containing constants and functions for filesystem paths.
23

24
"""
25

    
26
from ganeti import _autoconf
27
from ganeti import compat
28
from ganeti import vcluster
29

    
30

    
31
# FIXME: remove autoconf override
32
DEFAULT_FILE_STORAGE_DIR = "/srv/ganeti/file-storage"
33

    
34
# Build-time constants
35
# FIXME: remove autoconf storage dir
36
if _autoconf.FILE_STORAGE_DIR:
37
  DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
38
DEFAULT_FILE_STORAGE_DIR = vcluster.AddNodePrefix(DEFAULT_FILE_STORAGE_DIR)
39

    
40
if _autoconf.ENABLE_SHARED_FILE_STORAGE:
41
  DEFAULT_SHARED_FILE_STORAGE_DIR = \
42
    vcluster.AddNodePrefix(_autoconf.SHARED_FILE_STORAGE_DIR)
43
else:
44
  DEFAULT_SHARED_FILE_STORAGE_DIR = _autoconf.SHARED_FILE_STORAGE_DIR
45
EXPORT_DIR = vcluster.AddNodePrefix(_autoconf.EXPORT_DIR)
46
OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
47
ES_SEARCH_PATH = _autoconf.ES_SEARCH_PATH
48
SSH_CONFIG_DIR = _autoconf.SSH_CONFIG_DIR
49
XEN_CONFIG_DIR = vcluster.AddNodePrefix(_autoconf.XEN_CONFIG_DIR)
50
SYSCONFDIR = vcluster.AddNodePrefix(_autoconf.SYSCONFDIR)
51
TOOLSDIR = _autoconf.TOOLSDIR
52
LOCALSTATEDIR = vcluster.AddNodePrefix(_autoconf.LOCALSTATEDIR)
53

    
54
# Paths which don't change for a virtual cluster
55
DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util"
56
IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export"
57
KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper"
58
KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
59
PREPARE_NODE_JOIN = _autoconf.PKGLIBDIR + "/prepare-node-join"
60
NODE_DAEMON_SETUP = _autoconf.PKGLIBDIR + "/node-daemon-setup"
61
XEN_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xen-console-wrapper"
62
ETC_HOSTS = vcluster.ETC_HOSTS
63

    
64
# Top-level paths
65
DATA_DIR = LOCALSTATEDIR + "/lib/ganeti"
66
LOCK_DIR = LOCALSTATEDIR + "/lock"
67
LOG_DIR = LOCALSTATEDIR + "/log/ganeti"
68
RUN_DIR = LOCALSTATEDIR + "/run/ganeti"
69

    
70
#: Script to configure master IP address
71
DEFAULT_MASTER_SETUP_SCRIPT = TOOLSDIR + "/master-ip-setup"
72

    
73
SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_dsa_key"
74
SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
75
SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_rsa_key"
76
SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
77

    
78
BDEV_CACHE_DIR = RUN_DIR + "/bdev-cache"
79
DISK_LINKS_DIR = RUN_DIR + "/instance-disks"
80
SOCKET_DIR = RUN_DIR + "/socket"
81
CRYPTO_KEYS_DIR = RUN_DIR + "/crypto"
82
IMPORT_EXPORT_DIR = RUN_DIR + "/import-export"
83
INSTANCE_STATUS_FILE = RUN_DIR + "/instance-status"
84
INSTANCE_REASON_DIR = RUN_DIR + "/instance-reason"
85
#: User-id pool lock directory (used user IDs have a corresponding lock file in
86
#: this directory)
87
UIDPOOL_LOCKDIR = RUN_DIR + "/uid-pool"
88

    
89
SSCONF_LOCK_FILE = LOCK_DIR + "/ganeti-ssconf.lock"
90

    
91
CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
92
RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
93
CONFD_HMAC_KEY = DATA_DIR + "/hmac.key"
94
SPICE_CERT_FILE = DATA_DIR + "/spice.pem"
95
SPICE_CACERT_FILE = DATA_DIR + "/spice-ca.pem"
96
CLUSTER_DOMAIN_SECRET_FILE = DATA_DIR + "/cluster-domain-secret"
97
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
98
RAPI_USERS_FILE = DATA_DIR + "/rapi/users"
99
QUEUE_DIR = DATA_DIR + "/queue"
100
CONF_DIR = SYSCONFDIR + "/ganeti"
101
USER_SCRIPTS_DIR = CONF_DIR + "/scripts"
102
VNC_PASSWORD_FILE = CONF_DIR + "/vnc-cluster-password"
103
HOOKS_BASE_DIR = CONF_DIR + "/hooks"
104
FILE_STORAGE_PATHS_FILE = CONF_DIR + "/file-storage-paths"
105
RESTRICTED_COMMANDS_DIR = CONF_DIR + "/restricted-commands"
106

    
107
#: Node daemon certificate path
108
NODED_CERT_FILE = DATA_DIR + "/server.pem"
109

    
110
#: Node daemon certificate file permissions
111
NODED_CERT_MODE = 0440
112

    
113
#: Locked in exclusive mode while noded verifies a remote command
114
RESTRICTED_COMMANDS_LOCK_FILE = LOCK_DIR + "/ganeti-restricted-commands.lock"
115

    
116
#: Lock file for watcher, locked in shared mode by watcher; lock in exclusive
117
# mode to block watcher (see L{cli._RunWhileClusterStoppedHelper.Call}
118
WATCHER_LOCK_FILE = LOCK_DIR + "/ganeti-watcher.lock"
119

    
120
#: Status file for per-group watcher, locked in exclusive mode by watcher
121
WATCHER_GROUP_STATE_FILE = DATA_DIR + "/watcher.%s.data"
122

    
123
#: File for per-group instance status, merged into L{INSTANCE_STATUS_FILE} by
124
#: per-group processes
125
WATCHER_GROUP_INSTANCE_STATUS_FILE = DATA_DIR + "/watcher.%s.instance-status"
126

    
127
#: File containing Unix timestamp until which watcher should be paused
128
WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
129

    
130
#: User-provided master IP setup script
131
EXTERNAL_MASTER_SETUP_SCRIPT = USER_SCRIPTS_DIR + "/master-ip-setup"
132

    
133
#: LUXI socket used for job execution
134
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
135
#: LUXI socket used for queries only
136
QUERY_SOCKET = SOCKET_DIR + "/ganeti-query"
137

    
138
LOG_OS_DIR = LOG_DIR + "/os"
139
LOG_ES_DIR = LOG_DIR + "/extstorage"
140
#: Directory for storing Xen config files after failed instance starts
141
LOG_XEN_DIR = LOG_DIR + "/xen"
142

    
143
# Job queue paths
144
JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
145
JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
146
JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
147
JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
148
JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
149

    
150
ALL_CERT_FILES = compat.UniqueFrozenset([
151
  NODED_CERT_FILE,
152
  RAPI_CERT_FILE,
153
  SPICE_CERT_FILE,
154
  SPICE_CACERT_FILE,
155
  ])
156

    
157

    
158
def GetLogFilename(daemon_name):
159
  """Returns the full path for a daemon's log file.
160

161
  """
162
  return "%s/%s.log" % (LOG_DIR, daemon_name)
163

    
164

    
165
LOG_WATCHER = GetLogFilename("watcher")
166
LOG_COMMANDS = GetLogFilename("commands")
167
LOG_BURNIN = GetLogFilename("burnin")