Statistics
| Branch: | Tag: | Revision:

root / lib / pathutils.py @ 7a9dbd61

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 _constants
27
from ganeti import compat
28
from ganeti import vcluster
29

    
30

    
31
# Build-time constants
32
DEFAULT_FILE_STORAGE_DIR = "/srv/ganeti/file-storage"
33
DEFAULT_FILE_STORAGE_DIR = vcluster.AddNodePrefix(DEFAULT_FILE_STORAGE_DIR)
34
DEFAULT_SHARED_FILE_STORAGE_DIR = "/srv/ganeti/shared-file-storage"
35
DEFAULT_SHARED_FILE_STORAGE_DIR = \
36
    vcluster.AddNodePrefix(DEFAULT_SHARED_FILE_STORAGE_DIR)
37
EXPORT_DIR = vcluster.AddNodePrefix(_constants.EXPORT_DIR)
38
OS_SEARCH_PATH = _constants.OS_SEARCH_PATH
39
ES_SEARCH_PATH = _constants.ES_SEARCH_PATH
40
SSH_CONFIG_DIR = _constants.SSH_CONFIG_DIR
41
XEN_CONFIG_DIR = vcluster.AddNodePrefix(_constants.XEN_CONFIG_DIR)
42
SYSCONFDIR = vcluster.AddNodePrefix(_constants.SYSCONFDIR)
43
TOOLSDIR = _constants.TOOLSDIR
44
PKGLIBDIR = _constants.PKGLIBDIR
45
LOCALSTATEDIR = vcluster.AddNodePrefix(_constants.LOCALSTATEDIR)
46

    
47
# Paths which don't change for a virtual cluster
48
DAEMON_UTIL = _constants.PKGLIBDIR + "/daemon-util"
49
IMPORT_EXPORT_DAEMON = _constants.PKGLIBDIR + "/import-export"
50
KVM_CONSOLE_WRAPPER = _constants.PKGLIBDIR + "/tools/kvm-console-wrapper"
51
KVM_IFUP = _constants.PKGLIBDIR + "/kvm-ifup"
52
PREPARE_NODE_JOIN = _constants.PKGLIBDIR + "/prepare-node-join"
53
NODE_DAEMON_SETUP = _constants.PKGLIBDIR + "/node-daemon-setup"
54
XEN_CONSOLE_WRAPPER = _constants.PKGLIBDIR + "/tools/xen-console-wrapper"
55
CFGUPGRADE = _constants.PKGLIBDIR + "/tools/cfgupgrade"
56
ENSURE_DIRS = _constants.PKGLIBDIR + "/ensure-dirs"
57
ETC_HOSTS = vcluster.ETC_HOSTS
58

    
59
# Top-level paths
60
DATA_DIR = LOCALSTATEDIR + "/lib/ganeti"
61
LOCK_DIR = LOCALSTATEDIR + "/lock"
62
LOG_DIR = LOCALSTATEDIR + "/log/ganeti"
63
RUN_DIR = LOCALSTATEDIR + "/run/ganeti"
64

    
65
#: Script to configure master IP address
66
DEFAULT_MASTER_SETUP_SCRIPT = TOOLSDIR + "/master-ip-setup"
67

    
68
SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_dsa_key"
69
SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
70
SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_rsa_key"
71
SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
72

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

    
84
SSCONF_LOCK_FILE = LOCK_DIR + "/ganeti-ssconf.lock"
85

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

    
102
#: Node daemon certificate path
103
NODED_CERT_FILE = DATA_DIR + "/server.pem"
104

    
105
#: Node daemon certificate file permissions
106
NODED_CERT_MODE = 0440
107

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

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

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

    
118
#: File for per-group instance status, merged into L{INSTANCE_STATUS_FILE} by
119
#: per-group processes
120
WATCHER_GROUP_INSTANCE_STATUS_FILE = DATA_DIR + "/watcher.%s.instance-status"
121

    
122
#: File containing Unix timestamp until which watcher should be paused
123
WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
124

    
125
#: User-provided master IP setup script
126
EXTERNAL_MASTER_SETUP_SCRIPT = USER_SCRIPTS_DIR + "/master-ip-setup"
127

    
128
#: LUXI socket used for job execution
129
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
130
#: LUXI socket used for queries only
131
QUERY_SOCKET = SOCKET_DIR + "/ganeti-query"
132

    
133
LOG_OS_DIR = LOG_DIR + "/os"
134
LOG_ES_DIR = LOG_DIR + "/extstorage"
135
#: Directory for storing Xen config files after failed instance starts
136
LOG_XEN_DIR = LOG_DIR + "/xen"
137

    
138
# Job queue paths
139
JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
140
JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
141
JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
142
JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
143
JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
144

    
145
ALL_CERT_FILES = compat.UniqueFrozenset([
146
  NODED_CERT_FILE,
147
  RAPI_CERT_FILE,
148
  SPICE_CERT_FILE,
149
  SPICE_CACERT_FILE,
150
  ])
151

    
152

    
153
def GetLogFilename(daemon_name):
154
  """Returns the full path for a daemon's log file.
155

156
  """
157
  return "%s/%s.log" % (LOG_DIR, daemon_name)
158

    
159

    
160
LOG_WATCHER = GetLogFilename("watcher")
161
LOG_COMMANDS = GetLogFilename("commands")
162
LOG_BURNIN = GetLogFilename("burnin")