RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
HMAC_CLUSTER_KEY = DATA_DIR + "/hmac.key"
WATCHER_STATEFILE = DATA_DIR + "/watcher.data"
+WATCHER_PAUSEFILE = DATA_DIR + "/watcher.pause"
INSTANCE_UPFILE = RUN_GANETI_DIR + "/instance-status"
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
RAPI_USERS_FILE = DATA_DIR + "/rapi_users"
ETC_HOSTS = "/etc/hosts"
DEFAULT_FILE_STORAGE_DIR = _autoconf.FILE_STORAGE_DIR
SYSCONFDIR = _autoconf.SYSCONFDIR
+TOOLSDIR = _autoconf.TOOLSDIR
CONF_DIR = SYSCONFDIR + "/ganeti"
MASTER_SOCKET = SOCKET_DIR + "/ganeti-master"
LOG_DIR = _autoconf.LOCALSTATEDIR + "/log/ganeti/"
DAEMONS_LOGFILES = {
- # "daemon-name": "logfile"
- NODED: LOG_DIR + "node-daemon.log",
- CONFD: LOG_DIR + "conf-daemon.log",
- RAPI: LOG_DIR + "rapi-daemon.log",
- MASTERD: LOG_DIR + "master-daemon.log",
-}
+ # "daemon-name": "logfile"
+ NODED: LOG_DIR + "node-daemon.log",
+ CONFD: LOG_DIR + "conf-daemon.log",
+ RAPI: LOG_DIR + "rapi-daemon.log",
+ MASTERD: LOG_DIR + "master-daemon.log",
+ }
LOG_OS_DIR = LOG_DIR + "os"
LOG_WATCHER = LOG_DIR + "watcher.log"
LOG_COMMANDS = LOG_DIR + "commands.log"
SF_USED = "used"
SF_ALLOCATABLE = "allocatable"
+# Storage operations
+SO_FIX_CONSISTENCY = "fix-consistency"
+
# Available fields per storage type
VALID_STORAGE_FIELDS = {
ST_FILE: frozenset([SF_NAME, SF_USED, SF_FREE]),
ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
}
+VALID_STORAGE_OPERATIONS = {
+ ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
+ }
+
# Local disk status
# Note: Code depends on LDS_OKAY < LDS_UNKNOWN < LDS_FAULTY
(LDS_OKAY,
REPLACE_DISK_PRI = "replace_on_primary" # replace disks on primary
REPLACE_DISK_SEC = "replace_on_secondary" # replace disks on secondary
REPLACE_DISK_CHG = "replace_new_secondary" # change secondary node
+REPLACE_DISK_AUTO = "replace_auto"
# lock recalculate mode
LOCKS_REPLACE = 'replace'
CONFD_PROTOCOL_VERSION = 1
+CONFD_REQ_PING = 0
CONFD_REQ_NODE_ROLE_BYNAME = 1
CONFD_REQ_NODE_PIP_BY_INSTANCE_IP = 2
+CONFD_REQ_CLUSTER_MASTER = 3
+CONFD_REQ_NODE_PIP_LIST = 4
+CONFD_REQ_MC_PIP_LIST = 5
+CONFD_REQ_INSTANCES_IPS_LIST = 6
CONFD_REQS = frozenset([
+ CONFD_REQ_PING,
CONFD_REQ_NODE_ROLE_BYNAME,
CONFD_REQ_NODE_PIP_BY_INSTANCE_IP,
+ CONFD_REQ_CLUSTER_MASTER,
+ CONFD_REQ_NODE_PIP_LIST,
+ CONFD_REQ_MC_PIP_LIST,
+ CONFD_REQ_INSTANCES_IPS_LIST,
])
CONFD_REPL_STATUS_OK = 0
(CONFD_NODE_ROLE_MASTER,
CONFD_NODE_ROLE_CANDIDATE,
CONFD_NODE_ROLE_OFFLINE,
- CONFD_NODE_ROLE_DRAINED) = range(4)
+ CONFD_NODE_ROLE_DRAINED,
+ CONFD_NODE_ROLE_REGULAR,
+ ) = range(5)
+
+# A few common errors for confd
+CONFD_ERROR_UNKNOWN_ENTRY = 1
+CONFD_ERROR_INTERNAL = 2
# Each request is "salted" by the current timestamp.
# This constants decides how many seconds of skew to accept.
# TODO: make this a default and allow the value to be more configurable
CONFD_MAX_CLOCK_SKEW = 300
+# When we haven't reloaded the config for more than this amount of seconds, we
+# force a test to see if inotify is betraying us.
+CONFD_CONFIG_RELOAD_TIMEOUT = 60
+
+# If we receive more than one update in this amount of seconds, we move to
+# polling every RATELIMIT seconds, rather than relying on inotify, to be able
+# to serve more requests.
+CONFD_CONFIG_RELOAD_RATELIMIT = 2
+
+# Magic number prepended to all confd queries.
+# This allows us to distinguish different types of confd protocols and handle
+# them. For example by changing this we can move the whole payload to be
+# compressed, or move away from json.
+CONFD_MAGIC_FOURCC = 'plj0'
+
+# By default a confd request is sent to the minimum between this number and all
+# MCs. 6 was chosen because even in the case of a disastrous 50% response rate,
+# we should have enough answers to be able to compare more than one.
+CONFD_DEFAULT_REQ_COVERAGE = 6
+
+# Timeout in seconds to expire pending query request in the confd client
+# library. We don't actually expect any answer more than 10 seconds after we
+# sent a request.
+CONFD_CLIENT_EXPIRE_TIMEOUT = 10
+
+# Maximum UDP datagram size.
+# On IPv4: 64K - 20 (ip header size) - 8 (udp header size) = 65507
+# On IPv6: 64K - 40 (ip6 header size) - 8 (udp header size) = 65487
+# (assuming we can't use jumbo frames)
+# We just set this to 60K, which should be enough
+MAX_UDP_DATA_SIZE = 61440