Statistics
| Branch: | Tag: | Revision:

root / lib / pathutils.py @ f7f03738

History | View | Annotate | Download (5.7 kB)

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

155 3329f4de Michael Hanselmann
  """
156 3329f4de Michael Hanselmann
  return "%s/%s.log" % (LOG_DIR, daemon_name)
157 3329f4de Michael Hanselmann
158 3329f4de Michael Hanselmann
159 3329f4de Michael Hanselmann
LOG_WATCHER = GetLogFilename("watcher")
160 3329f4de Michael Hanselmann
LOG_COMMANDS = GetLogFilename("commands")
161 3329f4de Michael Hanselmann
LOG_BURNIN = GetLogFilename("burnin")