4 # Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
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.
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.
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
22 """Module containing constants and functions for filesystem paths.
26 from ganeti import _autoconf
27 from ganeti import vcluster
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)
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 ETC_HOSTS = vcluster.ETC_HOSTS
51 DATA_DIR = LOCALSTATEDIR + "/lib/ganeti"
52 LOCK_DIR = LOCALSTATEDIR + "/lock"
53 LOG_DIR = LOCALSTATEDIR + "/log/ganeti"
54 RUN_DIR = LOCALSTATEDIR + "/run/ganeti"
56 #: Script to configure master IP address
57 DEFAULT_MASTER_SETUP_SCRIPT = TOOLSDIR + "/master-ip-setup"
59 SSH_HOST_DSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_dsa_key"
60 SSH_HOST_DSA_PUB = SSH_HOST_DSA_PRIV + ".pub"
61 SSH_HOST_RSA_PRIV = SSH_CONFIG_DIR + "/ssh_host_rsa_key"
62 SSH_HOST_RSA_PUB = SSH_HOST_RSA_PRIV + ".pub"
64 BDEV_CACHE_DIR = RUN_DIR + "/bdev-cache"
65 DISK_LINKS_DIR = RUN_DIR + "/instance-disks"
66 SOCKET_DIR = RUN_DIR + "/socket"
67 CRYPTO_KEYS_DIR = RUN_DIR + "/crypto"
68 IMPORT_EXPORT_DIR = RUN_DIR + "/import-export"
69 INSTANCE_STATUS_FILE = RUN_DIR + "/instance-status"
70 #: User-id pool lock directory (used user IDs have a corresponding lock file in
72 UIDPOOL_LOCKDIR = RUN_DIR + "/uid-pool"
74 SSCONF_LOCK_FILE = LOCK_DIR + "/ganeti-ssconf.lock"
76 CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
77 NODED_CERT_FILE = DATA_DIR + "/server.pem"
78 RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
79 CONFD_HMAC_KEY = DATA_DIR + "/hmac.key"
80 SPICE_CERT_FILE = DATA_DIR + "/spice.pem"
81 SPICE_CACERT_FILE = DATA_DIR + "/spice-ca.pem"
82 CLUSTER_DOMAIN_SECRET_FILE = DATA_DIR + "/cluster-domain-secret"
83 SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
84 RAPI_USERS_FILE = DATA_DIR + "/rapi/users"
85 QUEUE_DIR = DATA_DIR + "/queue"
86 CONF_DIR = SYSCONFDIR + "/ganeti"
87 USER_SCRIPTS_DIR = CONF_DIR + "/scripts"
88 VNC_PASSWORD_FILE = CONF_DIR + "/vnc-cluster-password"
89 HOOKS_BASE_DIR = CONF_DIR + "/hooks"
90 FILE_STORAGE_PATHS_FILE = CONF_DIR + "/file-storage-paths"
92 #: Lock file for watcher, locked in shared mode by watcher; lock in exclusive
93 # mode to block watcher (see L{cli._RunWhileClusterStoppedHelper.Call}
94 WATCHER_LOCK_FILE = LOCK_DIR + "/ganeti-watcher.lock"
96 #: Status file for per-group watcher, locked in exclusive mode by watcher
97 WATCHER_GROUP_STATE_FILE = DATA_DIR + "/watcher.%s.data"
99 #: File for per-group instance status, merged into L{INSTANCE_STATUS_FILE} by
100 #: per-group processes
101 WATCHER_GROUP_INSTANCE_STATUS_FILE = DATA_DIR + "/watcher.%s.instance-status"
103 #: File containing Unix timestamp until which watcher should be paused
104 WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
106 #: User-provided master IP setup script
107 EXTERNAL_MASTER_SETUP_SCRIPT = USER_SCRIPTS_DIR + "/master-ip-setup"
109 #: LUXI socket used for job execution
110 MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
111 #: LUXI socket used for queries only
112 QUERY_SOCKET = SOCKET_DIR + "/ganeti-query"
114 LOG_OS_DIR = LOG_DIR + "/os"
117 JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
118 JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
119 JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
120 JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
121 JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
123 ALL_CERT_FILES = frozenset([
131 def GetLogFilename(daemon_name):
132 """Returns the full path for a daemon's log file.
135 return "%s/%s.log" % (LOG_DIR, daemon_name)
138 LOG_WATCHER = GetLogFilename("watcher")
139 LOG_COMMANDS = GetLogFilename("commands")
140 LOG_BURNIN = GetLogFilename("burnin")
141 LOG_SETUP_SSH = GetLogFilename("setup-ssh")