Statistics
| Branch: | Tag: | Revision:

root / lib / pathutils.py @ 91c17910

History | View | Annotate | Download (5.4 kB)

1 3329f4de Michael Hanselmann
#
2 3329f4de Michael Hanselmann
#
3 3329f4de Michael Hanselmann
4 3329f4de Michael Hanselmann
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
5 3329f4de Michael Hanselmann
#
6 3329f4de Michael Hanselmann
# This program is free software; you can redistribute it and/or modify
7 3329f4de Michael Hanselmann
# it under the terms of the GNU General Public License as published by
8 3329f4de Michael Hanselmann
# the Free Software Foundation; either version 2 of the License, or
9 3329f4de Michael Hanselmann
# (at your option) any later version.
10 3329f4de Michael Hanselmann
#
11 3329f4de Michael Hanselmann
# This program is distributed in the hope that it will be useful, but
12 3329f4de Michael Hanselmann
# WITHOUT ANY WARRANTY; without even the implied warranty of
13 3329f4de Michael Hanselmann
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 3329f4de Michael Hanselmann
# General Public License for more details.
15 3329f4de Michael Hanselmann
#
16 3329f4de Michael Hanselmann
# You should have received a copy of the GNU General Public License
17 3329f4de Michael Hanselmann
# along with this program; if not, write to the Free Software
18 3329f4de Michael Hanselmann
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 3329f4de Michael Hanselmann
# 02110-1301, USA.
20 3329f4de Michael Hanselmann
21 3329f4de Michael Hanselmann
22 3329f4de Michael Hanselmann
"""Module containing constants and functions for filesystem paths.
23 3329f4de Michael Hanselmann

24 3329f4de Michael Hanselmann
"""
25 3329f4de Michael Hanselmann
26 3329f4de Michael Hanselmann
from ganeti import _autoconf
27 b8028dcf Michael Hanselmann
from ganeti import compat
28 cffbbae7 Michael Hanselmann
from ganeti import vcluster
29 cffbbae7 Michael Hanselmann
30 3329f4de Michael Hanselmann
31 3329f4de Michael Hanselmann
# Build-time constants
32 cffbbae7 Michael Hanselmann
DEFAULT_FILE_STORAGE_DIR = vcluster.AddNodePrefix(_autoconf.FILE_STORAGE_DIR)
33 cffbbae7 Michael Hanselmann
DEFAULT_SHARED_FILE_STORAGE_DIR = \
34 cffbbae7 Michael Hanselmann
  vcluster.AddNodePrefix(_autoconf.SHARED_FILE_STORAGE_DIR)
