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"
EXPORT_CONF_FILE = "config.ini"
+XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER
XEN_KERNEL = _autoconf.XEN_KERNEL
XEN_INITRD = _autoconf.XEN_INITRD
ST_LVM_VG = "lvm-vg"
# Storage fields
+# first two are valid in LU context only, not passed to backend
+SF_NODE = "node"
+SF_TYPE = "type"
+# and the rest are valid in backend
SF_NAME = "name"
SF_SIZE = "size"
SF_FREE = "free"
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_NAME, SF_SIZE, SF_USED, SF_FREE, SF_ALLOCATABLE]),
- ST_LVM_VG: frozenset([SF_NAME, SF_SIZE]),
- }
+VALID_STORAGE_FIELDS = frozenset([SF_NAME, SF_TYPE, SF_SIZE,
+ SF_USED, SF_FREE, SF_ALLOCATABLE])
+
+VALID_STORAGE_TYPES = frozenset([ST_FILE, ST_LVM_PV, ST_LVM_VG])
MODIFIABLE_STORAGE_FIELDS = {
ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
MIN_VG_SIZE = 20480
DEFAULT_MAC_PREFIX = "aa:00:00"
LVM_STRIPECOUNT = _autoconf.LVM_STRIPECOUNT
+# default maximum instance wait time, in seconds.
+DEFAULT_SHUTDOWN_TIMEOUT = 120
+
# RPC constants
(RPC_ENCODING_NONE,
OS_SCRIPTS = frozenset([OS_SCRIPT_CREATE, OS_SCRIPT_IMPORT,
OS_SCRIPT_EXPORT, OS_SCRIPT_RENAME])
+OS_API_FILE = 'ganeti_api_version'
+OS_VARIANTS_FILE = 'variants.list'
+
# ssh constants
SSH_INITD_SCRIPT = _autoconf.SSH_INITD_SCRIPT
SSH_CONFIG_DIR = "/etc/ssh/"
HV_NIC_TYPE = "nic_type"
HV_DISK_TYPE = "disk_type"
HV_VNC_BIND_ADDRESS = "vnc_bind_address"
+HV_VNC_PASSWORD_FILE = "vnc_password_file"
HV_VNC_TLS = "vnc_tls"
HV_VNC_X509 = "vnc_x509_path"
HV_VNC_X509_VERIFY = "vnc_x509_verify"
HV_ACPI = "acpi"
HV_PAE = "pae"
+HV_USE_BOOTLOADER = "use_bootloader"
+HV_BOOTLOADER_ARGS = "bootloader_args"
+HV_BOOTLOADER_PATH = "bootloader_path"
HV_KERNEL_ARGS = "kernel_args"
HV_KERNEL_PATH = "kernel_path"
HV_INITRD_PATH = "initrd_path"
HV_CDROM_IMAGE_PATH: VTYPE_STRING,
HV_NIC_TYPE: VTYPE_STRING,
HV_DISK_TYPE: VTYPE_STRING,
+ HV_VNC_PASSWORD_FILE: VTYPE_STRING,
HV_VNC_BIND_ADDRESS: VTYPE_STRING,
HV_VNC_TLS: VTYPE_BOOL,
HV_VNC_X509: VTYPE_STRING,
HV_VNC_X509_VERIFY: VTYPE_BOOL,
HV_ACPI: VTYPE_BOOL,
HV_PAE: VTYPE_BOOL,
+ HV_USE_BOOTLOADER: VTYPE_BOOL,
+ HV_BOOTLOADER_PATH: VTYPE_STRING,
+ HV_BOOTLOADER_ARGS: VTYPE_STRING,
HV_KERNEL_PATH: VTYPE_STRING,
HV_KERNEL_ARGS: VTYPE_STRING,
HV_INITRD_PATH: VTYPE_STRING,
NV_HVINFO = "hvinfo"
NV_HYPERVISOR = "hypervisor"
NV_INSTANCELIST = "instancelist"
-NV_LVLIST = "lvlist"
NV_NODELIST = "nodelist"
NV_NODENETTEST = "node-net-test"
NV_VERSION = "version"
NV_VGLIST = "vglist"
+NV_LVLIST = "lvlist"
+NV_PVLIST = "pvlist"
NV_DRBDLIST = "drbd-list"
+NV_NODESETUP = "nodesetup"
# Allocator framework constants
IALLOCATOR_VERSION = 2
HVC_DEFAULTS = {
HT_XEN_PVM: {
+ HV_USE_BOOTLOADER: False,
+ HV_BOOTLOADER_PATH: XEN_BOOTLOADER,
+ HV_BOOTLOADER_ARGS: '',
HV_KERNEL_PATH: "/boot/vmlinuz-2.6-xenU",
HV_INITRD_PATH: '',
HV_ROOT_PATH: '/dev/sda1',
HV_NIC_TYPE: HT_NIC_RTL8139,
HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
HV_VNC_BIND_ADDRESS: '0.0.0.0',
+ HV_VNC_PASSWORD_FILE: VNC_PASSWORD_FILE,
HV_ACPI: True,
HV_PAE: True,
HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
HV_VNC_TLS: False,
HV_VNC_X509: '',
HV_VNC_X509_VERIFY: False,
+ HV_VNC_PASSWORD_FILE: '',
HV_CDROM_IMAGE_PATH: '',
HV_BOOT_ORDER: HT_BO_DISK,
HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
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 request query fields. These are used to narrow down queries.
+# These must be strings rather than integers, because json-encoding
+# converts them to strings anyway, as they're used as dict-keys.
+CONFD_REQQ_LINK = "0"
+CONFD_REQQ_IP = "1"
+CONFD_REQQ_IPLIST = "2"
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
# A few common errors for confd
CONFD_ERROR_UNKNOWN_ENTRY = 1
CONFD_ERROR_INTERNAL = 2
+CONFD_ERROR_ARGUMENT = 3
# Each request is "salted" by the current timestamp.
# This constants decides how many seconds of skew to accept.
# 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