Statistics
| Branch: | Tag: | Revision:

root / lib / pathutils.py @ cffbbae7

History | View | Annotate | Download (4.8 kB)

1
#
2
#
3

    
4
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 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 vcluster
28

    
29

    
30
# Build-time constants
31
DEFAULT_FILE_STORAGE_DIR = vcluster.AddNodePrefix(_autoconf.FILE_STORAGE_DIR)
32
DEFAULT_SHARED_FILE_STORAGE_DIR = \
33
  vcluster.AddNodePrefix(_autoconf.SHARED_FILE_STORAGE_DIR)
34
EXPORT_DIR = vcluster.AddNodePrefix(_autoconf.EXPORT_DIR)
35
OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
36
SSH_CONFIG_DIR = _autoconf.SSH_CONFIG_DIR
37
SYSCONFDIR = vcluster.AddNodePrefix(_autoconf.SYSCONFDIR)
38
TOOLSDIR = _autoconf.TOOLSDIR
39
LOCALSTATEDIR = vcluster.AddNodePrefix(_autoconf.LOCALSTATEDIR)
40

    
41
# Paths which don't change for a virtual cluster
42
DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util"
43
IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export"
44
KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper"
45
KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
46
SETUP_SSH = _autoconf.TOOLSDIR + "/setup-ssh"
47
XM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xm-console-wrapper"
48

    
49
# Top-level paths
50
DATA_DIR = LOCALSTATEDIR + "/lib/ganeti"
51
LOCK_DIR = LOCALSTATEDIR + "/lock"
52
LOG_DIR = LOCALSTATEDIR + "/log/ganeti"
53
RUN_DIR = LOCALSTATEDIR + "/run/ganeti"
54

    
55
#: Script to configure master IP address
56
DEFAULT_MASTER_SETUP_SCRIPT = TOOLSDIR + "/master-ip-setup"
57

    
58
SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_dsa_key"
59
SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
60
SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_rsa_key"
61
SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
62

    
63
BDEV_CACHE_DIR = RUN_DIR + "/bdev-cache"
64
DISK_LINKS_DIR = RUN_DIR + "/instance-disks"
65
SOCKET_DIR = RUN_DIR + "/socket"
66
CRYPTO_KEYS_DIR = RUN_DIR + "/crypto"
67
IMPORT_EXPORT_DIR = RUN_DIR + "/import-export"
68
INSTANCE_STATUS_FILE = RUN_DIR + "/instance-status"
69
#: User-id pool lock directory (used user IDs have a corresponding lock file in
70
#: this directory)
71
UIDPOOL_LOCKDIR = RUN_DIR + "/uid-pool"
72

    
73
SSCONF_LOCK_FILE = LOCK_DIR + "/ganeti-ssconf.lock"
74

    
75
CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
76
NODED_CERT_FILE = DATA_DIR + "/server.pem"
77
RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
78
CONFD_HMAC_KEY = DATA_DIR + "/hmac.key"
79
SPICE_CERT_FILE = DATA_DIR + "/spice.pem"
80
SPICE_CACERT_FILE = DATA_DIR + "/spice-ca.pem"
81
CLUSTER_DOMAIN_SECRET_FILE = DATA_DIR + "/cluster-domain-secret"
82
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
83
RAPI_USERS_FILE = DATA_DIR + "/rapi/users"
84
QUEUE_DIR = DATA_DIR + "/queue"
85
CONF_DIR = SYSCONFDIR + "/ganeti"
86
USER_SCRIPTS_DIR = CONF_DIR + "/scripts"
87
VNC_PASSWORD_FILE = CONF_DIR + "/vnc-cluster-password"
88
HOOKS_BASE_DIR = CONF_DIR + "/hooks"
89

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

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

    
97
#: File for per-group instance status, merged into L{INSTANCE_STATUS_FILE} by
98
#: per-group processes
99
WATCHER_GROUP_INSTANCE_STATUS_FILE = DATA_DIR + "/watcher.%s.instance-status"
100

    
101
#: File containing Unix timestamp until which watcher should be paused
102
WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
103

    
104
#: User-provided master IP setup script
105
EXTERNAL_MASTER_SETUP_SCRIPT = USER_SCRIPTS_DIR + "/master-ip-setup"
106

    
107
#: LUXI socket used for job execution
108
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
109
#: LUXI socket used for queries only
110
QUERY_SOCKET = SOCKET_DIR + "/ganeti-query"
111

    
112
LOG_OS_DIR = LOG_DIR + "/os"
113

    
114
# Job queue paths
115
JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
116
JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
117
JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
118
JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
119
JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
120

    
121
ALL_CERT_FILES = frozenset([
122
  NODED_CERT_FILE,
123
  RAPI_CERT_FILE,
124
  SPICE_CERT_FILE,
125
  SPICE_CACERT_FILE,
126
  ])
127

    
128

    
129
def GetLogFilename(daemon_name):
130
  """Returns the full path for a daemon's log file.
131

132
  """
133
  return "%s/%s.log" % (LOG_DIR, daemon_name)
134

    
135

    
136
LOG_WATCHER = GetLogFilename("watcher")
137
LOG_COMMANDS = GetLogFilename("commands")
138
LOG_BURNIN = GetLogFilename("burnin")
139
LOG_SETUP_SSH = GetLogFilename("setup-ssh")