35 cffbbae7 Michael Hanselmann
EXPORT_DIR = vcluster.AddNodePrefix(_autoconf.EXPORT_DIR)
36 3329f4de Michael Hanselmann
OS_SEARCH_PATH = _autoconf.OS_SEARCH_PATH
37 376631d1 Constantinos Venetsanopoulos
ES_SEARCH_PATH = _autoconf.ES_SEARCH_PATH
38 3329f4de Michael Hanselmann
SSH_CONFIG_DIR = _autoconf.SSH_CONFIG_DIR
39 a8e8c0c6 Michael Hanselmann
XEN_CONFIG_DIR = vcluster.AddNodePrefix(_autoconf.XEN_CONFIG_DIR)
40 cffbbae7 Michael Hanselmann
SYSCONFDIR = vcluster.AddNodePrefix(_autoconf.SYSCONFDIR)
41 3329f4de Michael Hanselmann
TOOLSDIR = _autoconf.TOOLSDIR
42 cffbbae7 Michael Hanselmann
LOCALSTATEDIR = vcluster.AddNodePrefix(_autoconf.LOCALSTATEDIR)
43 3329f4de Michael Hanselmann
44 3329f4de Michael Hanselmann
# Paths which don't change for a virtual cluster
45 3329f4de Michael Hanselmann
DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util"
46 3329f4de Michael Hanselmann
IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export"
47 3329f4de Michael Hanselmann
KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper"
48 3329f4de Michael Hanselmann
KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
49 224ff0f7 Michael Hanselmann
PREPARE_NODE_JOIN = _autoconf.PKGLIBDIR + "/prepare-node-join"
50 7b8ba235 Michael Hanselmann
NODE_DAEMON_SETUP = _autoconf.PKGLIBDIR + "/node-daemon-setup"
51 b9612abb Iustin Pop
XEN_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xen-console-wrapper"
52 fe4f6dca Michael Hanselmann
ETC_HOSTS = vcluster.ETC_HOSTS
53 3329f4de Michael Hanselmann
54 3329f4de Michael Hanselmann
# Top-level paths
55 cffbbae7 Michael Hanselmann
DATA_DIR = LOCALSTATEDIR + "/lib/ganeti"
56 cffbbae7 Michael Hanselmann
LOCK_DIR = LOCALSTATEDIR + "/lock"
57 cffbbae7 Michael Hanselmann
LOG_DIR = LOCALSTATEDIR + "/log/ganeti"
58 cffbbae7 Michael Hanselmann
RUN_DIR = LOCALSTATEDIR + "/run/ganeti"
59 3329f4de Michael Hanselmann
60 3329f4de Michael Hanselmann
#: Script to configure master IP address
61 3329f4de Michael Hanselmann
DEFAULT_MASTER_SETUP_SCRIPT = TOOLSDIR + "/master-ip-setup"
62 3329f4de Michael Hanselmann
63 3329f4de Michael Hanselmann
SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_dsa_key"
64 3329f4de Michael Hanselmann
SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
65 3329f4de Michael Hanselmann
SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_rsa_key"
66 3329f4de Michael Hanselmann
SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
67 3329f4de Michael Hanselmann
68 3329f4de Michael Hanselmann
BDEV_CACHE_DIR = RUN_DIR + "/bdev-cache"
69 3329f4de Michael Hanselmann
DISK_LINKS_DIR = RUN_DIR + "/instance-disks"
70 3329f4de Michael Hanselmann
SOCKET_DIR = RUN_DIR + "/socket"
71 3329f4de Michael Hanselmann
CRYPTO_KEYS_DIR = RUN_DIR + "/crypto"
72 3329f4de Michael Hanselmann
IMPORT_EXPORT_DIR = RUN_DIR + "/import-export"
73 3329f4de Michael Hanselmann
INSTANCE_STATUS_FILE = RUN_DIR + "/instance-status"
74 3329f4de Michael Hanselmann
#: User-id pool lock directory (used user IDs have a corresponding lock file in
75 3329f4de Michael Hanselmann
#: this directory)
76 3329f4de Michael Hanselmann
UIDPOOL_LOCKDIR = RUN_DIR + "/uid-pool"
77 3329f4de Michael Hanselmann
78 3329f4de Michael Hanselmann
SSCONF_LOCK_FILE = LOCK_DIR + "/ganeti-ssconf.lock"
79 3329f4de Michael Hanselmann
80 3329f4de Michael Hanselmann
CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
81 3329f4de Michael Hanselmann
RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
82 3329f4de Michael Hanselmann
CONFD_HMAC_KEY = DATA_DIR + "/hmac.key"
83 3329f4de Michael Hanselmann
SPICE_CERT_FILE = DATA_DIR + "/spice.pem"
84 3329f4de Michael Hanselmann
SPICE_CACERT_FILE = DATA_DIR + "/spice-ca.pem"
85 3329f4de Michael Hanselmann
CLUSTER_DOMAIN_SECRET_FILE = DATA_DIR + "/cluster-domain-secret"
86 3329f4de Michael Hanselmann
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
87 3329f4de Michael Hanselmann
RAPI_USERS_FILE = DATA_DIR + "/rapi/users"
88 3329f4de Michael Hanselmann
QUEUE_DIR = DATA_DIR + "/queue"
89 3329f4de Michael Hanselmann
CONF_DIR = SYSCONFDIR + "/ganeti"
90 3329f4de Michael Hanselmann
USER_SCRIPTS_DIR = CONF_DIR + "/scripts"
91 3329f4de Michael Hanselmann
VNC_PASSWORD_FILE = CONF_DIR + "/vnc-cluster-password"
92 3329f4de Michael Hanselmann
HOOKS_BASE_DIR = CONF_DIR + "/hooks"
93 fbdac0d9 Michael Hanselmann
FILE_STORAGE_PATHS_FILE = CONF_DIR + "/file-storage-paths"
94 878c42ae Michael Hanselmann
RESTRICTED_COMMANDS_DIR = CONF_DIR + "/restricted-commands"
95 df99f3a9 Michael Hanselmann
96 c9f79949 Michael Hanselmann
#: Node daemon certificate path
97 c9f79949 Michael Hanselmann
NODED_CERT_FILE = DATA_DIR + "/server.pem"
98 c9f79949 Michael Hanselmann
99 c9f79949 Michael Hanselmann
#: Node daemon certificate file permissions
100 c9f79949 Michael Hanselmann
NODED_CERT_MODE = 0440
101 c9f79949 Michael Hanselmann
102 df99f3a9 Michael Hanselmann
#: Locked in exclusive mode while noded verifies a remote command
103 878c42ae Michael Hanselmann
RESTRICTED_COMMANDS_LOCK_FILE = LOCK_DIR + "/ganeti-restricted-commands.lock"
104 3329f4de Michael Hanselmann
105 3329f4de Michael Hanselmann
#: Lock file for watcher, locked in shared mode by watcher; lock in exclusive
106 3329f4de Michael Hanselmann
# mode to block watcher (see L{cli._RunWhileClusterStoppedHelper.Call}
107 3329f4de Michael Hanselmann
WATCHER_LOCK_FILE = LOCK_DIR + "/ganeti-watcher.lock"
108 3329f4de Michael Hanselmann
109 3329f4de Michael Hanselmann
#: Status file for per-group watcher, locked in exclusive mode by watcher
110 3329f4de Michael Hanselmann
WATCHER_GROUP_STATE_FILE = DATA_DIR + "/watcher.%s.data"
111 3329f4de Michael Hanselmann
112 3329f4de Michael Hanselmann
#: File for per-group instance status, merged into L{INSTANCE_STATUS_FILE} by
113 3329f4de Michael Hanselmann
#: per-group processes
114 3329f4de Michael Hanselmann
WATCHER_GROUP_INSTANCE_STATUS_FILE = DATA_DIR + "/watcher.%s.instance-status"
115 3329f4de Michael Hanselmann
116 3329f4de Michael Hanselmann
#: File containing Unix timestamp until which watcher should be paused
117 3329f4de Michael Hanselmann
WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
118 3329f4de Michael Hanselmann
119 3329f4de Michael Hanselmann
#: User-provided master IP setup script
120 3329f4de Michael Hanselmann
EXTERNAL_MASTER_SETUP_SCRIPT = USER_SCRIPTS_DIR + "/master-ip-setup"
121 3329f4de Michael Hanselmann
122 3329f4de Michael Hanselmann
#: LUXI socket used for job execution
123 3329f4de Michael Hanselmann
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
124 3329f4de Michael Hanselmann
#: LUXI socket used for queries only
125 3329f4de Michael Hanselmann
QUERY_SOCKET = SOCKET_DIR + "/ganeti-query"
126 3329f4de Michael Hanselmann
127 3329f4de Michael Hanselmann
LOG_OS_DIR = LOG_DIR + "/os"
128 376631d1 Constantinos Venetsanopoulos
LOG_ES_DIR = LOG_DIR + "/extstorage"
129 3329f4de Michael Hanselmann
130 3329f4de Michael Hanselmann
# Job queue paths
131 3329f4de Michael Hanselmann
JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
132 3329f4de Michael Hanselmann
JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
133 3329f4de Michael Hanselmann
JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
134 3329f4de Michael Hanselmann
JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
135 3329f4de Michael Hanselmann
JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
136 3329f4de Michael Hanselmann
137 b8028dcf Michael Hanselmann
ALL_CERT_FILES = compat.UniqueFrozenset([
138 3329f4de Michael Hanselmann
  NODED_CERT_FILE,
139 3329f4de Michael Hanselmann
  RAPI_CERT_FILE,
140 3329f4de Michael Hanselmann
  SPICE_CERT_FILE,
141 3329f4de Michael Hanselmann
  SPICE_CACERT_FILE,
142 3329f4de Michael Hanselmann
  ])
143 3329f4de Michael Hanselmann
144 3329f4de Michael Hanselmann
145 3329f4de Michael Hanselmann
def GetLogFilename(daemon_name):
146 3329f4de Michael Hanselmann
  """Returns the full path for a daemon's log file.
147 3329f4de Michael Hanselmann

148 3329f4de Michael Hanselmann
  """
149 3329f4de Michael Hanselmann
  return "%s/%s.log" % (LOG_DIR, daemon_name)
150 3329f4de Michael Hanselmann
151 3329f4de Michael Hanselmann
152 3329f4de Michael Hanselmann
LOG_WATCHER = GetLogFilename("watcher")
153 3329f4de Michael Hanselmann
LOG_COMMANDS = GetLogFilename("commands")
154 3329f4de Michael Hanselmann
LOG_BURNIN = GetLogFilename("burnin")