diff --git a/.gitignore b/.gitignore
index fcc8eab245232134bcc62752c94103f24e48b23e..9dc08662f632563f66fe2489623ec3a3d773a8cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -146,6 +146,5 @@
/src/AutoConf.hs
/src/Ganeti/Curl/Internal.hs
/src/Ganeti/Hs2Py/ListConstants.hs
-/src/Ganeti/PyConstants.hs
/src/Ganeti/Version.hs
/test/hs/Test/Ganeti/TestImports.hs
diff --git a/Makefile.am b/Makefile.am
index 855f8eddc5843287f2c6673947d9e6295d4bc3eb..f8ce5b261fd4748387327bb78e82412611b6a37d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -36,7 +36,7 @@ CHECK_NEWS = $(top_srcdir)/autotools/check-news
CHECK_IMPORTS = $(top_srcdir)/autotools/check-imports
DOCPP = $(top_srcdir)/autotools/docpp
REPLACE_VARS_SED = autotools/replace_vars.sed
-CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
+PRINT_PY_CONSTANTS = $(top_srcdir)/autotools/print-py-constants
BUILD_RPC = $(top_srcdir)/autotools/build-rpc
SHELL_ENV_INIT = autotools/shell-env-init
@@ -269,7 +269,6 @@ CLEANFILES = \
src/ganeti-confd \
src/ganeti-luxid \
src/ganeti-mond \
- src/hs2py-constants \
.hpc/*.mix src/*.tix test/hs/*.tix *.tix \
doc/hs-lint.html
@@ -488,10 +487,10 @@ utils_PYTHON = \
lib/utils/x509.py
docinput = \
- doc/conf.py \
- doc/css/style.css \
doc/admin.rst \
doc/cluster-merge.rst \
+ doc/conf.py \
+ doc/css/style.css \
doc/design-2.0.rst \
doc/design-2.1.rst \
doc/design-2.2.rst \
@@ -505,43 +504,46 @@ docinput = \
doc/design-2.10.rst \
doc/design-autorepair.rst \
doc/design-bulk-create.rst \
+ doc/design-ceph-ganeti-support.rst \
doc/design-chained-jobs.rst \
+ doc/design-cmdlib-unittests.rst \
doc/design-cpu-pinning.rst \
+ doc/design-daemons.rst \
doc/design-device-uuid-name.rst \
doc/design-draft.rst \
- doc/design-hotplug.rst \
doc/design-glusterfs-ganeti-support.rst \
- doc/design-daemons.rst \
+ doc/design-hotplug.rst \
+ doc/design-hroller.rst \
+ doc/design-hsqueeze.rst \
doc/design-htools-2.3.rst \
doc/design-http-server.rst \
+ doc/design-hugepages-support.rst \
doc/design-impexp2.rst \
doc/design-internal-shutdown.rst \
- doc/design-lu-generated-jobs.rst \
doc/design-linuxha.rst \
+ doc/design-lu-generated-jobs.rst \
+ doc/design-monitoring-agent.rst \
doc/design-multi-reloc.rst \
- doc/design-multi-version-tests.rst \
+ doc/design-multi-version-tests.rst \
doc/design-network.rst \
doc/design-node-add.rst \
doc/design-oob.rst \
doc/design-openvswitch.rst \
- doc/design-ovf-support.rst \
doc/design-opportunistic-locking.rst \
doc/design-optables.rst \
+ doc/design-ovf-support.rst \
doc/design-partitioned.rst \
- doc/design-query-splitting.rst \
doc/design-query2.rst \
+ doc/design-query-splitting.rst \
doc/design-reason-trail.rst \
doc/design-resource-model.rst \
doc/design-restricted-commands.rst \
doc/design-shared-storage.rst \
- doc/design-monitoring-agent.rst \
+ doc/design-ssh-ports.rst \
+ doc/design-storagetypes.rst \
+ doc/design-upgrade.rst \
doc/design-virtual-clusters.rst \
doc/design-x509-ca.rst \
- doc/design-hroller.rst \
- doc/design-storagetypes.rst \
- doc/design-upgrade.rst \
- doc/design-hsqueeze.rst \
- doc/design-ssh-ports.rst \
doc/devnotes.rst \
doc/glossary.rst \
doc/hooks.rst \
@@ -599,9 +601,7 @@ HS_DEFAULT_PROGS = \
HS_ALL_PROGS = $(HS_DEFAULT_PROGS) $(HS_MYEXECLIB_PROGS)
-HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) \
- src/mon-collector.hs \
- src/hs2py-constants.hs
+HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) src/mon-collector.hs
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
HFLAGS = \
@@ -688,7 +688,6 @@ HS_LIB_SRCS = \
src/Ganeti/Hs2Py/GenConstants.hs \
src/Ganeti/Hs2Py/GenOpCodes.hs \
src/Ganeti/Hs2Py/OpDoc.hs \
- src/Ganeti/HsConstants.hs \
src/Ganeti/JQueue.hs \
src/Ganeti/JSON.hs \
src/Ganeti/Jobs.hs \
@@ -785,7 +784,6 @@ HS_BUILT_SRCS = \
test/hs/Test/Ganeti/TestImports.hs \
src/AutoConf.hs \
src/Ganeti/Hs2Py/ListConstants.hs \
- src/Ganeti/PyConstants.hs \
src/Ganeti/Curl/Internal.hs \
src/Ganeti/Version.hs
HS_BUILT_SRCS_IN = \
@@ -988,32 +986,6 @@ HFLAGS += $(if $(HPROFILE),-prof -auto-all,)
HFLAGS += $(if $(HCOVERAGE),-fhpc,)
HFLAGS += $(if $(HTEST),-DTEST,)
-HS2PY_CONSTANTS_SRCS = src/hs2py-constants.hs \
- src/AutoConf.hs \
- src/Ganeti/BasicTypes.hs \
- src/Ganeti/ConstantUtils.hs \
- src/Ganeti/JSON.hs \
- src/Ganeti/THH.hs \
- src/Ganeti/Hs2Py/GenConstants.hs \
- src/Ganeti/Hs2Py/ListConstants.hs \
- src/Ganeti/HsConstants.hs \
- src/Ganeti/PyValueInstances.hs
-
-# This target cannot be merged with the '$(HS_ALL_PROGS)' target
-# because 'hs2py-constants' cannot depend on 'Ganeti.Constants'. And
-# the reason for this is because 'hs2py-constants' needs to generate
-# Python code, and 'Ganeti.Constants' is generated by Python.
-.NOTPARALLEL: src/hs2py-constants
-.PHONY: src/hs2py-constants
-src/hs2py-constants: $(HS2PY_CONSTANTS_SRCS) \
- | stamp-srclinks
- @rm -f $@.tix
- $(GHC) --make $(HFLAGS) \
- -osuf $(HSUFFIX) \
- -hisuf $(patsubst %.o,%.hi,$(HSUFFIX)) \
- $(HEXTRA) \
- src/hs2py-constants.hs
-
HS_SRCS = $(HS_LIBTESTBUILT_SRCS)
.NOTPARALLEL: $(HS_ALL_PROGS)
@@ -1153,9 +1125,9 @@ EXTRA_DIST = \
autotools/check-python-code \
autotools/check-tar \
autotools/check-version \
- autotools/convert-constants \
autotools/docpp \
autotools/gen-py-coverage \
+ autotools/print-py-constants \
autotools/sphinx-wrapper \
autotools/testrunner \
autotools/wrong-hardcoded-paths \
@@ -1763,11 +1735,11 @@ src/Ganeti/Version.hs: src/Ganeti/Version.hs.in \
sed -e "s/%ver%/$$VCSVER/" < $< > $@
src/Ganeti/Hs2Py/ListConstants.hs: src/Ganeti/Hs2Py/ListConstants.hs.in \
- src/Ganeti/HsConstants.hs \
+ src/Ganeti/Constants.hs \
| stamp-directories
@echo Generating $@
@set -e; \
-## Extract constant names from 'HsConstants.hs' by extracting the left
+## Extract constant names from 'Constants.hs' by extracting the left
## side of all lines containing an equal sign (i.e., '=') and
## prepending the apostrophe sign (i.e., "'").
##
@@ -1775,20 +1747,10 @@ src/Ganeti/Hs2Py/ListConstants.hs: src/Ganeti/Hs2Py/ListConstants.hs.in \
## adminstDown = ...
## becomes
## 'adminstDown
- NAMES=$$(sed -e "/^--/ d" $(abs_top_srcdir)/src/Ganeti/HsConstants.hs |\
+ NAMES=$$(sed -e "/^--/ d" $(abs_top_srcdir)/src/Ganeti/Constants.hs |\
sed -n -e "/=/ s/\(.*\) =.*/ '\1:/g p"); \
m4 -DPY_CONSTANT_NAMES="$$NAMES" $(abs_top_srcdir)/$< > $@
-src/Ganeti/PyConstants.hs: src/Ganeti/PyConstants.hs.in \
- lib/constants.py lib/luxi.py lib/errors.py \
- lib/jstore.py $(RUN_IN_TEMPDIR) \
- $(CONVERT_CONSTANTS) $(built_base_sources) \
- | lib/_vcsversion.py
- set -e; \
- { cat $< ; \
- PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CONVERT_CONSTANTS); \
- } > $@
-
src/Ganeti/Curl/Internal.hs: src/Ganeti/Curl/Internal.hsc | stamp-directories
hsc2hs -o $@ $<
@@ -1802,14 +1764,14 @@ test/hs/Test/Ganeti/TestImports.hs: test/hs/Test/Ganeti/TestImports.hs.in \
done ; \
} > $@
-lib/_constants.py: Makefile lib/_constants.py.in src/hs2py-constants \
- | stamp-directories
+lib/_constants.py: Makefile src/hs2py lib/_constants.py.in | stamp-directories
cat $(abs_top_srcdir)/lib/_constants.py.in > $@
- src/hs2py-constants >> $@
+ src/hs2py --constants >> $@
lib/constants.py: lib/_constants.py
-src/AutoConf.hs: Makefile src/AutoConf.hs.in | stamp-directories
+src/AutoConf.hs: Makefile src/AutoConf.hs.in $(PRINT_PY_CONSTANTS) \
+ | $(built_base_sources)
@echo "m4 ... >" $@
@m4 -DPACKAGE_VERSION="$(PACKAGE_VERSION)" \
-DVERSION_MAJOR="$(VERSION_MAJOR)" \
@@ -1874,6 +1836,8 @@ src/AutoConf.hs: Makefile src/AutoConf.hs.in | stamp-directories
-DMAN_PAGES="$$(for i in $(notdir $(man_MANS)); do \
echo -n "$$i" | sed -re 's/^(.*)\.([0-9]+)$$/("\1",\2):/g'; \
done)" \
+ -DAF_INET4="$$(PYTHONPATH=. python $(PRINT_PY_CONSTANTS) AF_INET4)" \
+ -DAF_INET6="$$(PYTHONPATH=. python $(PRINT_PY_CONSTANTS) AF_INET6)" \
$(abs_top_srcdir)/src/AutoConf.hs.in > $@
lib/_vcsversion.py: Makefile vcs-version | stamp-directories
@@ -1897,11 +1861,10 @@ lib/_vcsversion.py: Makefile vcs-version | stamp-directories
echo "VCS_VERSION = '$$VCSVER'"; \
} > $@
-lib/opcodes.py: Makefile src/hs2py src/Ganeti/PyConstants.hs \
- lib/opcodes.py.in_before lib/opcodes.py.in_after \
- | stamp-directories
+lib/opcodes.py: Makefile src/hs2py lib/opcodes.py.in_before \
+ lib/opcodes.py.in_after | stamp-directories
cat $(abs_top_srcdir)/lib/opcodes.py.in_before > $@
- src/hs2py >> $@
+ src/hs2py --opcodes >> $@
cat $(abs_top_srcdir)/lib/opcodes.py.in_after >> $@
lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
diff --git a/NEWS b/NEWS
index 501060621dfeae9c78ad3ff0cc6facd13d76b0fe..361c0daddb63d99ef685d02b7ab1a72c808e86c4 100644
--- a/NEWS
+++ b/NEWS
@@ -76,7 +76,7 @@ Misc changes
- Opcodes are entirely generated from Haskell using the tool 'hs2py' and
the module 'src/Ganeti/OpCodes.hs'.
- Constants are also generated from Haskell using the tool
- 'hs2py-constants' and the module 'src/Ganeti/HsConstants.hs', with the
+ 'hs2py-constants' and the module 'src/Ganeti/Constants.hs', with the
exception of socket related constants, which require changing the
cluster configuration file, and HVS related constants, because they
are part of a port of instance queries to Haskell. As a result, these
@@ -93,6 +93,18 @@ Python
version 1.0.1. It is still used for testing only.
+Version 2.9.1
+-------------
+
+*(Released Wed, 13 Nov 2013)*
+
+- fix bug, that kept nodes offline when readding
+- when verifying DRBD versions, ignore unavailable nodes
+- fix bug that made the console unavailable on kvm in split-user
+ setup (issue 608)
+- DRBD: ensure peers are UpToDate for dual-primary (inherited 2.8.2)
+
+
Version 2.9.0
-------------
@@ -216,6 +228,17 @@ This was the first beta release of the 2.9 series. All important changes
are listed in the latest 2.9 entry.
+Version 2.8.2
+-------------
+
+*(Released Thu, 07 Nov 2013)*
+
+- DRBD: ensure peers are UpToDate for dual-primary
+- Improve error message for replace-disks
+- More dependency checks at configure time
+- Placate warnings on ganeti.outils_unittest.py
+
+
Version 2.8.1
-------------
diff --git a/autotools/convert-constants b/autotools/convert-constants
deleted file mode 100755
index 421d3d4efba8539490c81b43c477d83dafb5ed2a..0000000000000000000000000000000000000000
--- a/autotools/convert-constants
+++ /dev/null
@@ -1,313 +0,0 @@
-#!/usr/bin/python
-#
-
-# Copyright (C) 2011, 2012, 2013 Google Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-"""Script for converting Python constants to Haskell code fragments.
-
-"""
-
-import re
-import types
-
-from ganeti import _constants
-from ganeti import compat
-from ganeti import constants
-from ganeti import errors
-from ganeti import luxi
-from ganeti import qlang
-from ganeti import jstore
-
-
-#: Constant name regex
-CONSTANT_RE = re.compile("^[A-Z][A-Z0-9_-]+$")
-
-#: Private name regex
-PRIVATE_RE = re.compile("^__.+__$")
-
-#: The type of regex objects
-RE_TYPE = type(CONSTANT_RE)
-
-#: Keys which do not declare a value (manually maintained). By adding
-# values here, we can make more lists use the actual names; otherwise
-# we'll have (e.g.) both DEFAULT_ENABLED_HYPERVISOR and HT_XEN_PVM
-# declare the same value, and thus the list of valid hypervisors will
-# have strings instead of easily looked-up names.
-IGNORED_DECL_NAMES = ["DEFAULT_ENABLED_HYPERVISOR"]
-
-
-def NameRules(name):
- """Converts the upper-cased Python name to Haskell camelCase.
-
- """
- name = name.replace("-", "_")
- elems = name.split("_")
- return elems[0].lower() + "".join(e.capitalize() for e in elems[1:])
-
-
-def StringValueRules(value):
- """Converts a string value from Python to Haskell.
-
- """
- value = value.encode("string_escape") # escapes backslashes
- value = value.replace("\"", "\\\"")
- return value
-
-
-def DictKeyName(dict_name, key_name):
- """Converts a dict plus key name to a full name.
-
- """
- return"%s_%s" % (dict_name, str(key_name).upper())
-
-
-def HaskellTypeVal(value):
- """Returns the Haskell type and value for a Python value.
-
- Note that this only work for 'plain' Python types.
-
- @returns: (string, string) or None, if we can't determine the type.
-
- """
- if isinstance(value, basestring):
- return ("String", "\"%s\"" % StringValueRules(value))
- elif isinstance(value, bool):
- return ("Bool", "%s" % value)
- elif isinstance(value, int):
- return ("Int", "%d" % value)
- elif isinstance(value, long):
- return ("Integer", "%d" % value)
- elif isinstance(value, float):
- return ("Double", "%f" % value)
- else:
- return None
-
-
-def IdentifyOrigin(all_items, value):
- """Tries to identify a constant name from a constant's value.
-
- This uses a simple algorithm: is there a constant (and only one)
- with the same value? If so, then it returns that constants' name.
-
- @note: it is recommended to use this only for tuples/lists/sets, and
- not for individual (top-level) values
- @param all_items: a dictionary of name/values for the current module
- @param value: the value for which we try to find an origin
-
- """
- found = [name for (name, v) in all_items.items()
- if v is value and name not in IGNORED_DECL_NAMES]
- if len(found) == 1:
- return found[0]
- else:
- return None
-
-
-def FormatListElems(all_items, pfx_name, ovals, tvals):
- """Formats a list's elements.
-
- This formats the elements as either values or, if we find all
- origins, as names.
-
- @param all_items: a dictionary of name/values for the current module
- @param pfx_name: the prefix name currently used
- @param ovals: the list of actual (Python) values
- @param tvals: the list of values we want to format in the Haskell form
-
- """
- origins = [IdentifyOrigin(all_items, v) for v in ovals]
- if compat.all(x is not None for x in origins):
- values = [NameRules(pfx_name + origin) for origin in origins]
- else:
- values = tvals
- return ", ".join(values)
-
-
-def FormatDict(all_items, pfx_name, py_name, hs_name, mydict):
- """Converts a dictionary to a Haskell association list ([(k, v)]),
- if possible.
-
- @param all_items: a dictionary of name/values for the current module
- @param pfx_name: the prefix name currently used
- @param py_name: the Python name
- @param hs_name: the Haskell name
- @param mydict: a dictonary, unknown yet if homogenous or not
-
- """
- # need this for ordering
- orig_list = mydict.items()
- list_form = [(HaskellTypeVal(k), HaskellTypeVal(v)) for k, v in orig_list]
- if compat.any(v is None or k is None for k, v in list_form):
- # type not known
- return []
- all_keys = [k for k, _ in list_form]
- all_vals = [v for _, v in list_form]
- key_types = set(k[0] for k in all_keys)
- val_types = set(v[0] for v in all_vals)
- if not(len(key_types) == 1 and len(val_types) == 1):
- # multiple types
- return []
- # record the key and value Haskell types
- key_type = key_types.pop()
- val_type = val_types.pop()
-
- # now try to find names for the keys, instead of raw values
- key_origins = [IdentifyOrigin(all_items, k) for k, _ in orig_list]
- if compat.all(x is not None for x in key_origins):
- key_v = [NameRules(pfx_name + origin) for origin in key_origins]
- else:
- key_v = [k[1] for k in all_keys]
- # ... and for values
- val_origins = [IdentifyOrigin(all_items, v) for _, v in orig_list]
- if compat.all(x is not None for x in val_origins):
- val_v = [NameRules(pfx_name + origin) for origin in val_origins]
- else:
- val_v = [v[1] for v in all_vals]
-
- # finally generate the output
- kv_pairs = ["(%s, %s)" % (k, v) for k, v in zip(key_v, val_v)]
- return ["-- | Converted from Python dictionary @%s@" % py_name,
- "%s :: [(%s, %s)]" % (hs_name, key_type, val_type),
- "%s = [%s]" % (hs_name, ", ".join(kv_pairs)),
- ]
-
-
-def ConvertVariable(prefix, name, value, all_items):
- """Converts a given variable to Haskell code.
-
- @param prefix: a prefix for the Haskell name (useful for module
- identification)
- @param name: the Python name
- @param value: the value
- @param all_items: a dictionary of name/value for the module being
- processed
- @return: a list of Haskell code lines
-
- """
- lines = []
- if prefix:
- pfx_name = prefix + "_"
- fqn = prefix + "." + name
- else:
- pfx_name = ""
- fqn = name
- hs_name = NameRules(pfx_name + name)
- hs_typeval = HaskellTypeVal(value)
- if (isinstance(value, types.ModuleType) or callable(value) or
- PRIVATE_RE.match(name)):
- # no sense in marking these, as we don't _want_ to convert them; the
- # message in the next if block is for datatypes we don't _know_
- # (yet) how to convert
- pass
- elif not CONSTANT_RE.match(name):
- lines.append("-- Skipped %s %s, not constant" % (fqn, type(value)))
- elif hs_typeval is not None:
- # this is a simple value
- (hs_type, hs_val) = hs_typeval
- lines.append("-- | Converted from Python constant @%s@" % fqn)
- lines.append("%s :: %s" % (hs_name, hs_type))
- lines.append("%s = %s" % (hs_name, hs_val))
- elif isinstance(value, dict):
- if value:
- lines.append("-- Following lines come from dictionary %s" % fqn)
- # try to build a real map here, if all keys have same type, and
- # all values too (i.e. we have a homogeneous dictionary)
- lines.extend(FormatDict(all_items, pfx_name, fqn, hs_name, value))
- # and now create individual names
- for k in sorted(value.keys()):
- lines.extend(ConvertVariable(prefix, DictKeyName(name, k),
- value[k], all_items))
- elif isinstance(value, tuple):
- tvs = [HaskellTypeVal(elem) for elem in value]
- # Custom rule for special cluster verify error tuples
- if name.startswith("CV_E") and len(value) == 3 and tvs[1][0] is not None:
- cv_ename = hs_name + "Code"
- lines.append("-- | Special cluster verify code %s" % name)
- lines.append("%s :: %s" % (cv_ename, tvs[1][0]))
- lines.append("%s = %s" % (cv_ename, tvs[1][1]))
- lines.append("")
- if compat.all(e is not None for e in tvs):
- ttypes = ", ".join(e[0] for e in tvs)
- tvals = FormatListElems(all_items, pfx_name, value, [e[1] for e in tvs])
- lines.append("-- | Converted from Python tuple @%s@" % fqn)
- lines.append("%s :: (%s)" % (hs_name, ttypes))
- lines.append("%s = (%s)" % (hs_name, tvals))
- else:
- lines.append("-- Skipped tuple %s, cannot convert all elements" % fqn)
- elif isinstance(value, (list, set, frozenset)):
- # Lists and frozensets are handled the same in Haskell: as lists,
- # since lists are immutable and we don't need for constants the
- # high-speed of an actual Set type. However, we can only convert
- # them if they have the same type for all elements (which is a
- # normal expectation for constants, our code should be well
- # behaved); note that this is different from the tuples case,
- # where we always (for some values of always) can convert
- tvs = [HaskellTypeVal(elem) for elem in value]
- if compat.all(e is not None for e in tvs):
- ttypes, tvals = zip(*tvs)
- uniq_types = set(ttypes)
- if len(uniq_types) == 1:
- values = FormatListElems(all_items, pfx_name, value, tvals)
- lines.append("-- | Converted from Python list or set @%s@" % fqn)
- lines.append("%s :: [%s]" % (hs_name, uniq_types.pop()))
- lines.append("%s = [%s]" % (hs_name, values))
- else:
- lines.append("-- | Skipped list/set %s, is not homogeneous" % fqn)
- else:
- lines.append("-- | Skipped list/set %s, cannot convert all elems" % fqn)
- elif isinstance(value, RE_TYPE):
- tvs = HaskellTypeVal(value.pattern)
- assert tvs is not None
- lines.append("-- | Converted from Python RE object @%s@" % fqn)
- lines.append("%s :: %s" % (hs_name, tvs[0]))
- lines.append("%s = %s" % (hs_name, tvs[1]))
- else:
- lines.append("-- Skipped %s, %s not handled" % (fqn, type(value)))
- return lines
-
-
-def Convert(module, prefix):
- """Converts the constants to Haskell.
-
- """
- lines = [""]
-
- all_items = dict((name, getattr(module, name))
- for name in dir(module)
- if name not in dir(_constants))
-
- for name in sorted(all_items.keys()):
- value = all_items[name]
- new_lines = ConvertVariable(prefix, name, value, all_items)
- if new_lines:
- lines.extend(new_lines)
- lines.append("")
-
- return "\n".join(lines)
-
-
-def main():
- print Convert(constants, "")
- print Convert(luxi, "luxi")
- print Convert(qlang, "qlang")
- print Convert(errors, "errors")
- print Convert(jstore, "jstore")
-
-
-if __name__ == "__main__":
- main()
diff --git a/autotools/print-py-constants b/autotools/print-py-constants
new file mode 100755
index 0000000000000000000000000000000000000000..5c959cea72344c007e19f146ce283b81f8da2d6a
--- /dev/null
+++ b/autotools/print-py-constants
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+#
+
+# Copyright (C) 2013 Google Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+"""Script for printing Python constants related to sockets.
+
+These constants are the remnants of the Haskell to Python constant
+generation. This solution is transitional until Ganeti 2.11 because
+the solution for eliminating completely the Python to Haskell
+conversion requires updating the configuration file.
+
+"""
+
+import socket
+import sys
+
+
+def main():
+ if len(sys.argv) > 1:
+ if sys.argv[1] == "AF_INET4":
+ print "%s" % socket.AF_INET
+ elif sys.argv[1] == "AF_INET6":
+ print "%s" % socket.AF_INET6
+
+
+if __name__ == "__main__":
+ main()
diff --git a/doc/rapi.rst b/doc/rapi.rst
index 3bab0f700414d647c647d6bdec9a74fcf26824ad..c206a63bc744ddcf13b817f147b32e061adacbe6 100644
--- a/doc/rapi.rst
+++ b/doc/rapi.rst
@@ -2109,18 +2109,17 @@ Manages storage units on the node.
``GET``
~~~~~~~
-FIXME: enable ".. pyassert::" again when all storage types are
-implemented::
+.. pyassert::
- constants.STORAGE_TYPES == set([constants.ST_FILE,
- constants.ST_LVM_PV,
- constants.ST_LVM_VG])
+ constants.STS_REPORT == set([constants.ST_FILE,
+ constants.ST_LVM_PV,
+ constants.ST_LVM_VG])
Requests a list of storage units on a node. Requires the parameters
-``storage_type`` (one of :pyeval:`constants.ST_FILE`,
-:pyeval:`constants.ST_LVM_PV` or :pyeval:`constants.ST_LVM_VG`) and
-``output_fields``. The result will be a job id, using which the result
-can be retrieved.
+``storage_type`` for storage types that support space reporting
+(one of :pyeval:`constants.ST_FILE`, :pyeval:`constants.ST_LVM_PV`
+or :pyeval:`constants.ST_LVM_VG`) and ``output_fields``. The result
+will be a job id, using which the result can be retrieved.
.. _rapi-res-nodes-node_name-storage-modify:
diff --git a/lib/backend.py b/lib/backend.py
index 75804a92e490fcffad7b7a201fac44ae9d7e9208..8f2c6f7af6008b7cb54f77441f3dbb094b658dd7 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -4033,8 +4033,20 @@ def DrbdAttachNet(disks, instance_name, multimaster):
for rd in bdevs:
stats = rd.GetProcStatus()
- all_connected = (all_connected and
- (stats.is_connected or stats.is_in_resync))
+ if multimaster:
+ # In the multimaster case we have to wait explicitly until
+ # the resource is Connected and UpToDate/UpToDate, because
+ # we promote *both nodes* to primary directly afterwards.
+ # Being in resync is not enough, since there is a race during which we
+ # may promote a node with an Outdated disk to primary, effectively
+ # tearing down the connection.
+ all_connected = (all_connected and
+ stats.is_connected and
+ stats.is_disk_uptodate and
+ stats.peer_disk_uptodate)
+ else:
+ all_connected = (all_connected and
+ (stats.is_connected or stats.is_in_resync))
if stats.is_standalone:
# peer had different config info and this node became
diff --git a/lib/bootstrap.py b/lib/bootstrap.py
index 070562b0913d50a912629e95904101d60fb494f1..f039157d2dff334ff8a268ff822728f5e08b3e65 100644
--- a/lib/bootstrap.py
+++ b/lib/bootstrap.py
@@ -621,7 +621,7 @@ def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913, R0914
raise errors.OpPrereqError("Invalid mac prefix given '%s'" % mac_prefix,
errors.ECODE_INVAL)
- if not nicparams.get('mode', None) == "openvswitch":
+ if not nicparams.get('mode', None) == constants.NIC_MODE_OVS:
# Do not do this check if mode=openvswitch, since the openvswitch is not
# created yet
result = utils.RunCmd(["ip", "link", "show", "dev", master_netdev])
diff --git a/lib/client/gnt_node.py b/lib/client/gnt_node.py
index 7a949805c8ee14da3f42dd9bfc353f1d4e9f71f3..4e20117b2b56e9f9c660b5d69e2a1f2c9f520ad3 100644
--- a/lib/client/gnt_node.py
+++ b/lib/client/gnt_node.py
@@ -123,18 +123,6 @@ IGNORE_STATUS_OPT = cli_option("--ignore-status", default=False,
help=("Ignore the Node(s) offline status"
" (potentially DANGEROUS)"))
-OVS_OPT = cli_option("--ovs", default=False, action="store_true", dest="ovs",
- help=("Enable OpenvSwitch on the new node. This will"
- " initialize OpenvSwitch during gnt-node add"))
-
-OVS_NAME_OPT = cli_option("--ovs-name", action="store", dest="ovs_name",
- type="string", default=None,
- help=("Set name of OpenvSwitch to connect instances"))
-
-OVS_LINK_OPT = cli_option("--ovs-link", action="store", dest="ovs_link",
- type="string", default=None,
- help=("Physical trunk interface for OpenvSwitch"))
-
def ConvertStorageType(user_storage_type):
"""Converts a user storage type to its internal name.
@@ -305,19 +293,9 @@ def AddNode(opts, args):
hv_state = dict(opts.hv_state)
- if not opts.ndparams:
- ndparams = {constants.ND_OVS: opts.ovs,
- constants.ND_OVS_NAME: opts.ovs_name,
- constants.ND_OVS_LINK: opts.ovs_link}
- else:
- ndparams = opts.ndparams
- ndparams[constants.ND_OVS] = opts.ovs
- ndparams[constants.ND_OVS_NAME] = opts.ovs_name
- ndparams[constants.ND_OVS_LINK] = opts.ovs_link
-
op = opcodes.OpNodeAdd(node_name=args[0], secondary_ip=sip,
readd=opts.readd, group=opts.nodegroup,
- vm_capable=opts.vm_capable, ndparams=ndparams,
+ vm_capable=opts.vm_capable, ndparams=opts.ndparams,
master_capable=opts.master_capable,
disk_state=disk_state,
hv_state=hv_state)
@@ -1111,12 +1089,11 @@ commands = {
"add": (
AddNode, [ArgHost(min=1, max=1)],
[SECONDARY_IP_OPT, READD_OPT, NOSSH_KEYCHECK_OPT, NODE_FORCE_JOIN_OPT,
- NONODE_SETUP_OPT, VERBOSE_OPT, OVS_OPT, OVS_NAME_OPT, OVS_LINK_OPT,
- NODEGROUP_OPT, PRIORITY_OPT, CAPAB_MASTER_OPT, CAPAB_VM_OPT,
- NODE_PARAMS_OPT, HV_STATE_OPT, DISK_STATE_OPT],
+ NONODE_SETUP_OPT, VERBOSE_OPT, NODEGROUP_OPT, PRIORITY_OPT,
+ CAPAB_MASTER_OPT, CAPAB_VM_OPT, NODE_PARAMS_OPT, HV_STATE_OPT,
+ DISK_STATE_OPT],
"[-s ip] [--readd] [--no-ssh-key-check] [--force-join]"
- " [--no-node-setup] [--verbose] [--network] [--ovs] [--ovs-name <vswitch>]"
- " [--ovs-link <phys. if>] <node_name>",
+ " [--no-node-setup] [--verbose] [--network] <node_name>",
"Add a node to the cluster"),
"evacuate": (
EvacuateNode, ARGS_ONE_NODE,
diff --git a/lib/cmdlib/cluster.py b/lib/cmdlib/cluster.py
index 1f10eca7d532f2e5da60abc780d30904ca57ce78..ef9a58c3520a67c21697d43e9bbba3055d005d13 100644
--- a/lib/cmdlib/cluster.py
+++ b/lib/cmdlib/cluster.py
@@ -196,14 +196,6 @@ class LUClusterPostInit(LogicalUnit):
" OpenvSwitch will not have an outside connection. This"
" might not be what you want.")
- # OpenvSwitch: Warn if parameters are given, but OVS is not enabled.
- if (not self.master_ndparams[constants.ND_OVS] and
- (self.master_ndparams[constants.ND_OVS_NAME] or
- self.master_ndparams.get(constants.ND_OVS_LINK, None))):
- self.LogInfo("OpenvSwitch name or link were given, but"
- " OpenvSwitch is not enabled. Please enable"
- " OpenvSwitch with 'ovs=true' or create it manually")
-
def BuildHooksEnv(self):
"""Build hooks env.
@@ -1936,8 +1928,9 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
node_versions = {}
for node_uuid, ndata in node_verify_infos.items():
nresult = ndata.payload
- version = nresult.get(constants.NV_DRBDVERSION, "Missing DRBD version")
- node_versions[node_uuid] = version
+ if nresult:
+ version = nresult.get(constants.NV_DRBDVERSION, "Missing DRBD version")
+ node_versions[node_uuid] = version
if len(set(node_versions.values())) > 1:
for node_uuid, version in sorted(node_versions.items()):
diff --git a/lib/cmdlib/instance.py b/lib/cmdlib/instance.py
index 5069b9d32e56568b151f23f4cc1ed577d44ea6b0..9117f8c1ba22cd9c48a6c47d1d28d103fa784031 100644
--- a/lib/cmdlib/instance.py
+++ b/lib/cmdlib/instance.py
@@ -183,10 +183,6 @@ def _ComputeNics(op, cluster, default_ip, cfg, ec_id):
" is allowed to be passed",
errors.ECODE_INVAL)
- if vlan is not None and nic_mode != constants.NIC_MODE_OVS:
- raise errors.OpPrereqError("VLAN is given, but network mode is not"
- " openvswitch", errors.ECODE_INVAL)
-
# ip validity checks
if ip is None or ip.lower() == constants.VALUE_NONE:
nic_ip = None
diff --git a/lib/cmdlib/instance_operation.py b/lib/cmdlib/instance_operation.py
index a99ef970c8182ce3c87cdff89b87454ba3ae0178..0f3599b67b0656c16fe0911fb5eb512b6eda3504 100644
--- a/lib/cmdlib/instance_operation.py
+++ b/lib/cmdlib/instance_operation.py
@@ -440,7 +440,7 @@ def GetInstanceConsole(cluster, instance, primary_node, node_group):
@rtype: dict
"""
- hyper = hypervisor.GetHypervisor(instance.hypervisor)
+ hyper = hypervisor.GetHypervisorClass(instance.hypervisor)
# beparams and hvparams are passed separately, to avoid editing the
# instance and then saving the defaults in the instance itself.
hvparams = cluster.FillHV(instance)
diff --git a/lib/cmdlib/node.py b/lib/cmdlib/node.py
index fc1aa8f82b6d6622d963389f87d348a3d99bbf34..ea9bae5406b03b285ce7883c4de05ee3cafae6f3 100644
--- a/lib/cmdlib/node.py
+++ b/lib/cmdlib/node.py
@@ -112,23 +112,6 @@ class LUNodeAdd(LogicalUnit):
raise errors.OpPrereqError("Cannot pass a node group when a node is"
" being readded", errors.ECODE_INVAL)
- if self.op.ndparams:
- ovs = self.op.ndparams.get(constants.ND_OVS, None)
- ovs_name = self.op.ndparams.get(constants.ND_OVS_NAME, None)
- ovs_link = self.op.ndparams.get(constants.ND_OVS_LINK, None)
-
- # OpenvSwitch: Warn user if link is missing
- if ovs and not ovs_link:
- self.LogInfo("No physical interface for OpenvSwitch was given."
- " OpenvSwitch will not have an outside connection. This"
- " might not be what you want.")
- # OpenvSwitch: Fail if parameters are given, but OVS is not enabled.
- if not ovs and (ovs_name or ovs_link):
- raise errors.OpPrereqError("OpenvSwitch name or link were given, but"
- " OpenvSwitch is not enabled. Please enable"
- " OpenvSwitch with --ovs",
- errors.ECODE_INVAL)
-
def BuildHooksEnv(self):
"""Build hooks env.
@@ -323,6 +306,24 @@ class LUNodeAdd(LogicalUnit):
raise errors.OpPrereqError("Checks on node PVs failed: %s" %
"; ".join(errmsgs), errors.ECODE_ENVIRON)
+ def _InitOpenVSwitch(self):
+ filled_ndparams = self.cfg.GetClusterInfo().FillND(
+ self.new_node, self.cfg.GetNodeGroup(self.new_node.group))
+
+ ovs = filled_ndparams.get(constants.ND_OVS, None)
+ ovs_name = filled_ndparams.get(constants.ND_OVS_NAME, None)
+ ovs_link = filled_ndparams.get(constants.ND_OVS_LINK, None)
+
+ if ovs:
+ if not ovs_link:
+ self.LogInfo("No physical interface for OpenvSwitch was given."
+ " OpenvSwitch will not have an outside connection. This"
+ " might not be what you want.")
+
+ result = self.rpc.call_node_configure_ovs(
+ self.new_node.name, ovs_name, ovs_link)
+ result.Raise("Failed to initialize OpenVSwitch on new node")
+
def Exec(self, feedback_fn):
"""Adds the new node to the cluster.
@@ -338,6 +339,7 @@ class LUNodeAdd(LogicalUnit):
# later in the procedure; this also means that if the re-add
# fails, we are left with a non-offlined, broken node
if self.op.readd:
+ self.new_node.offline = False
self.new_node.drained = False
self.LogInfo("Readding a node, the offline/drained flags were reset")
# if we demote the node, we do cleanup later in the procedure
@@ -399,14 +401,7 @@ class LUNodeAdd(LogicalUnit):
(verifier, nl_payload[failed]))
raise errors.OpExecError("ssh/hostname verification failed")
- # OpenvSwitch initialization on the node
- ovs = self.new_node.ndparams.get(constants.ND_OVS, None)
- ovs_name = self.new_node.ndparams.get(constants.ND_OVS_NAME, None)
- ovs_link = self.new_node.ndparams.get(constants.ND_OVS_LINK, None)
-
- if ovs:
- result = self.rpc.call_node_configure_ovs(
- self.new_node.name, ovs_name, ovs_link)
+ self._InitOpenVSwitch()
if self.op.readd:
self.context.ReaddNode(self.new_node)
diff --git a/lib/constants.py b/lib/constants.py
index fb77d5ded969bffc986aae005e27e886bb1c01fa..4fa126b9cc71d30fc48196737e0aa6d610797eda 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -64,10 +64,6 @@ IE_MAGIC_RE = re.compile(r"^[-_.a-zA-Z0-9]{5,100}$")
# External script validation mask
EXT_PLUGIN_MASK = re.compile("^[a-zA-Z0-9_-]+$")
-# for export to htools
-IP4_FAMILY = socket.AF_INET
-IP6_FAMILY = socket.AF_INET6
-
JOB_ID_TEMPLATE = r"\d+"
JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
@@ -78,8 +74,5 @@ JOB_FILE_RE = re.compile(r"^job-(%s)$" % JOB_ID_TEMPLATE)
# might be different at runtime).
HVC_DEFAULTS[HT_XEN_HVM][HV_VNC_PASSWORD_FILE] = pathutils.VNC_PASSWORD_FILE
-# Regex string for verifying a UUID
-UUID_REGEX = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
-
# Do not re-export imported modules
del re, socket, pathutils, compat
diff --git a/lib/errors.py b/lib/errors.py
index f205f4a6dabf70651adbcea3825ff6e8ddf4908e..4cf35e17864099544a8780996bbe918f25f48752 100644
--- a/lib/errors.py
+++ b/lib/errors.py
@@ -23,54 +23,20 @@
"""
-from ganeti import compat
-
-
-# OpPrereqError failure types
-
-#: Resolver errors
-ECODE_RESOLVER = "resolver_error"
-
-#: Not enough resources (iallocator failure, disk space, memory, etc.)
-ECODE_NORES = "insufficient_resources"
-
-#: Temporarily out of resources; operation can be tried again
-ECODE_TEMP_NORES = "temp_insufficient_resources"
-
-#: Wrong arguments (at syntax level)
-ECODE_INVAL = "wrong_input"
-
-#: Wrong entity state
-ECODE_STATE = "wrong_state"
-
-#: Entity not found
-ECODE_NOENT = "unknown_entity"
-
-#: Entity already exists
-ECODE_EXISTS = "already_exists"
-
-#: Resource not unique (e.g. MAC or IP duplication)
-ECODE_NOTUNIQUE = "resource_not_unique"
-
-#: Internal cluster error
-ECODE_FAULT = "internal_error"
-
-#: Environment error (e.g. node disk error)
-ECODE_ENVIRON = "environment_error"
-
-#: List of all failure types
-ECODE_ALL = compat.UniqueFrozenset([
- ECODE_RESOLVER,
- ECODE_NORES,
- ECODE_TEMP_NORES,
- ECODE_INVAL,
- ECODE_STATE,
- ECODE_NOENT,
- ECODE_EXISTS,
- ECODE_NOTUNIQUE,
- ECODE_FAULT,
- ECODE_ENVIRON,
- ])
+from ganeti import constants
+
+
+ECODE_RESOLVER = constants.ERRORS_ECODE_RESOLVER
+ECODE_NORES = constants.ERRORS_ECODE_NORES
+ECODE_TEMP_NORES = constants.ERRORS_ECODE_TEMP_NORES
+ECODE_INVAL = constants.ERRORS_ECODE_INVAL
+ECODE_STATE = constants.ERRORS_ECODE_STATE
+ECODE_NOENT = constants.ERRORS_ECODE_NOENT
+ECODE_EXISTS = constants.ERRORS_ECODE_EXISTS
+ECODE_NOTUNIQUE = constants.ERRORS_ECODE_NOTUNIQUE
+ECODE_FAULT = constants.ERRORS_ECODE_FAULT
+ECODE_ENVIRON = constants.ERRORS_ECODE_ENVIRON
+ECODE_ALL = constants.ERRORS_ECODE_ALL
class GenericError(Exception):
diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py
index 3c4dae9d1b2af60cedcffc110b880740a1baa6f5..cad68475ff2fc1f4a4054f2cf68fe8a27c05faaf 100644
--- a/lib/hypervisor/hv_xen.py
+++ b/lib/hypervisor/hv_xen.py
@@ -397,6 +397,19 @@ class XenHypervisor(hv_base.BaseHypervisor):
self._cmd = _cmd
+ @staticmethod
+ def _GetCommandFromHvparams(hvparams):
+ """Returns the Xen command extracted from the given hvparams.
+
+ @type hvparams: dict of strings
+ @param hvparams: hypervisor parameters
+
+ """
+ if hvparams is None or constants.HV_XEN_CMD not in hvparams:
+ raise errors.HypervisorError("Cannot determine xen command.")
+ else:
+ return hvparams[constants.HV_XEN_CMD]
+
def _GetCommand(self, hvparams):
"""Returns Xen command to use.
@@ -405,10 +418,7 @@ class XenHypervisor(hv_base.BaseHypervisor):
"""
if self._cmd is None:
- if hvparams is None or constants.HV_XEN_CMD not in hvparams:
- raise errors.HypervisorError("Cannot determine xen command.")
- else:
- cmd = hvparams[constants.HV_XEN_CMD]
+ cmd = XenHypervisor._GetCommandFromHvparams(hvparams)
else:
cmd = self._cmd
@@ -772,12 +782,13 @@ class XenHypervisor(hv_base.BaseHypervisor):
instance_list = self._GetInstanceList(True, hvparams)
return _GetNodeInfo(result.stdout, instance_list)
- def GetInstanceConsole(self, instance, primary_node, node_group,
+ @classmethod
+ def GetInstanceConsole(cls, instance, primary_node, node_group,
hvparams, beparams):
"""Return a command for connecting to the console of an instance.
"""
- xen_cmd = self._GetCommand(hvparams)
+ xen_cmd = XenHypervisor._GetCommandFromHvparams(hvparams)
ndparams = node_group.FillND(primary_node)
return objects.InstanceConsole(instance=instance.name,
kind=constants.CONS_SSH,
diff --git a/lib/jstore.py b/lib/jstore.py
index 324f91e1fcefcf343a4f4f2402b17a6861abc24a..c1630b94c7e0a4940e75964f8eafd98d9a8dd503 100644
--- a/lib/jstore.py
+++ b/lib/jstore.py
@@ -31,7 +31,7 @@ from ganeti import utils
from ganeti import pathutils
-JOBS_PER_ARCHIVE_DIRECTORY = 10000
+JOBS_PER_ARCHIVE_DIRECTORY = constants.JSTORE_JOBS_PER_ARCHIVE_DIRECTORY
def _ReadNumericFile(file_name):
diff --git a/lib/luxi.py b/lib/luxi.py
index ba974693edfbb34f1788f178b38cbbb28b08b4c0..b099d86d65678dcd89b75f099cde39c452b23261 100644
--- a/lib/luxi.py
+++ b/lib/luxi.py
@@ -35,7 +35,6 @@ import time
import errno
import logging
-from ganeti import compat
from ganeti import serializer
from ganeti import constants
from ganeti import errors
@@ -44,66 +43,39 @@ from ganeti import objects
from ganeti import pathutils
-KEY_METHOD = "method"
-KEY_ARGS = "args"
-KEY_SUCCESS = "success"
-KEY_RESULT = "result"
-KEY_VERSION = "version"
-
-REQ_SUBMIT_JOB = "SubmitJob"
-REQ_SUBMIT_JOB_TO_DRAINED_QUEUE = "SubmitJobToDrainedQueue"
-REQ_SUBMIT_MANY_JOBS = "SubmitManyJobs"
-REQ_PICKUP_JOB = "PickupJob"
-REQ_WAIT_FOR_JOB_CHANGE = "WaitForJobChange"
-REQ_CANCEL_JOB = "CancelJob"
-REQ_ARCHIVE_JOB = "ArchiveJob"
-REQ_CHANGE_JOB_PRIORITY = "ChangeJobPriority"
-REQ_AUTO_ARCHIVE_JOBS = "AutoArchiveJobs"
-REQ_QUERY = "Query"
-REQ_QUERY_FIELDS = "QueryFields"
-REQ_QUERY_JOBS = "QueryJobs"
-REQ_QUERY_INSTANCES = "QueryInstances"
-REQ_QUERY_NODES = "QueryNodes"
-REQ_QUERY_GROUPS = "QueryGroups"
-REQ_QUERY_NETWORKS = "QueryNetworks"
-REQ_QUERY_EXPORTS = "QueryExports"
-REQ_QUERY_CONFIG_VALUES = "QueryConfigValues"
-REQ_QUERY_CLUSTER_INFO = "QueryClusterInfo"
-REQ_QUERY_TAGS = "QueryTags"
-REQ_SET_DRAIN_FLAG = "SetDrainFlag"
-REQ_SET_WATCHER_PAUSE = "SetWatcherPause"
-
-#: List of all LUXI requests
-REQ_ALL = compat.UniqueFrozenset([
- REQ_ARCHIVE_JOB,
- REQ_AUTO_ARCHIVE_JOBS,
- REQ_CANCEL_JOB,
- REQ_CHANGE_JOB_PRIORITY,
- REQ_PICKUP_JOB,
- REQ_QUERY,
- REQ_QUERY_CLUSTER_INFO,
- REQ_QUERY_CONFIG_VALUES,
- REQ_QUERY_EXPORTS,
- REQ_QUERY_FIELDS,
- REQ_QUERY_GROUPS,
- REQ_QUERY_INSTANCES,
- REQ_QUERY_JOBS,
- REQ_QUERY_NODES,
- REQ_QUERY_NETWORKS,
- REQ_QUERY_TAGS,
- REQ_SET_DRAIN_FLAG,
- REQ_SET_WATCHER_PAUSE,
- REQ_SUBMIT_JOB,
- REQ_SUBMIT_JOB_TO_DRAINED_QUEUE,
- REQ_SUBMIT_MANY_JOBS,
- REQ_WAIT_FOR_JOB_CHANGE,
- ])
-
-DEF_CTMO = 10
-DEF_RWTO = 60
-
-# WaitForJobChange timeout
-WFJC_TIMEOUT = (DEF_RWTO - 1) / 2
+KEY_METHOD = constants.LUXI_KEY_METHOD
+KEY_ARGS = constants.LUXI_KEY_ARGS
+KEY_SUCCESS = constants.LUXI_KEY_SUCCESS
+KEY_RESULT = constants.LUXI_KEY_RESULT
+KEY_VERSION = constants.LUXI_KEY_VERSION
+
+REQ_SUBMIT_JOB = constants.LUXI_REQ_SUBMIT_JOB
+REQ_SUBMIT_JOB_TO_DRAINED_QUEUE = constants.LUXI_REQ_SUBMIT_JOB_TO_DRAINED_QUEUE
+REQ_SUBMIT_MANY_JOBS = constants.LUXI_REQ_SUBMIT_MANY_JOBS
+REQ_PICKUP_JOB = constants.LUXI_REQ_PICKUP_JOB
+REQ_WAIT_FOR_JOB_CHANGE = constants.LUXI_REQ_WAIT_FOR_JOB_CHANGE
+REQ_CANCEL_JOB = constants.LUXI_REQ_CANCEL_JOB
+REQ_ARCHIVE_JOB = constants.LUXI_REQ_ARCHIVE_JOB
+REQ_CHANGE_JOB_PRIORITY = constants.LUXI_REQ_CHANGE_JOB_PRIORITY
+REQ_AUTO_ARCHIVE_JOBS = constants.LUXI_REQ_AUTO_ARCHIVE_JOBS
+REQ_QUERY = constants.LUXI_REQ_QUERY
+REQ_QUERY_FIELDS = constants.LUXI_REQ_QUERY_FIELDS
+REQ_QUERY_JOBS = constants.LUXI_REQ_QUERY_JOBS
+REQ_QUERY_INSTANCES = constants.LUXI_REQ_QUERY_INSTANCES
+REQ_QUERY_NODES = constants.LUXI_REQ_QUERY_NODES
+REQ_QUERY_GROUPS = constants.LUXI_REQ_QUERY_GROUPS
+REQ_QUERY_NETWORKS = constants.LUXI_REQ_QUERY_NETWORKS
+REQ_QUERY_EXPORTS = constants.LUXI_REQ_QUERY_EXPORTS
+REQ_QUERY_CONFIG_VALUES = constants.LUXI_REQ_QUERY_CONFIG_VALUES
+REQ_QUERY_CLUSTER_INFO = constants.LUXI_REQ_QUERY_CLUSTER_INFO
+REQ_QUERY_TAGS = constants.LUXI_REQ_QUERY_TAGS
+REQ_SET_DRAIN_FLAG = constants.LUXI_REQ_SET_DRAIN_FLAG
+REQ_SET_WATCHER_PAUSE = constants.LUXI_REQ_SET_WATCHER_PAUSE
+REQ_ALL = constants.LUXI_REQ_ALL
+
+DEF_CTMO = constants.LUXI_DEF_CTMO
+DEF_RWTO = constants.LUXI_DEF_RWTO
+WFJC_TIMEOUT = constants.LUXI_WFJC_TIMEOUT
class ProtocolError(errors.LuxiError):
diff --git a/lib/qlang.py b/lib/qlang.py
index 2352391bcb5dce5f4d32330c2f8a0c77efbd768a..95eddb22236a64be09655c496b9f31660d751090 100644
--- a/lib/qlang.py
+++ b/lib/qlang.py
@@ -32,44 +32,30 @@ converted to callable functions by L{query._CompileFilter}.
"""
import re
-import string # pylint: disable=W0402
import logging
import pyparsing as pyp
+from ganeti import constants
from ganeti import errors
from ganeti import utils
from ganeti import compat
-# Logic operators with one or more operands, each of which is a filter on its
-# own
-OP_OR = "|"
-OP_AND = "&"
-
-
-# Unary operators with exactly one operand
-OP_NOT = "!"
-OP_TRUE = "?"
-
-
-# Binary operators with exactly two operands, the field name and an
-# operator-specific value
-OP_EQUAL = "="
-OP_NOT_EQUAL = "!="
-OP_LT = "<"
-OP_LE = "<="
-OP_GT = ">"
-OP_GE = ">="
-OP_REGEXP = "=~"
-OP_CONTAINS = "=[]"
-
-
-#: Characters used for detecting user-written filters (see L{_CheckFilter})
-FILTER_DETECTION_CHARS = frozenset("()=/!~'\"\\<>" + string.whitespace)
-
-#: Characters used to detect globbing filters (see L{_CheckGlobbing})
-GLOB_DETECTION_CHARS = frozenset("*?")
+OP_OR = constants.QLANG_OP_OR
+OP_AND = constants.QLANG_OP_AND
+OP_NOT = constants.QLANG_OP_NOT
+OP_TRUE = constants.QLANG_OP_TRUE
+OP_EQUAL = constants.QLANG_OP_EQUAL
+OP_NOT_EQUAL = constants.QLANG_OP_NOT_EQUAL
+OP_LT = constants.QLANG_OP_LT
+OP_LE = constants.QLANG_OP_LE
+OP_GT = constants.QLANG_OP_GT
+OP_GE = constants.QLANG_OP_GE
+OP_REGEXP = constants.QLANG_OP_REGEXP
+OP_CONTAINS = constants.QLANG_OP_CONTAINS
+FILTER_DETECTION_CHARS = constants.QLANG_FILTER_DETECTION_CHARS
+GLOB_DETECTION_CHARS = constants.QLANG_GLOB_DETECTION_CHARS
def MakeSimpleFilter(namefield, values):
diff --git a/lib/query.py b/lib/query.py
index 680016659866a47a4311f58962daaaf242acb20c..784d9f369d257a21a1c5e98358bfc2f4c29d6656 100644
--- a/lib/query.py
+++ b/lib/query.py
@@ -1734,6 +1734,24 @@ def _GetInstNicBridge(ctx, index, _):
return _FS_UNAVAIL
+def _GetInstNicVLan(ctx, index, _):
+ """Get a NIC's VLAN.
+
+ @type ctx: L{InstanceQueryData}
+ @type index: int
+ @param index: NIC index
+
+ """
+ assert len(ctx.inst_nicparams) >= index
+
+ nicparams = ctx.inst_nicparams[index]
+
+ if nicparams[constants.NIC_MODE] == constants.NIC_MODE_OVS:
+ return nicparams[constants.NIC_VLAN]
+ else:
+ return _FS_UNAVAIL
+
+
def _GetInstAllNicNetworkNames(ctx, inst):
"""Get all network names for an instance.
@@ -1873,6 +1891,9 @@ def _GetInstanceNetworkFields():
(_MakeField("nic.bridge/%s" % i, "NicBridge/%s" % i, QFT_TEXT,
"Bridge of %s network interface" % numtext),
IQ_CONFIG, 0, _GetInstNic(i, _GetInstNicBridge)),
+ (_MakeField("nic.vlan/%s" % i, "NicVLAN/%s" % i, QFT_TEXT,
+ "VLAN of %s network interface" % numtext),
+ IQ_CONFIG, 0, _GetInstNic(i, _GetInstNicVLan)),
(_MakeField("nic.network/%s" % i, "NicNetwork/%s" % i, QFT_TEXT,
"Network of %s network interface" % numtext),
IQ_CONFIG, 0, _GetInstNic(i, _GetInstNicNetwork)),
diff --git a/lib/storage/drbd_info.py b/lib/storage/drbd_info.py
index fcab352015e0055111efaf4c86d71e45a8ab06ef..e6aec915692678c3e7908a24be398850ab843ae3 100644
--- a/lib/storage/drbd_info.py
+++ b/lib/storage/drbd_info.py
@@ -119,6 +119,7 @@ class DRBD8Status(object): # pylint: disable=R0902
self.is_diskless = self.ldisk == self.DS_DISKLESS
self.is_disk_uptodate = self.ldisk == self.DS_UPTODATE
+ self.peer_disk_uptodate = self.rdisk == self.DS_UPTODATE
self.is_in_resync = self.cstatus in self.CSET_SYNC
self.is_in_use = self.cstatus != self.CS_UNCONFIGURED
diff --git a/lib/utils/__init__.py b/lib/utils/__init__.py
index 276c6fc76fdfe5f01392100b00ea472bafb3df98..23650cacd1b2bf6b47a3595cb5c8c8fa60fff15d 100644
--- a/lib/utils/__init__.py
+++ b/lib/utils/__init__.py
@@ -99,11 +99,6 @@ def ForceDictType(target, key_types, allowed_values=None):
if ktype in (constants.VTYPE_STRING, constants.VTYPE_MAYBE_STRING):
if target[key] is None and ktype == constants.VTYPE_MAYBE_STRING:
- msg = ("'None' is not a valid Maybe value for '%s'. "
- "Use 'VALUE_HS_NOTHING'") % (key, )
- logging.warning(msg)
- elif (target[key] == constants.VALUE_HS_NOTHING
- and ktype == constants.VTYPE_MAYBE_STRING):
pass
elif not isinstance(target[key], basestring):
if isinstance(target[key], bool) and not target[key]:
diff --git a/src/AutoConf.hs.in b/src/AutoConf.hs.in
index 9c00056ffa97c2d4067ea7be840926616b32ab35..6454300e61bd31623efa094010652a1dc0a482a4 100644
--- a/src/AutoConf.hs.in
+++ b/src/AutoConf.hs.in
@@ -218,3 +218,9 @@ hasGnuLn = HAS_GNU_LN
-- number as the value
manPages :: [(String, Int)]
manPages = MAN_PAGES[]
+
+pyAfInet4 :: Int
+pyAfInet4 = AF_INET4
+
+pyAfInet6 :: Int
+pyAfInet6 = AF_INET6
diff --git a/src/Ganeti/ConfigReader.hs b/src/Ganeti/ConfigReader.hs
index e594da936c0e74ce0d888c3e74a65fdace689612..fde408bd94949169597733b7f69fed7058344ba8 100644
--- a/src/Ganeti/ConfigReader.hs
+++ b/src/Ganeti/ConfigReader.hs
@@ -123,7 +123,8 @@ updateConfig path save_fn = do
newcfg <- loadConfig path
let !newdata = case newcfg of
Ok !cfg -> Ok cfg
- Bad _ -> Bad $ "Cannot load configuration from " ++ path
+ Bad msg -> Bad $ "Cannot load configuration from " ++ path
+ ++ ": " ++ msg
save_fn newdata
case newcfg of
Ok cfg -> logInfo ("Loaded new config, serial " ++
diff --git a/src/Ganeti/ConstantUtils.hs b/src/Ganeti/ConstantUtils.hs
index c5ae57bd2e74e3ecd5cc42af63649685689bfe6c..be51b5d99f9695d4be9eebe9fc591ce7dc1aef93 100644
--- a/src/Ganeti/ConstantUtils.hs
+++ b/src/Ganeti/ConstantUtils.hs
@@ -89,25 +89,23 @@ instance PyValue Protocol where
-- | Failure exit code
--
--- These are defined here and not in 'Ganeti.HsConstants' together with
+-- These are defined here and not in 'Ganeti.Constants' together with
-- the other exit codes in order to avoid a circular dependency
--- between 'Ganeti.HsConstants' and 'Ganeti.Runtime'
+-- between 'Ganeti.Constants' and 'Ganeti.Runtime'
exitFailure :: Int
exitFailure = 1
-- | Console device
--
--- This is defined here and not in 'Ganeti.HsConstants' order to avoid
--- a circular dependency between 'Ganeti.HsConstants' and
--- 'Ganeti.Logging'
+-- This is defined here and not in 'Ganeti.Constants' order to avoid a
+-- circular dependency between 'Ganeti.Constants' and 'Ganeti.Logging'
devConsole :: String
devConsole = "/dev/console"
-- | Random uuid generator
--
--- This is defined here and not in 'Ganeti.HsConstants' order to avoid
--- a circular dependendy between 'Ganeti.HsConstants' and
--- 'Ganeti.Types'
+-- This is defined here and not in 'Ganeti.Constants' order to avoid a
+-- circular dependendy between 'Ganeti.Constants' and 'Ganeti.Types'
randomUuidFile :: String
randomUuidFile = "/proc/sys/kernel/random/uuid"
@@ -135,7 +133,7 @@ buildVersion major minor revision =
-- | Confd protocol version
--
-- This is defined here in order to avoid a circular dependency
--- between 'Ganeti.Confd.Types' and 'Ganeti.HsConstants'.
+-- between 'Ganeti.Confd.Types' and 'Ganeti.Constants'.
confdProtocolVersion :: Int
confdProtocolVersion = 1
@@ -143,7 +141,7 @@ confdProtocolVersion = 1
--
-- These are defined here and not in 'Ganeti.Types' due to GHC stage
-- restrictions concerning Template Haskell. They are also not
--- defined in 'Ganeti.HsConstants' in order to avoid a circular
+-- defined in 'Ganeti.Constants' in order to avoid a circular
-- dependency between that module and 'Ganeti.Types'.
confdReqqLink :: String
diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
index 1e42563c2ecc2a4d1b166fc23549597c2d97c6d7..4167a9a1006a59a9f3c5b8ab3ca179bfbc936f16 100644
--- a/src/Ganeti/Constants.hs
+++ b/src/Ganeti/Constants.hs
@@ -1,7 +1,16 @@
-{-| Ganeti constants.
+{-# OPTIONS -fno-warn-type-defaults #-}
+{-| Constants contains the Haskell constants
-This module reexports the Haskell constants and those generated from
-Python.
+The constants in this module are used in Haskell and are also
+converted to Python.
+
+Do not write any definitions in this file other than constants. Do
+not even write helper functions. The definitions in this module are
+automatically stripped to build the Makefile.am target
+'ListConstants.hs'. If there are helper functions in this module,
+they will also be dragged and it will cause compilation to fail.
+Therefore, all helper functions should go to a separate module and
+imported.
-}
@@ -25,9 +34,4530 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
-}
+module Ganeti.Constants where
+
+import Control.Arrow ((***))
+import Data.List ((\\))
+import Data.Map (Map)
+import qualified Data.Map as Map (empty, fromList, keys, insert)
+
+import qualified AutoConf
+import Ganeti.ConstantUtils (PythonChar(..), FrozenSet, Protocol(..),
+ buildVersion)
+import qualified Ganeti.ConstantUtils as ConstantUtils
+import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
+import qualified Ganeti.HTools.Types as Types
+import Ganeti.Logging (SyslogUsage(..))
+import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
+import qualified Ganeti.Runtime as Runtime
+import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
+ ExtraLogReason(..))
+import Ganeti.THH (PyValueEx(..))
+import Ganeti.Types
+import qualified Ganeti.Types as Types
+import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..),
+ ConfdReplyStatus(..), ConfdNodeRole(..),
+ ConfdErrorType(..))
+import qualified Ganeti.Confd.Types as Types
+
+{-# ANN module "HLint: ignore Use camelCase" #-}
+
+-- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
+
+htoolsProgs :: [String]
+htoolsProgs = AutoConf.htoolsProgs
+
+-- * 'autoconf' constants for Python only ('lib/constants.py')
+
+drbdBarriers :: String
+drbdBarriers = AutoConf.drbdBarriers
+
+drbdNoMetaFlush :: Bool
+drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
+
+lvmStripecount :: Int
+lvmStripecount = AutoConf.lvmStripecount
+
+hasGnuLn :: Bool
+hasGnuLn = AutoConf.hasGnuLn
+
+-- * 'autoconf' constants for Python only ('lib/pathutils.py')
+
+-- ** Build-time constants
+
+exportDir :: String
+exportDir = AutoConf.exportDir
+
+osSearchPath :: [String]
+osSearchPath = AutoConf.osSearchPath
+
+esSearchPath :: [String]
+esSearchPath = AutoConf.esSearchPath
+
+sshConfigDir :: String
+sshConfigDir = AutoConf.sshConfigDir
+
+xenConfigDir :: String
+xenConfigDir = AutoConf.xenConfigDir
+
+sysconfdir :: String
+sysconfdir = AutoConf.sysconfdir
+
+toolsdir :: String
+toolsdir = AutoConf.toolsdir
+
+localstatedir :: String
+localstatedir = AutoConf.localstatedir
+
+-- ** Paths which don't change for a virtual cluster
+
+pkglibdir :: String
+pkglibdir = AutoConf.pkglibdir
+
+sharedir :: String
+sharedir = AutoConf.sharedir
+
+-- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
+
+manPages :: Map String Int
+manPages = Map.fromList AutoConf.manPages
+
+-- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
+
+versionedsharedir :: String
+versionedsharedir = AutoConf.versionedsharedir
+
+-- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
+
+gntScripts :: [String]
+gntScripts = AutoConf.gntScripts
+
+-- * Various versions
+
+releaseVersion :: String
+releaseVersion = AutoConf.packageVersion
+
+versionMajor :: Int
+versionMajor = AutoConf.versionMajor
+
+versionMinor :: Int
+versionMinor = AutoConf.versionMinor
+
+versionRevision :: Int
+versionRevision = AutoConf.versionRevision
+
+dirVersion :: String
+dirVersion = AutoConf.dirVersion
+
+osApiV10 :: Int
+osApiV10 = 10
+
+osApiV15 :: Int
+osApiV15 = 15
+
+osApiV20 :: Int
+osApiV20 = 20
+
+osApiVersions :: FrozenSet Int
+osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20]
+
+exportVersion :: Int
+exportVersion = 0
+
+rapiVersion :: Int
+rapiVersion = 2
+
+configMajor :: Int
+configMajor = AutoConf.versionMajor
+
+configMinor :: Int
+configMinor = AutoConf.versionMinor
+
+-- | The configuration is supposed to remain stable across
+-- revisions. Therefore, the revision number is cleared to '0'.
+configRevision :: Int
+configRevision = 0
+
+configVersion :: Int
+configVersion = buildVersion configMajor configMinor configRevision
+
+-- | Similarly to the configuration (see 'configRevision'), the
+-- protocols are supposed to remain stable across revisions.
+protocolVersion :: Int
+protocolVersion = buildVersion configMajor configMinor configRevision
+
+-- * User separation
+
+daemonsGroup :: String
+daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
+
+adminGroup :: String
+adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
+
+masterdUser :: String
+masterdUser = Runtime.daemonUser GanetiMasterd
+
+masterdGroup :: String
+masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
+
+rapiUser :: String
+rapiUser = Runtime.daemonUser GanetiRapi
+
+rapiGroup :: String
+rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
+
+confdUser :: String
+confdUser = Runtime.daemonUser GanetiConfd
+
+confdGroup :: String
+confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
+
+luxidUser :: String
+luxidUser = Runtime.daemonUser GanetiLuxid
+
+luxidGroup :: String
+luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
+
+nodedUser :: String
+nodedUser = Runtime.daemonUser GanetiNoded
+
+nodedGroup :: String
+nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
+
+mondUser :: String
+mondUser = Runtime.daemonUser GanetiMond
+
+mondGroup :: String
+mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
+
+sshLoginUser :: String
+sshLoginUser = AutoConf.sshLoginUser
+
+sshConsoleUser :: String
+sshConsoleUser = AutoConf.sshConsoleUser
+
+-- * Cpu pinning separators and constants
+
+cpuPinningSep :: String
+cpuPinningSep = ":"
+
+cpuPinningAll :: String
+cpuPinningAll = "all"
+
+-- | Internal representation of "all"
+cpuPinningAllVal :: Int
+cpuPinningAllVal = -1
+
+-- | One "all" entry in a CPU list means CPU pinning is off
+cpuPinningOff :: [Int]
+cpuPinningOff = [cpuPinningAllVal]
+
+-- | A Xen-specific implementation detail is that there is no way to
+-- actually say "use any cpu for pinning" in a Xen configuration file,
+-- as opposed to the command line, where you can say
+-- @
+-- xm vcpu-pin <domain> <vcpu> all
+-- @
+--
+-- The workaround used in Xen is "0-63" (see source code function
+-- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@).
+--
+-- To support future changes, the following constant is treated as a
+-- blackbox string that simply means "use any cpu for pinning under
+-- xen".
+cpuPinningAllXen :: String
+cpuPinningAllXen = "0-63"
+
+-- | A KVM-specific implementation detail - the following value is
+-- used to set CPU affinity to all processors (--0 through --31), per
+-- taskset man page.
+--
+-- FIXME: This only works for machines with up to 32 CPU cores
+cpuPinningAllKvm :: Int
+cpuPinningAllKvm = 0xFFFFFFFF
+
+-- * Wipe
+
+ddCmd :: String
+ddCmd = "dd"
+
+-- | 1GB
+maxWipeChunk :: Int
+maxWipeChunk = 1024
+
+minWipeChunkPercent :: Int
+minWipeChunkPercent = 10
+
+-- * Directories
+
+runDirsMode :: Int
+runDirsMode = 0o775
+
+secureDirMode :: Int
+secureDirMode = 0o700
+
+secureFileMode :: Int
+secureFileMode = 0o600
+
+adoptableBlockdevRoot :: String
+adoptableBlockdevRoot = "/dev/disk/"
+
+-- * 'autoconf' enable/disable
+
+enableConfd :: Bool
+enableConfd = AutoConf.enableConfd
+
+enableMond :: Bool
+enableMond = AutoConf.enableMond
+
+enableRestrictedCommands :: Bool
+enableRestrictedCommands = AutoConf.enableRestrictedCommands
+
+enableSplitQuery :: Bool
+enableSplitQuery = AutoConf.enableSplitQuery
+
+-- * SSH constants
+
+ssh :: String
+ssh = "ssh"
+
+scp :: String
+scp = "scp"
+
+-- * Daemons
+
+confd :: String
+confd = Runtime.daemonName GanetiConfd
+
+masterd :: String
+masterd = Runtime.daemonName GanetiMasterd
+
+mond :: String
+mond = Runtime.daemonName GanetiMond
+
+noded :: String
+noded = Runtime.daemonName GanetiNoded
+
+luxid :: String
+luxid = Runtime.daemonName GanetiLuxid
+
+rapi :: String
+rapi = Runtime.daemonName GanetiRapi
+
+daemons :: FrozenSet String
+daemons =
+ ConstantUtils.mkSet [confd,
+ luxid,
+ masterd,
+ mond,
+ noded,
+ rapi]
+
+defaultConfdPort :: Int
+defaultConfdPort = 1814
+
+defaultMondPort :: Int
+defaultMondPort = 1815
+
+defaultNodedPort :: Int
+defaultNodedPort = 1811
+
+defaultRapiPort :: Int
+defaultRapiPort = 5080
+
+daemonsPorts :: Map String (Protocol, Int)
+daemonsPorts =
+ Map.fromList [(confd, (Udp, defaultConfdPort)),
+ (mond, (Tcp, defaultMondPort)),
+ (noded, (Tcp, defaultNodedPort)),
+ (rapi, (Tcp, defaultRapiPort)),
+ (ssh, (Tcp, 22))]
+
+firstDrbdPort :: Int
+firstDrbdPort = 11000
+
+lastDrbdPort :: Int
+lastDrbdPort = 14999
+
+daemonsLogbase :: Map String String
+daemonsLogbase =
+ Map.fromList
+ [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
+
+daemonsExtraLogbase :: Map String (Map String String)
+daemonsExtraLogbase =
+ Map.fromList $
+ map (Runtime.daemonName *** id)
+ [ (GanetiMond, Map.fromList
+ [ ("access", Runtime.daemonsExtraLogbase GanetiMond AccessLog)
+ , ("error", Runtime.daemonsExtraLogbase GanetiMond ErrorLog)
+ ])
+ ]
+
+extraLogreasonAccess :: String
+extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
+
+extraLogreasonError :: String
+extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
+
+devConsole :: String
+devConsole = ConstantUtils.devConsole
+
+procMounts :: String
+procMounts = "/proc/mounts"
+
+-- * Luxi (Local UniX Interface) related constants
+
+luxiEom :: PythonChar
+luxiEom = PythonChar '\x03'
+
+-- | Environment variable for the luxi override socket
+luxiOverride :: String
+luxiOverride = "FORCE_LUXI_SOCKET"
+
+luxiOverrideMaster :: String
+luxiOverrideMaster = "master"
+
+luxiOverrideQuery :: String
+luxiOverrideQuery = "query"
+
+luxiVersion :: Int
+luxiVersion = configVersion
+
+-- * Syslog
+
+syslogUsage :: String
+syslogUsage = AutoConf.syslogUsage
+
+syslogNo :: String
+syslogNo = Logging.syslogUsageToRaw SyslogNo
+
+syslogYes :: String
+syslogYes = Logging.syslogUsageToRaw SyslogYes
+
+syslogOnly :: String
+syslogOnly = Logging.syslogUsageToRaw SyslogOnly
+
+syslogSocket :: String
+syslogSocket = "/dev/log"
+
+exportConfFile :: String
+exportConfFile = "config.ini"
+
+-- * Xen
+
+xenBootloader :: String
+xenBootloader = AutoConf.xenBootloader
+
+xenCmdXl :: String
+xenCmdXl = "xl"
+
+xenCmdXm :: String
+xenCmdXm = "xm"
+
+xenInitrd :: String
+xenInitrd = AutoConf.xenInitrd
+
+xenKernel :: String
+xenKernel = AutoConf.xenKernel
+
+-- FIXME: perhaps rename to 'validXenCommands' for consistency with
+-- other constants
+knownXenCommands :: FrozenSet String
+knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
+
+-- * KVM and socat
+
+kvmPath :: String
+kvmPath = AutoConf.kvmPath
+
+kvmKernel :: String
+kvmKernel = AutoConf.kvmKernel
+
+socatEscapeCode :: String
+socatEscapeCode = "0x1d"
+
+socatPath :: String
+socatPath = AutoConf.socatPath
+
+socatUseCompress :: Bool
+socatUseCompress = AutoConf.socatUseCompress
+
+socatUseEscape :: Bool
+socatUseEscape = AutoConf.socatUseEscape
+
+-- * Console types
+
+-- | Display a message for console access
+consMessage :: String
+consMessage = "msg"
+
+-- | Console as SPICE server
+consSpice :: String
+consSpice = "spice"
+
+-- | Console as SSH command
+consSsh :: String
+consSsh = "ssh"
+
+-- | Console as VNC server
+consVnc :: String
+consVnc = "vnc"
+
+consAll :: FrozenSet String
+consAll = ConstantUtils.mkSet [consMessage, consSpice, consSsh, consVnc]
+
+-- | RSA key bit length
+--
+-- For RSA keys more bits are better, but they also make operations
+-- more expensive. NIST SP 800-131 recommends a minimum of 2048 bits
+-- from the year 2010 on.
+rsaKeyBits :: Int
+rsaKeyBits = 2048
+
+-- | Ciphers allowed for SSL connections.
+--
+-- For the format, see ciphers(1). A better way to disable ciphers
+-- would be to use the exclamation mark (!), but socat versions below
+-- 1.5 can't parse exclamation marks in options properly. When
+-- modifying the ciphers, ensure not to accidentially add something
+-- after it's been removed. Use the "openssl" utility to check the
+-- allowed ciphers, e.g. "openssl ciphers -v HIGH:-DES".
+opensslCiphers :: String
+opensslCiphers = "HIGH:-DES:-3DES:-EXPORT:-ADH"
+
+-- * X509
+
+-- | commonName (CN) used in certificates
+x509CertCn :: String
+x509CertCn = "ganeti.example.com"
+
+-- | Default validity of certificates in days
+x509CertDefaultValidity :: Int
+x509CertDefaultValidity = 365 * 5
+
+x509CertSignatureHeader :: String
+x509CertSignatureHeader = "X-Ganeti-Signature"
+
+-- | Digest used to sign certificates ("openssl x509" uses SHA1 by default)
+x509CertSignDigest :: String
+x509CertSignDigest = "SHA1"
+
+-- * Import/export daemon mode
+
+iemExport :: String
+iemExport = "export"
+
+iemImport :: String
+iemImport = "import"
+
+-- * Import/export transport compression
+
+iecGzip :: String
+iecGzip = "gzip"
+
+iecNone :: String
+iecNone = "none"
+
+iecAll :: [String]
+iecAll = [iecGzip, iecNone]
+
+ieCustomSize :: String
+ieCustomSize = "fd"
+
+-- * Import/export I/O
+
+-- | Direct file I/O, equivalent to a shell's I/O redirection using
+-- '<' or '>'
+ieioFile :: String
+ieioFile = "file"
+
+-- | Raw block device I/O using "dd"
+ieioRawDisk :: String
+ieioRawDisk = "raw"
+
+-- | OS definition import/export script
+ieioScript :: String
+ieioScript = "script"
+
+-- * Values
+
+valueDefault :: String
+valueDefault = "default"
+
+valueAuto :: String
+valueAuto = "auto"
+
+valueGenerate :: String
+valueGenerate = "generate"
+
+valueNone :: String
+valueNone = "none"
+
+valueTrue :: String
+valueTrue = "true"
+
+valueFalse :: String
+valueFalse = "false"
+
+-- * Hooks
+
+hooksNameCfgupdate :: String
+hooksNameCfgupdate = "config-update"
+
+hooksNameWatcher :: String
+hooksNameWatcher = "watcher"
+
+hooksPath :: String
+hooksPath = "/sbin:/bin:/usr/sbin:/usr/bin"
+
+hooksPhasePost :: String
+hooksPhasePost = "post"
+
+hooksPhasePre :: String
+hooksPhasePre = "pre"
+
+hooksVersion :: Int
+hooksVersion = 2
+
+-- * Hooks subject type (what object type does the LU deal with)
+
+htypeCluster :: String
+htypeCluster = "CLUSTER"
+
+htypeGroup :: String
+htypeGroup = "GROUP"
+
+htypeInstance :: String
+htypeInstance = "INSTANCE"
+
+htypeNetwork :: String
+htypeNetwork = "NETWORK"
+
+htypeNode :: String
+htypeNode = "NODE"
+
+-- * Hkr
+
+hkrSkip :: Int
+hkrSkip = 0
+
+hkrFail :: Int
+hkrFail = 1
+
+hkrSuccess :: Int
+hkrSuccess = 2
+
+-- * Storage types
+
+stBlock :: String
+stBlock = Types.storageTypeToRaw StorageBlock
+
+stDiskless :: String
+stDiskless = Types.storageTypeToRaw StorageDiskless
+
+stExt :: String
+stExt = Types.storageTypeToRaw StorageExt
+
+stFile :: String
+stFile = Types.storageTypeToRaw StorageFile
+
+stLvmPv :: String
+stLvmPv = Types.storageTypeToRaw StorageLvmPv
+
+stLvmVg :: String
+stLvmVg = Types.storageTypeToRaw StorageLvmVg
+
+stRados :: String
+stRados = Types.storageTypeToRaw StorageRados
+
+storageTypes :: FrozenSet String
+storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
+
+-- | The set of storage types for which storage reporting is available
+--
+-- FIXME: Remove this, once storage reporting is available for all
+-- types.
+stsReport :: FrozenSet String
+stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg]
+
+-- * Storage fields
+-- ** First two are valid in LU context only, not passed to backend
+
+sfNode :: String
+sfNode = "node"
+
+sfType :: String
+sfType = "type"
+
+-- ** and the rest are valid in backend
+
+sfAllocatable :: String
+sfAllocatable = Types.storageFieldToRaw SFAllocatable
+
+sfFree :: String
+sfFree = Types.storageFieldToRaw SFFree
+
+sfName :: String
+sfName = Types.storageFieldToRaw SFName
+
+sfSize :: String
+sfSize = Types.storageFieldToRaw SFSize
+
+sfUsed :: String
+sfUsed = Types.storageFieldToRaw SFUsed
+
+validStorageFields :: FrozenSet String
+validStorageFields =
+ ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++
+ [sfNode, sfType]
+
+modifiableStorageFields :: Map String (FrozenSet String)
+modifiableStorageFields =
+ Map.fromList [(Types.storageTypeToRaw StorageLvmPv,
+ ConstantUtils.mkSet [sfAllocatable])]
+
+-- * Storage operations
+
+soFixConsistency :: String
+soFixConsistency = "fix-consistency"
+
+validStorageOperations :: Map String (FrozenSet String)
+validStorageOperations =
+ Map.fromList [(Types.storageTypeToRaw StorageLvmVg,
+ ConstantUtils.mkSet [soFixConsistency])]
+
+-- * Volume fields
+
+vfDev :: String
+vfDev = "dev"
+
+vfInstance :: String
+vfInstance = "instance"
+
+vfName :: String
+vfName = "name"
+
+vfNode :: String
+vfNode = "node"
+
+vfPhys :: String
+vfPhys = "phys"
+
+vfSize :: String
+vfSize = "size"
+
+vfVg :: String
+vfVg = "vg"
+
+-- * Local disk status
+
+ldsFaulty :: Int
+ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty
+
+ldsOkay :: Int
+ldsOkay = Types.localDiskStatusToRaw DiskStatusOk
+
+ldsUnknown :: Int
+ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown
+
+ldsNames :: Map Int String
+ldsNames =
+ Map.fromList [ (Types.localDiskStatusToRaw ds,
+ localDiskStatusName ds) | ds <- [minBound..] ]
+
+-- * Disk template types
+
+dtDiskless :: String
+dtDiskless = Types.diskTemplateToRaw DTDiskless
+
+dtFile :: String
+dtFile = Types.diskTemplateToRaw DTFile
+
+dtSharedFile :: String
+dtSharedFile = Types.diskTemplateToRaw DTSharedFile
+
+dtPlain :: String
+dtPlain = Types.diskTemplateToRaw DTPlain
+
+dtBlock :: String
+dtBlock = Types.diskTemplateToRaw DTBlock
+
+dtDrbd8 :: String
+dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
+
+dtRbd :: String
+dtRbd = Types.diskTemplateToRaw DTRbd
+
+dtExt :: String
+dtExt = Types.diskTemplateToRaw DTExt
+
+-- | This is used to order determine the default disk template when
+-- the list of enabled disk templates is inferred from the current
+-- state of the cluster. This only happens on an upgrade from a
+-- version of Ganeti that did not support the 'enabled_disk_templates'
+-- so far.
+diskTemplatePreference :: [String]
+diskTemplatePreference =
+ map Types.diskTemplateToRaw
+ [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
+
+diskTemplates :: FrozenSet String
+diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
+
+-- | Disk templates that are enabled by default
+defaultEnabledDiskTemplates :: [String]
+defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
+
+-- | Mapping of disk templates to storage types
+mapDiskTemplateStorageType :: Map String String
+mapDiskTemplateStorageType =
+ Map.fromList $
+ map (Types.diskTemplateToRaw *** Types.storageTypeToRaw)
+ [(DTBlock, StorageBlock),
+ (DTDrbd8, StorageLvmVg),
+ (DTExt, StorageExt),
+ (DTSharedFile, StorageFile),
+ (DTFile, StorageFile),
+ (DTDiskless, StorageDiskless),
+ (DTPlain, StorageLvmVg),
+ (DTRbd, StorageRados)]
+
+-- | The set of network-mirrored disk templates
+dtsIntMirror :: FrozenSet String
+dtsIntMirror = ConstantUtils.mkSet [dtDrbd8]
+
+-- | 'DTDiskless' is 'trivially' externally mirrored
+dtsExtMirror :: FrozenSet String
+dtsExtMirror =
+ ConstantUtils.mkSet $
+ map Types.diskTemplateToRaw [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd]
+
+-- | The set of non-lvm-based disk templates
+dtsNotLvm :: FrozenSet String
+dtsNotLvm =
+ ConstantUtils.mkSet $
+ map Types.diskTemplateToRaw
+ [DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd]
+
+-- | The set of disk templates which can be grown
+dtsGrowable :: FrozenSet String
+dtsGrowable =
+ ConstantUtils.mkSet $
+ map Types.diskTemplateToRaw
+ [DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd]
+
+-- | The set of disk templates that allow adoption
+dtsMayAdopt :: FrozenSet String
+dtsMayAdopt =
+ ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain]
+
+-- | The set of disk templates that *must* use adoption
+dtsMustAdopt :: FrozenSet String
+dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock]
+
+-- | The set of disk templates that allow migrations
+dtsMirrored :: FrozenSet String
+dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror
+
+-- | The set of file based disk templates
+dtsFilebased :: FrozenSet String
+dtsFilebased =
+ ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTSharedFile, DTFile]
+
+-- | The set of disk templates that can be moved by copying
+--
+-- Note: a requirement is that they're not accessed externally or
+-- shared between nodes; in particular, sharedfile is not suitable.
+dtsCopyable :: FrozenSet String
+dtsCopyable =
+ ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile]
+
+-- | The set of disk templates that are supported by exclusive_storage
+dtsExclStorage :: FrozenSet String
+dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain]
+
+-- | Templates for which we don't perform checks on free space
+dtsNoFreeSpaceCheck :: FrozenSet String
+dtsNoFreeSpaceCheck =
+ ConstantUtils.mkSet $
+ map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd]
+
+dtsBlock :: FrozenSet String
+dtsBlock =
+ ConstantUtils.mkSet $
+ map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt]
+
+-- | The set of lvm-based disk templates
+dtsLvm :: FrozenSet String
+dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm
+
+-- * Drbd
+
+drbdHmacAlg :: String
+drbdHmacAlg = "md5"
+
+drbdDefaultNetProtocol :: String
+drbdDefaultNetProtocol = "C"
+
+drbdMigrationNetProtocol :: String
+drbdMigrationNetProtocol = "C"
+
+drbdStatusFile :: String
+drbdStatusFile = "/proc/drbd"
+
+-- | Size of DRBD meta block device
+drbdMetaSize :: Int
+drbdMetaSize = 128
+
+-- * Drbd barrier types
+
+drbdBDiskBarriers :: String
+drbdBDiskBarriers = "b"
+
+drbdBDiskDrain :: String
+drbdBDiskDrain = "d"
+
+drbdBDiskFlush :: String
+drbdBDiskFlush = "f"
+
+drbdBNone :: String
+drbdBNone = "n"
+
+-- | Valid barrier combinations: "n" or any non-null subset of "bfd"
+drbdValidBarrierOpt :: FrozenSet (FrozenSet String)
+drbdValidBarrierOpt =
+ ConstantUtils.mkSet
+ [ ConstantUtils.mkSet [drbdBNone]
+ , ConstantUtils.mkSet [drbdBDiskBarriers]
+ , ConstantUtils.mkSet [drbdBDiskDrain]
+ , ConstantUtils.mkSet [drbdBDiskFlush]
+ , ConstantUtils.mkSet [drbdBDiskDrain, drbdBDiskFlush]
+ , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskDrain]
+ , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush]
+ , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush, drbdBDiskDrain]
+ ]
+
+-- | Rbd tool command
+rbdCmd :: String
+rbdCmd = "rbd"
+
+-- * File backend driver
+
+fdBlktap :: String
+fdBlktap = Types.fileDriverToRaw FileBlktap
+
+fdLoop :: String
+fdLoop = Types.fileDriverToRaw FileLoop
+
+fileDriver :: FrozenSet String
+fileDriver =
+ ConstantUtils.mkSet $
+ map Types.fileDriverToRaw [minBound..]
+
+-- | The set of drbd-like disk types
+dtsDrbd :: FrozenSet String
+dtsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
+
+-- * Disk access mode
+
+diskRdonly :: String
+diskRdonly = Types.diskModeToRaw DiskRdOnly
+
+diskRdwr :: String
+diskRdwr = Types.diskModeToRaw DiskRdWr
+
+diskAccessSet :: FrozenSet String
+diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
+
+-- * Disk replacement mode
+
+replaceDiskAuto :: String
+replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto
+
+replaceDiskChg :: String
+replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary
+
+replaceDiskPri :: String
+replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary
+
+replaceDiskSec :: String
+replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary
+
+replaceModes :: FrozenSet String
+replaceModes =
+ ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..]
+
+-- * Instance export mode
+
+exportModeLocal :: String
+exportModeLocal = Types.exportModeToRaw ExportModeLocal
+
+exportModeRemote :: String
+exportModeRemote = Types.exportModeToRaw ExportModeRemote
+
+exportModes :: FrozenSet String
+exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
+
+-- * Instance creation modes
+
+instanceCreate :: String
+instanceCreate = Types.instCreateModeToRaw InstCreate
+
+instanceImport :: String
+instanceImport = Types.instCreateModeToRaw InstImport
+
+instanceRemoteImport :: String
+instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
+
+instanceCreateModes :: FrozenSet String
+instanceCreateModes =
+ ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
+
+-- * Remote import/export handshake message and version
+
+rieHandshake :: String
+rieHandshake = "Hi, I'm Ganeti"
+
+rieVersion :: Int
+rieVersion = 0
+
+-- | Remote import/export certificate validity (seconds)
+rieCertValidity :: Int
+rieCertValidity = 24 * 60 * 60
+
+-- | Export only: how long to wait per connection attempt (seconds)
+rieConnectAttemptTimeout :: Int
+rieConnectAttemptTimeout = 20
+
+-- | Export only: number of attempts to connect
+rieConnectRetries :: Int
+rieConnectRetries = 10
+
+-- | Overall timeout for establishing connection
+rieConnectTimeout :: Int
+rieConnectTimeout = 180
+
+-- | Give child process up to 5 seconds to exit after sending a signal
+childLingerTimeout :: Double
+childLingerTimeout = 5.0
+
+-- * Import/export config options
+
+inisectBep :: String
+inisectBep = "backend"
+
+inisectExp :: String
+inisectExp = "export"
+
+inisectHyp :: String
+inisectHyp = "hypervisor"
+
+inisectIns :: String
+inisectIns = "instance"
+
+inisectOsp :: String
+inisectOsp = "os"
+
+-- * Dynamic device modification
+
+ddmAdd :: String
+ddmAdd = Types.ddmFullToRaw DdmFullAdd
+
+ddmModify :: String
+ddmModify = Types.ddmFullToRaw DdmFullModify
+
+ddmRemove :: String
+ddmRemove = Types.ddmFullToRaw DdmFullRemove
+
+ddmsValues :: FrozenSet String
+ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
+
+ddmsValuesWithModify :: FrozenSet String
+ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
+
+-- * Common exit codes
+
+exitSuccess :: Int
+exitSuccess = 0
+
+exitFailure :: Int
+exitFailure = ConstantUtils.exitFailure
+
+exitNotcluster :: Int
+exitNotcluster = 5
+
+exitNotmaster :: Int
+exitNotmaster = 11
+
+exitNodesetupError :: Int
+exitNodesetupError = 12
+
+-- | Need user confirmation
+exitConfirmation :: Int
+exitConfirmation = 13
+
+-- | Exit code for query operations with unknown fields
+exitUnknownField :: Int
+exitUnknownField = 14
+
+-- * Tags
+
+tagCluster :: String
+tagCluster = Types.tagKindToRaw TagKindCluster
+
+tagInstance :: String
+tagInstance = Types.tagKindToRaw TagKindInstance
+
+tagNetwork :: String
+tagNetwork = Types.tagKindToRaw TagKindNetwork
+
+tagNode :: String
+tagNode = Types.tagKindToRaw TagKindNode
+
+tagNodegroup :: String
+tagNodegroup = Types.tagKindToRaw TagKindGroup
+
+validTagTypes :: FrozenSet String
+validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
+
+maxTagLen :: Int
+maxTagLen = 128
+
+maxTagsPerObj :: Int
+maxTagsPerObj = 4096
+
+-- * Others
+
+defaultBridge :: String
+defaultBridge = "xen-br0"
+
+defaultOvs :: String
+defaultOvs = "switch1"
+
+-- | 60 MiB/s, expressed in KiB/s
+classicDrbdSyncSpeed :: Int
+classicDrbdSyncSpeed = 60 * 1024
+
+ip4AddressAny :: String
+ip4AddressAny = "0.0.0.0"
+
+ip4AddressLocalhost :: String
+ip4AddressLocalhost = "127.0.0.1"
+
+ip6AddressAny :: String
+ip6AddressAny = "::"
+
+ip6AddressLocalhost :: String
+ip6AddressLocalhost = "::1"
+
+ip4Version :: Int
+ip4Version = 4
+
+ip6Version :: Int
+ip6Version = 6
+
+validIpVersions :: FrozenSet Int
+validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version]
+
+tcpPingTimeout :: Int
+tcpPingTimeout = 10
+
+defaultVg :: String
+defaultVg = "xenvg"
+
+defaultDrbdHelper :: String
+defaultDrbdHelper = "/bin/true"
+
+minVgSize :: Int
+minVgSize = 20480
+
+defaultMacPrefix :: String
+defaultMacPrefix = "aa:00:00"
+
+-- | Default maximum instance wait time (seconds)
+defaultShutdownTimeout :: Int
+defaultShutdownTimeout = 120
+
+-- | Node clock skew (seconds)
+nodeMaxClockSkew :: Int
+nodeMaxClockSkew = 150
+
+-- | Time for an intra-cluster disk transfer to wait for a connection
+diskTransferConnectTimeout :: Int
+diskTransferConnectTimeout = 60
+
+-- | Disk index separator
+diskSeparator :: String
+diskSeparator = AutoConf.diskSeparator
+
+ipCommandPath :: String
+ipCommandPath = AutoConf.ipPath
+
+-- | Key for job IDs in opcode result
+jobIdsKey :: String
+jobIdsKey = "jobs"
+
+-- * Runparts results
+
+runpartsErr :: Int
+runpartsErr = 2
+
+runpartsRun :: Int
+runpartsRun = 1
+
+runpartsSkip :: Int
+runpartsSkip = 0
+
+runpartsStatus :: [Int]
+runpartsStatus = [runpartsErr, runpartsRun, runpartsSkip]
+
+-- * RPC
+
+rpcEncodingNone :: Int
+rpcEncodingNone = 0
+
+rpcEncodingZlibBase64 :: Int
+rpcEncodingZlibBase64 = 1
+
+-- * Timeout table
+--
+-- Various time constants for the timeout table
+
+rpcTmoUrgent :: Int
+rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
+
+rpcTmoFast :: Int
+rpcTmoFast = Types.rpcTimeoutToRaw Fast
+
+rpcTmoNormal :: Int
+rpcTmoNormal = Types.rpcTimeoutToRaw Normal
+
+rpcTmoSlow :: Int
+rpcTmoSlow = Types.rpcTimeoutToRaw Slow
+
+-- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
+-- in the 'Ganeti.THH.deCamelCase' function and generate the correct
+-- Python name.
+rpcTmo_4hrs :: Int
+rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
+
+-- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
+-- in the 'Ganeti.THH.deCamelCase' function and generate the correct
+-- Python name.
+rpcTmo_1day :: Int
+rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
+
+-- | Timeout for connecting to nodes (seconds)
+rpcConnectTimeout :: Int
+rpcConnectTimeout = 5
+
+-- OS
+
+osScriptCreate :: String
+osScriptCreate = "create"
+
+osScriptExport :: String
+osScriptExport = "export"
+
+osScriptImport :: String
+osScriptImport = "import"
+
+osScriptRename :: String
+osScriptRename = "rename"
+
+osScriptVerify :: String
+osScriptVerify = "verify"
+
+osScripts :: [String]
+osScripts = [osScriptCreate, osScriptExport, osScriptImport, osScriptRename,
+ osScriptVerify]
+
+osApiFile :: String
+osApiFile = "ganeti_api_version"
+
+osVariantsFile :: String
+osVariantsFile = "variants.list"
+
+osParametersFile :: String
+osParametersFile = "parameters.list"
+
+osValidateParameters :: String
+osValidateParameters = "parameters"
+
+osValidateCalls :: FrozenSet String
+osValidateCalls = ConstantUtils.mkSet [osValidateParameters]
+
+-- | External Storage (ES) related constants
+
+esActionAttach :: String
+esActionAttach = "attach"
+
+esActionCreate :: String
+esActionCreate = "create"
+
+esActionDetach :: String
+esActionDetach = "detach"
+
+esActionGrow :: String
+esActionGrow = "grow"
+
+esActionRemove :: String
+esActionRemove = "remove"
+
+esActionSetinfo :: String
+esActionSetinfo = "setinfo"
+
+esActionVerify :: String
+esActionVerify = "verify"
+
+esScriptCreate :: String
+esScriptCreate = esActionCreate
+
+esScriptRemove :: String
+esScriptRemove = esActionRemove
+
+esScriptGrow :: String
+esScriptGrow = esActionGrow
+
+esScriptAttach :: String
+esScriptAttach = esActionAttach
+
+esScriptDetach :: String
+esScriptDetach = esActionDetach
+
+esScriptSetinfo :: String
+esScriptSetinfo = esActionSetinfo
+
+esScriptVerify :: String
+esScriptVerify = esActionVerify
+
+esScripts :: FrozenSet String
+esScripts =
+ ConstantUtils.mkSet [esScriptAttach,
+ esScriptCreate,
+ esScriptDetach,
+ esScriptGrow,
+ esScriptRemove,
+ esScriptSetinfo,
+ esScriptVerify]
+
+esParametersFile :: String
+esParametersFile = "parameters.list"
+
+-- * Reboot types
+
+instanceRebootSoft :: String
+instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
+
+instanceRebootHard :: String
+instanceRebootHard = Types.rebootTypeToRaw RebootHard
+
+instanceRebootFull :: String
+instanceRebootFull = Types.rebootTypeToRaw RebootFull
+
+rebootTypes :: FrozenSet String
+rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
+
+-- * Instance reboot behaviors
+
+instanceRebootAllowed :: String
+instanceRebootAllowed = "reboot"
+
+instanceRebootExit :: String
+instanceRebootExit = "exit"
+
+rebootBehaviors :: [String]
+rebootBehaviors = [instanceRebootAllowed, instanceRebootExit]
+
+-- * VTypes
+
+vtypeBool :: VType
+vtypeBool = VTypeBool
+
+vtypeInt :: VType
+vtypeInt = VTypeInt
+
+vtypeMaybeString :: VType
+vtypeMaybeString = VTypeMaybeString
+
+-- | Size in MiBs
+vtypeSize :: VType
+vtypeSize = VTypeSize
+
+vtypeString :: VType
+vtypeString = VTypeString
+
+enforceableTypes :: FrozenSet VType
+enforceableTypes = ConstantUtils.mkSet [minBound..]
+
+-- | Constant representing that the user does not specify any IP version
+ifaceNoIpVersionSpecified :: Int
+ifaceNoIpVersionSpecified = 0
+
+validSerialSpeeds :: [Int]
+validSerialSpeeds =
+ [75,
+ 110,
+ 300,
+ 600,
+ 1200,
+ 1800,
+ 2400,
+ 4800,
+ 9600,
+ 14400,
+ 19200,
+ 28800,
+ 38400,
+ 57600,
+ 115200,
+ 230400,
+ 345600,
+ 460800]
+
+-- * HV parameter names (global namespace)
+
+hvAcpi :: String
+hvAcpi = "acpi"
+
+hvBlockdevPrefix :: String
+hvBlockdevPrefix = "blockdev_prefix"
+
+hvBootloaderArgs :: String
+hvBootloaderArgs = "bootloader_args"
+
+hvBootloaderPath :: String
+hvBootloaderPath = "bootloader_path"
+
+hvBootOrder :: String
+hvBootOrder = "boot_order"
+
+hvCdromImagePath :: String
+hvCdromImagePath = "cdrom_image_path"
+
+hvCpuCap :: String
+hvCpuCap = "cpu_cap"
+
+hvCpuCores :: String
+hvCpuCores = "cpu_cores"
+
+hvCpuMask :: String
+hvCpuMask = "cpu_mask"
+
+hvCpuSockets :: String
+hvCpuSockets = "cpu_sockets"
+
+hvCpuThreads :: String
+hvCpuThreads = "cpu_threads"
+
+hvCpuType :: String
+hvCpuType = "cpu_type"
+
+hvCpuWeight :: String
+hvCpuWeight = "cpu_weight"
+
+hvDeviceModel :: String
+hvDeviceModel = "device_model"
+
+hvDiskCache :: String
+hvDiskCache = "disk_cache"
+
+hvDiskType :: String
+hvDiskType = "disk_type"
+
+hvInitrdPath :: String
+hvInitrdPath = "initrd_path"
+
+hvInitScript :: String
+hvInitScript = "init_script"
+
+hvKernelArgs :: String
+hvKernelArgs = "kernel_args"
+
+hvKernelPath :: String
+hvKernelPath = "kernel_path"
+
+hvKeymap :: String
+hvKeymap = "keymap"
+
+hvKvmCdrom2ImagePath :: String
+hvKvmCdrom2ImagePath = "cdrom2_image_path"
+
+hvKvmCdromDiskType :: String
+hvKvmCdromDiskType = "cdrom_disk_type"
+
+hvKvmExtra :: String
+hvKvmExtra = "kvm_extra"
+
+hvKvmFlag :: String
+hvKvmFlag = "kvm_flag"
+
+hvKvmFloppyImagePath :: String
+hvKvmFloppyImagePath = "floppy_image_path"
+
+hvKvmMachineVersion :: String
+hvKvmMachineVersion = "machine_version"
+
+hvKvmPath :: String
+hvKvmPath = "kvm_path"
+
+hvKvmSpiceAudioCompr :: String
+hvKvmSpiceAudioCompr = "spice_playback_compression"
+
+hvKvmSpiceBind :: String
+hvKvmSpiceBind = "spice_bind"
+
+hvKvmSpiceIpVersion :: String
+hvKvmSpiceIpVersion = "spice_ip_version"
+
+hvKvmSpiceJpegImgCompr :: String
+hvKvmSpiceJpegImgCompr = "spice_jpeg_wan_compression"
+
+hvKvmSpiceLosslessImgCompr :: String
+hvKvmSpiceLosslessImgCompr = "spice_image_compression"
+
+hvKvmSpicePasswordFile :: String
+hvKvmSpicePasswordFile = "spice_password_file"
+
+hvKvmSpiceStreamingVideoDetection :: String
+hvKvmSpiceStreamingVideoDetection = "spice_streaming_video"
+
+hvKvmSpiceTlsCiphers :: String
+hvKvmSpiceTlsCiphers = "spice_tls_ciphers"
+
+hvKvmSpiceUseTls :: String
+hvKvmSpiceUseTls = "spice_use_tls"
+
+hvKvmSpiceUseVdagent :: String
+hvKvmSpiceUseVdagent = "spice_use_vdagent"
+
+hvKvmSpiceZlibGlzImgCompr :: String
+hvKvmSpiceZlibGlzImgCompr = "spice_zlib_glz_wan_compression"
+
+hvKvmUseChroot :: String
+hvKvmUseChroot = "use_chroot"
+
+hvMemPath :: String
+hvMemPath = "mem_path"
+
+hvMigrationBandwidth :: String
+hvMigrationBandwidth = "migration_bandwidth"
+
+hvMigrationDowntime :: String
+hvMigrationDowntime = "migration_downtime"
+
+hvMigrationMode :: String
+hvMigrationMode = "migration_mode"
+
+hvMigrationPort :: String
+hvMigrationPort = "migration_port"
+
+hvNicType :: String
+hvNicType = "nic_type"
+
+hvPae :: String
+hvPae = "pae"
+
+hvPassthrough :: String
+hvPassthrough = "pci_pass"
+
+hvRebootBehavior :: String
+hvRebootBehavior = "reboot_behavior"
+
+hvRootPath :: String
+hvRootPath = "root_path"
+
+hvSecurityDomain :: String
+hvSecurityDomain = "security_domain"
+
+hvSecurityModel :: String
+hvSecurityModel = "security_model"
+
+hvSerialConsole :: String
+hvSerialConsole = "serial_console"
+
+hvSerialSpeed :: String
+hvSerialSpeed = "serial_speed"
+
+hvSoundhw :: String
+hvSoundhw = "soundhw"
+
+hvUsbDevices :: String
+hvUsbDevices = "usb_devices"
+
+hvUsbMouse :: String
+hvUsbMouse = "usb_mouse"
+
+hvUseBootloader :: String
+hvUseBootloader = "use_bootloader"
+
+hvUseLocaltime :: String
+hvUseLocaltime = "use_localtime"
+
+hvVga :: String
+hvVga = "vga"
+
+hvVhostNet :: String
+hvVhostNet = "vhost_net"
+
+hvVifScript :: String
+hvVifScript = "vif_script"
+
+hvVifType :: String
+hvVifType = "vif_type"
+
+hvViridian :: String
+hvViridian = "viridian"
+
+hvVncBindAddress :: String
+hvVncBindAddress = "vnc_bind_address"
+
+hvVncPasswordFile :: String
+hvVncPasswordFile = "vnc_password_file"
+
+hvVncTls :: String
+hvVncTls = "vnc_tls"
+
+hvVncX509 :: String
+hvVncX509 = "vnc_x509_path"
+
+hvVncX509Verify :: String
+hvVncX509Verify = "vnc_x509_verify"
+
+hvVnetHdr :: String
+hvVnetHdr = "vnet_hdr"
+
+hvXenCmd :: String
+hvXenCmd = "xen_cmd"
+
+hvXenCpuid :: String
+hvXenCpuid = "cpuid"
+
+hvsParameterTitles :: Map String String
+hvsParameterTitles =
+ Map.fromList
+ [(hvAcpi, "ACPI"),
+ (hvBootOrder, "Boot_order"),
+ (hvCdromImagePath, "CDROM_image_path"),
+ (hvCpuType, "cpu_type"),
+ (hvDiskType, "Disk_type"),
+ (hvInitrdPath, "Initrd_path"),
+ (hvKernelPath, "Kernel_path"),
+ (hvNicType, "NIC_type"),
+ (hvPae, "PAE"),
+ (hvPassthrough, "pci_pass"),
+ (hvVncBindAddress, "VNC_bind_address")]
+
+hvsParameters :: FrozenSet String
+hvsParameters = ConstantUtils.mkSet $ Map.keys hvsParameterTypes
+
+hvsParameterTypes :: Map String VType
+hvsParameterTypes = Map.fromList
+ [ (hvAcpi, VTypeBool)
+ , (hvBlockdevPrefix, VTypeString)
+ , (hvBootloaderArgs, VTypeString)
+ , (hvBootloaderPath, VTypeString)
+ , (hvBootOrder, VTypeString)
+ , (hvCdromImagePath, VTypeString)
+ , (hvCpuCap, VTypeInt)
+ , (hvCpuCores, VTypeInt)
+ , (hvCpuMask, VTypeString)
+ , (hvCpuSockets, VTypeInt)
+ , (hvCpuThreads, VTypeInt)
+ , (hvCpuType, VTypeString)
+ , (hvCpuWeight, VTypeInt)
+ , (hvDeviceModel, VTypeString)
+ , (hvDiskCache, VTypeString)
+ , (hvDiskType, VTypeString)
+ , (hvInitrdPath, VTypeString)
+ , (hvInitScript, VTypeString)
+ , (hvKernelArgs, VTypeString)
+ , (hvKernelPath, VTypeString)
+ , (hvKeymap, VTypeString)
+ , (hvKvmCdrom2ImagePath, VTypeString)
+ , (hvKvmCdromDiskType, VTypeString)
+ , (hvKvmExtra, VTypeString)
+ , (hvKvmFlag, VTypeString)
+ , (hvKvmFloppyImagePath, VTypeString)
+ , (hvKvmMachineVersion, VTypeString)
+ , (hvKvmPath, VTypeString)
+ , (hvKvmSpiceAudioCompr, VTypeBool)
+ , (hvKvmSpiceBind, VTypeString)
+ , (hvKvmSpiceIpVersion, VTypeInt)
+ , (hvKvmSpiceJpegImgCompr, VTypeString)
+ , (hvKvmSpiceLosslessImgCompr, VTypeString)
+ , (hvKvmSpicePasswordFile, VTypeString)
+ , (hvKvmSpiceStreamingVideoDetection, VTypeString)
+ , (hvKvmSpiceTlsCiphers, VTypeString)
+ , (hvKvmSpiceUseTls, VTypeBool)
+ , (hvKvmSpiceUseVdagent, VTypeBool)
+ , (hvKvmSpiceZlibGlzImgCompr, VTypeString)
+ , (hvKvmUseChroot, VTypeBool)
+ , (hvMemPath, VTypeString)
+ , (hvMigrationBandwidth, VTypeInt)
+ , (hvMigrationDowntime, VTypeInt)
+ , (hvMigrationMode, VTypeString)
+ , (hvMigrationPort, VTypeInt)
+ , (hvNicType, VTypeString)
+ , (hvPae, VTypeBool)
+ , (hvPassthrough, VTypeString)
+ , (hvRebootBehavior, VTypeString)
+ , (hvRootPath, VTypeMaybeString)
+ , (hvSecurityDomain, VTypeString)
+ , (hvSecurityModel, VTypeString)
+ , (hvSerialConsole, VTypeBool)
+ , (hvSerialSpeed, VTypeInt)
+ , (hvSoundhw, VTypeString)
+ , (hvUsbDevices, VTypeString)
+ , (hvUsbMouse, VTypeString)
+ , (hvUseBootloader, VTypeBool)
+ , (hvUseLocaltime, VTypeBool)
+ , (hvVga, VTypeString)
+ , (hvVhostNet, VTypeBool)
+ , (hvVifScript, VTypeString)
+ , (hvVifType, VTypeString)
+ , (hvViridian, VTypeBool)
+ , (hvVncBindAddress, VTypeString)
+ , (hvVncPasswordFile, VTypeString)
+ , (hvVncTls, VTypeBool)
+ , (hvVncX509, VTypeString)
+ , (hvVncX509Verify, VTypeBool)
+ , (hvVnetHdr, VTypeBool)
+ , (hvXenCmd, VTypeString)
+ , (hvXenCpuid, VTypeString)
+ ]
+
+-- * Migration statuses
+
+hvMigrationActive :: String
+hvMigrationActive = "active"
+
+hvMigrationCancelled :: String
+hvMigrationCancelled = "cancelled"
+
+hvMigrationCompleted :: String
+hvMigrationCompleted = "completed"
+
+hvMigrationFailed :: String
+hvMigrationFailed = "failed"
+
+hvMigrationValidStatuses :: FrozenSet String
+hvMigrationValidStatuses =
+ ConstantUtils.mkSet [hvMigrationActive,
+ hvMigrationCancelled,
+ hvMigrationCompleted,
+ hvMigrationFailed]
+
+hvMigrationFailedStatuses :: FrozenSet String
+hvMigrationFailedStatuses =
+ ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled]
+
+-- | KVM-specific statuses
+--
+-- FIXME: this constant seems unnecessary
+hvKvmMigrationValidStatuses :: FrozenSet String
+hvKvmMigrationValidStatuses = hvMigrationValidStatuses
+
+-- | Node info keys
+hvNodeinfoKeyVersion :: String
+hvNodeinfoKeyVersion = "hv_version"
+
+-- * Hypervisor state
+
+hvstCpuNode :: String
+hvstCpuNode = "cpu_node"
+
+hvstCpuTotal :: String
+hvstCpuTotal = "cpu_total"
+
+hvstMemoryHv :: String
+hvstMemoryHv = "mem_hv"
+
+hvstMemoryNode :: String
+hvstMemoryNode = "mem_node"
+
+hvstMemoryTotal :: String
+hvstMemoryTotal = "mem_total"
+
+hvstsParameters :: FrozenSet String
+hvstsParameters =
+ ConstantUtils.mkSet [hvstCpuNode,
+ hvstCpuTotal,
+ hvstMemoryHv,
+ hvstMemoryNode,
+ hvstMemoryTotal]
+
+hvstDefaults :: Map String Int
+hvstDefaults =
+ Map.fromList
+ [(hvstCpuNode, 1),
+ (hvstCpuTotal, 1),
+ (hvstMemoryHv, 0),
+ (hvstMemoryTotal, 0),
+ (hvstMemoryNode, 0)]
+
+hvstsParameterTypes :: Map String VType
+hvstsParameterTypes =
+ Map.fromList [(hvstMemoryTotal, VTypeInt),
+ (hvstMemoryNode, VTypeInt),
+ (hvstMemoryHv, VTypeInt),
+ (hvstCpuTotal, VTypeInt),
+ (hvstCpuNode, VTypeInt)]
+
+-- * Disk state
+
+dsDiskOverhead :: String
+dsDiskOverhead = "disk_overhead"
+
+dsDiskReserved :: String
+dsDiskReserved = "disk_reserved"
+
+dsDiskTotal :: String
+dsDiskTotal = "disk_total"
+
+dsDefaults :: Map String Int
+dsDefaults =
+ Map.fromList
+ [(dsDiskTotal, 0),
+ (dsDiskReserved, 0),
+ (dsDiskOverhead, 0)]
+
+dssParameterTypes :: Map String VType
+dssParameterTypes =
+ Map.fromList [(dsDiskTotal, VTypeInt),
+ (dsDiskReserved, VTypeInt),
+ (dsDiskOverhead, VTypeInt)]
+
+dssParameters :: FrozenSet String
+dssParameters =
+ ConstantUtils.mkSet [dsDiskTotal, dsDiskReserved, dsDiskOverhead]
+
+dsValidTypes :: FrozenSet String
+dsValidTypes = ConstantUtils.mkSet [Types.diskTemplateToRaw DTPlain]
+
+-- Backend parameter names
+
+beAlwaysFailover :: String
+beAlwaysFailover = "always_failover"
+
+beAutoBalance :: String
+beAutoBalance = "auto_balance"
+
+beMaxmem :: String
+beMaxmem = "maxmem"
+
+-- | Deprecated and replaced by max and min mem
+beMemory :: String
+beMemory = "memory"
+
+beMinmem :: String
+beMinmem = "minmem"
+
+beSpindleUse :: String
+beSpindleUse = "spindle_use"
+
+beVcpus :: String
+beVcpus = "vcpus"
+
+besParameterTypes :: Map String VType
+besParameterTypes =
+ Map.fromList [(beAlwaysFailover, VTypeBool),
+ (beAutoBalance, VTypeBool),
+ (beMaxmem, VTypeSize),
+ (beMinmem, VTypeSize),
+ (beSpindleUse, VTypeInt),
+ (beVcpus, VTypeInt)]
+
+besParameterTitles :: Map String String
+besParameterTitles =
+ Map.fromList [(beAutoBalance, "Auto_balance"),
+ (beMinmem, "ConfigMinMem"),
+ (beVcpus, "ConfigVCPUs"),
+ (beMaxmem, "ConfigMaxMem")]
+
+besParameterCompat :: Map String VType
+besParameterCompat = Map.insert beMemory VTypeSize besParameterTypes
+
+besParameters :: FrozenSet String
+besParameters =
+ ConstantUtils.mkSet [beAlwaysFailover,
+ beAutoBalance,
+ beMaxmem,
+ beMinmem,
+ beSpindleUse,
+ beVcpus]
+
+-- | Instance specs
+--
+-- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
+
+ispecMemSize :: String
+ispecMemSize = ConstantUtils.ispecMemSize
+
+ispecCpuCount :: String
+ispecCpuCount = ConstantUtils.ispecCpuCount
+
+ispecDiskCount :: String
+ispecDiskCount = ConstantUtils.ispecDiskCount
+
+ispecDiskSize :: String
+ispecDiskSize = ConstantUtils.ispecDiskSize
+
+ispecNicCount :: String
+ispecNicCount = ConstantUtils.ispecNicCount
+
+ispecSpindleUse :: String
+ispecSpindleUse = ConstantUtils.ispecSpindleUse
+
+ispecsParameterTypes :: Map String VType
+ispecsParameterTypes =
+ Map.fromList
+ [(ConstantUtils.ispecDiskSize, VTypeInt),
+ (ConstantUtils.ispecCpuCount, VTypeInt),
+ (ConstantUtils.ispecSpindleUse, VTypeInt),
+ (ConstantUtils.ispecMemSize, VTypeInt),
+ (ConstantUtils.ispecNicCount, VTypeInt),
+ (ConstantUtils.ispecDiskCount, VTypeInt)]
+
+ispecsParameters :: FrozenSet String
+ispecsParameters =
+ ConstantUtils.mkSet [ConstantUtils.ispecCpuCount,
+ ConstantUtils.ispecDiskCount,
+ ConstantUtils.ispecDiskSize,
+ ConstantUtils.ispecMemSize,
+ ConstantUtils.ispecNicCount,
+ ConstantUtils.ispecSpindleUse]
+
+ispecsMinmax :: String
+ispecsMinmax = ConstantUtils.ispecsMinmax
+
+ispecsMax :: String
+ispecsMax = "max"
+
+ispecsMin :: String
+ispecsMin = "min"
+
+ispecsStd :: String
+ispecsStd = ConstantUtils.ispecsStd
+
+ipolicyDts :: String
+ipolicyDts = ConstantUtils.ipolicyDts
+
+ipolicyVcpuRatio :: String
+ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio
+
+ipolicySpindleRatio :: String
+ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio
+
+ispecsMinmaxKeys :: FrozenSet String
+ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin]
+
+ipolicyParameters :: FrozenSet String
+ipolicyParameters =
+ ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio,
+ ConstantUtils.ipolicySpindleRatio]
+
+ipolicyAllKeys :: FrozenSet String
+ipolicyAllKeys =
+ ConstantUtils.union ipolicyParameters $
+ ConstantUtils.mkSet [ConstantUtils.ipolicyDts,
+ ConstantUtils.ispecsMinmax,
+ ispecsStd]
+
+-- | Node parameter names
+
+ndExclusiveStorage :: String
+ndExclusiveStorage = "exclusive_storage"
+
+ndOobProgram :: String
+ndOobProgram = "oob_program"
+
+ndSpindleCount :: String
+ndSpindleCount = "spindle_count"
+
+ndOvs :: String
+ndOvs = "ovs"
+
+ndOvsLink :: String
+ndOvsLink = "ovs_link"
+
+ndOvsName :: String
+ndOvsName = "ovs_name"
+
+ndSshPort :: String
+ndSshPort = "ssh_port"
+
+ndsParameterTypes :: Map String VType
+ndsParameterTypes =
+ Map.fromList
+ [(ndExclusiveStorage, VTypeBool),
+ (ndOobProgram, VTypeString),
+ (ndOvs, VTypeBool),
+ (ndOvsLink, VTypeMaybeString),
+ (ndOvsName, VTypeMaybeString),
+ (ndSpindleCount, VTypeInt),
+ (ndSshPort, VTypeInt)]
+
+ndsParameters :: FrozenSet String
+ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
+
+ndsParameterTitles :: Map String String
+ndsParameterTitles =
+ Map.fromList
+ [(ndExclusiveStorage, "ExclusiveStorage"),
+ (ndOobProgram, "OutOfBandProgram"),
+ (ndOvs, "OpenvSwitch"),
+ (ndOvsLink, "OpenvSwitchLink"),
+ (ndOvsName, "OpenvSwitchName"),
+ (ndSpindleCount, "SpindleCount")]
+
+-- * Logical Disks parameters
+
+ldpAccess :: String
+ldpAccess = "access"
+
+ldpBarriers :: String
+ldpBarriers = "disabled-barriers"
+
+ldpDefaultMetavg :: String
+ldpDefaultMetavg = "default-metavg"
+
+ldpDelayTarget :: String
+ldpDelayTarget = "c-delay-target"
+
+ldpDiskCustom :: String
+ldpDiskCustom = "disk-custom"
+
+ldpDynamicResync :: String
+ldpDynamicResync = "dynamic-resync"
+
+ldpFillTarget :: String
+ldpFillTarget = "c-fill-target"
+
+ldpMaxRate :: String
+ldpMaxRate = "c-max-rate"
+
+ldpMinRate :: String
+ldpMinRate = "c-min-rate"
+
+ldpNetCustom :: String
+ldpNetCustom = "net-custom"
+
+ldpNoMetaFlush :: String
+ldpNoMetaFlush = "disable-meta-flush"
+
+ldpPlanAhead :: String
+ldpPlanAhead = "c-plan-ahead"
+
+ldpPool :: String
+ldpPool = "pool"
+
+ldpProtocol :: String
+ldpProtocol = "protocol"
+
+ldpResyncRate :: String
+ldpResyncRate = "resync-rate"
+
+ldpStripes :: String
+ldpStripes = "stripes"
+
+diskLdTypes :: Map String VType
+diskLdTypes =
+ Map.fromList
+ [(ldpAccess, VTypeString),
+ (ldpResyncRate, VTypeInt),
+ (ldpStripes, VTypeInt),
+ (ldpBarriers, VTypeString),
+ (ldpNoMetaFlush, VTypeBool),
+ (ldpDefaultMetavg, VTypeString),
+ (ldpDiskCustom, VTypeString),
+ (ldpNetCustom, VTypeString),
+ (ldpProtocol, VTypeString),
+ (ldpDynamicResync, VTypeBool),
+ (ldpPlanAhead, VTypeInt),
+ (ldpFillTarget, VTypeInt),
+ (ldpDelayTarget, VTypeInt),
+ (ldpMaxRate, VTypeInt),
+ (ldpMinRate, VTypeInt),
+ (ldpPool, VTypeString)]
+
+diskLdParameters :: FrozenSet String
+diskLdParameters = ConstantUtils.mkSet (Map.keys diskLdTypes)
+
+-- * Disk template parameters
+--
+-- Disk template parameters can be set/changed by the user via
+-- gnt-cluster and gnt-group)
+
+drbdResyncRate :: String
+drbdResyncRate = "resync-rate"
+
+drbdDataStripes :: String
+drbdDataStripes = "data-stripes"
+
+drbdMetaStripes :: String
+drbdMetaStripes = "meta-stripes"
+
+drbdDiskBarriers :: String
+drbdDiskBarriers = "disk-barriers"
+
+drbdMetaBarriers :: String
+drbdMetaBarriers = "meta-barriers"
+
+drbdDefaultMetavg :: String
+drbdDefaultMetavg = "metavg"
+
+drbdDiskCustom :: String
+drbdDiskCustom = "disk-custom"
+
+drbdNetCustom :: String
+drbdNetCustom = "net-custom"
+
+drbdProtocol :: String
+drbdProtocol = "protocol"
+
+drbdDynamicResync :: String
+drbdDynamicResync = "dynamic-resync"
+
+drbdPlanAhead :: String
+drbdPlanAhead = "c-plan-ahead"
+
+drbdFillTarget :: String
+drbdFillTarget = "c-fill-target"
+
+drbdDelayTarget :: String
+drbdDelayTarget = "c-delay-target"
+
+drbdMaxRate :: String
+drbdMaxRate = "c-max-rate"
+
+drbdMinRate :: String
+drbdMinRate = "c-min-rate"
+
+lvStripes :: String
+lvStripes = "stripes"
+
+rbdAccess :: String
+rbdAccess = "access"
+
+rbdPool :: String
+rbdPool = "pool"
+
+diskDtTypes :: Map String VType
+diskDtTypes =
+ Map.fromList [(drbdResyncRate, VTypeInt),
+ (drbdDataStripes, VTypeInt),
+ (drbdMetaStripes, VTypeInt),
+ (drbdDiskBarriers, VTypeString),
+ (drbdMetaBarriers, VTypeBool),
+ (drbdDefaultMetavg, VTypeString),
+ (drbdDiskCustom, VTypeString),
+ (drbdNetCustom, VTypeString),
+ (drbdProtocol, VTypeString),
+ (drbdDynamicResync, VTypeBool),
+ (drbdPlanAhead, VTypeInt),
+ (drbdFillTarget, VTypeInt),
+ (drbdDelayTarget, VTypeInt),
+ (drbdMaxRate, VTypeInt),
+ (drbdMinRate, VTypeInt),
+ (lvStripes, VTypeInt),
+ (rbdAccess, VTypeString),
+ (rbdPool, VTypeString)]
+
+diskDtParameters :: FrozenSet String
+diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes)
+
+-- * Dynamic disk parameters
+
+ddpLocalIp :: String
+ddpLocalIp = "local-ip"
+
+ddpRemoteIp :: String
+ddpRemoteIp = "remote-ip"
+
+ddpPort :: String
+ddpPort = "port"
+
+ddpLocalMinor :: String
+ddpLocalMinor = "local-minor"
+
+ddpRemoteMinor :: String
+ddpRemoteMinor = "remote-minor"
+
+-- * OOB supported commands
+
+oobPowerOn :: String
+oobPowerOn = Types.oobCommandToRaw OobPowerOn
+
+oobPowerOff :: String
+oobPowerOff = Types.oobCommandToRaw OobPowerOff
+
+oobPowerCycle :: String
+oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
+
+oobPowerStatus :: String
+oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
+
+oobHealth :: String
+oobHealth = Types.oobCommandToRaw OobHealth
+
+oobCommands :: FrozenSet String
+oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
+
+oobPowerStatusPowered :: String
+oobPowerStatusPowered = "powered"
+
+-- | 60 seconds
+oobTimeout :: Int
+oobTimeout = 60
+
+-- | 2 seconds
+oobPowerDelay :: Double
+oobPowerDelay = 2.0
+
+oobStatusCritical :: String
+oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
+
+oobStatusOk :: String
+oobStatusOk = Types.oobStatusToRaw OobStatusOk
+
+oobStatusUnknown :: String
+oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
+
+oobStatusWarning :: String
+oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
+
+oobStatuses :: FrozenSet String
+oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
+
+-- | Instance Parameters Profile
+ppDefault :: String
+ppDefault = "default"
+
+-- * nic* constants are used inside the ganeti config
+
+nicLink :: String
+nicLink = "link"
+
+nicMode :: String
+nicMode = "mode"
+
+nicVlan :: String
+nicVlan = "vlan"
+
+nicsParameterTypes :: Map String VType
+nicsParameterTypes =
+ Map.fromList [(nicMode, vtypeString),
+ (nicLink, vtypeString),
+ (nicVlan, vtypeString)]
+
+nicsParameters :: FrozenSet String
+nicsParameters = ConstantUtils.mkSet (Map.keys nicsParameterTypes)
+
+nicModeBridged :: String
+nicModeBridged = Types.nICModeToRaw NMBridged
+
+nicModeRouted :: String
+nicModeRouted = Types.nICModeToRaw NMRouted
+
+nicModeOvs :: String
+nicModeOvs = Types.nICModeToRaw NMOvs
+
+nicIpPool :: String
+nicIpPool = Types.nICModeToRaw NMPool
+
+nicValidModes :: FrozenSet String
+nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
+
+releaseAction :: String
+releaseAction = "release"
+
+reserveAction :: String
+reserveAction = "reserve"
+
+-- * idisk* constants are used in opcodes, to create/change disks
+
+idiskAdopt :: String
+idiskAdopt = "adopt"
+
+idiskMetavg :: String
+idiskMetavg = "metavg"
+
+idiskMode :: String
+idiskMode = "mode"
+
+idiskName :: String
+idiskName = "name"
+
+idiskSize :: String
+idiskSize = "size"
+
+idiskSpindles :: String
+idiskSpindles = "spindles"
+
+idiskVg :: String
+idiskVg = "vg"
+
+idiskProvider :: String
+idiskProvider = "provider"
+
+idiskParamsTypes :: Map String VType
+idiskParamsTypes =
+ Map.fromList [(idiskSize, VTypeSize),
+ (idiskSpindles, VTypeInt),
+ (idiskMode, VTypeString),
+ (idiskAdopt, VTypeString),
+ (idiskVg, VTypeString),
+ (idiskMetavg, VTypeString),
+ (idiskProvider, VTypeString),
+ (idiskName, VTypeMaybeString)]
+
+idiskParams :: FrozenSet String
+idiskParams = ConstantUtils.mkSet (Map.keys idiskParamsTypes)
+
+-- * inic* constants are used in opcodes, to create/change nics
+
+inicBridge :: String
+inicBridge = "bridge"
+
+inicIp :: String
+inicIp = "ip"
+
+inicLink :: String
+inicLink = "link"
+
+inicMac :: String
+inicMac = "mac"
+
+inicMode :: String
+inicMode = "mode"
+
+inicName :: String
+inicName = "name"
+
+inicNetwork :: String
+inicNetwork = "network"
+
+inicVlan :: String
+inicVlan = "vlan"
+
+inicParamsTypes :: Map String VType
+inicParamsTypes =
+ Map.fromList [(inicBridge, VTypeMaybeString),
+ (inicIp, VTypeMaybeString),
+ (inicLink, VTypeString),
+ (inicMac, VTypeString),
+ (inicMode, VTypeString),
+ (inicName, VTypeMaybeString),
+ (inicNetwork, VTypeMaybeString),
+ (inicVlan, VTypeMaybeString)]
+
+inicParams :: FrozenSet String
+inicParams = ConstantUtils.mkSet (Map.keys inicParamsTypes)
+
+-- * Hypervisor constants
+
+htXenPvm :: String
+htXenPvm = Types.hypervisorToRaw XenPvm
+
+htFake :: String
+htFake = Types.hypervisorToRaw Fake
+
+htXenHvm :: String
+htXenHvm = Types.hypervisorToRaw XenHvm
+
+htKvm :: String
+htKvm = Types.hypervisorToRaw Kvm
+
+htChroot :: String
+htChroot = Types.hypervisorToRaw Chroot
+
+htLxc :: String
+htLxc = Types.hypervisorToRaw Lxc
+
+hyperTypes :: FrozenSet String
+hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
+
+htsReqPort :: FrozenSet String
+htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
+
+vncBasePort :: Int
+vncBasePort = 5900
+
+vncDefaultBindAddress :: String
+vncDefaultBindAddress = ip4AddressAny
+
+-- * NIC types
+
+htNicE1000 :: String
+htNicE1000 = "e1000"
+
+htNicI82551 :: String
+htNicI82551 = "i82551"
+
+htNicI8259er :: String
+htNicI8259er = "i82559er"
+
+htNicI85557b :: String
+htNicI85557b = "i82557b"
+
+htNicNe2kIsa :: String
+htNicNe2kIsa = "ne2k_isa"
+
+htNicNe2kPci :: String
+htNicNe2kPci = "ne2k_pci"
+
+htNicParavirtual :: String
+htNicParavirtual = "paravirtual"
+
+htNicPcnet :: String
+htNicPcnet = "pcnet"
+
+htNicRtl8139 :: String
+htNicRtl8139 = "rtl8139"
+
+htHvmValidNicTypes :: FrozenSet String
+htHvmValidNicTypes =
+ ConstantUtils.mkSet [htNicE1000,
+ htNicNe2kIsa,
+ htNicNe2kPci,
+ htNicParavirtual,
+ htNicRtl8139]
+
+htKvmValidNicTypes :: FrozenSet String
+htKvmValidNicTypes =
+ ConstantUtils.mkSet [htNicE1000,
+ htNicI82551,
+ htNicI8259er,
+ htNicI85557b,
+ htNicNe2kIsa,
+ htNicNe2kPci,
+ htNicParavirtual,
+ htNicPcnet,
+ htNicRtl8139]
+
+-- * Vif types
+
+-- | Default vif type in xen-hvm
+htHvmVifIoemu :: String
+htHvmVifIoemu = "ioemu"
+
+htHvmVifVif :: String
+htHvmVifVif = "vif"
+
+htHvmValidVifTypes :: FrozenSet String
+htHvmValidVifTypes = ConstantUtils.mkSet [htHvmVifIoemu, htHvmVifVif]
+
+-- * Disk types
+
+htDiskIde :: String
+htDiskIde = "ide"
+
+htDiskIoemu :: String
+htDiskIoemu = "ioemu"
+
+htDiskMtd :: String
+htDiskMtd = "mtd"
+
+htDiskParavirtual :: String
+htDiskParavirtual = "paravirtual"
+
+htDiskPflash :: String
+htDiskPflash = "pflash"
+
+htDiskScsi :: String
+htDiskScsi = "scsi"
+
+htDiskSd :: String
+htDiskSd = "sd"
+
+htHvmValidDiskTypes :: FrozenSet String
+htHvmValidDiskTypes = ConstantUtils.mkSet [htDiskIoemu, htDiskParavirtual]
+
+htKvmValidDiskTypes :: FrozenSet String
+htKvmValidDiskTypes =
+ ConstantUtils.mkSet [htDiskIde,
+ htDiskMtd,
+ htDiskParavirtual,
+ htDiskPflash,
+ htDiskScsi,
+ htDiskSd]
+
+htCacheDefault :: String
+htCacheDefault = "default"
+
+htCacheNone :: String
+htCacheNone = "none"
+
+htCacheWback :: String
+htCacheWback = "writeback"
+
+htCacheWthrough :: String
+htCacheWthrough = "writethrough"
+
+htValidCacheTypes :: FrozenSet String
+htValidCacheTypes =
+ ConstantUtils.mkSet [htCacheDefault,
+ htCacheNone,
+ htCacheWback,
+ htCacheWthrough]
+
+-- * Mouse types
+
+htMouseMouse :: String
+htMouseMouse = "mouse"
+
+htMouseTablet :: String
+htMouseTablet = "tablet"
+
+htKvmValidMouseTypes :: FrozenSet String
+htKvmValidMouseTypes = ConstantUtils.mkSet [htMouseMouse, htMouseTablet]
+
+-- * Boot order
+
+htBoCdrom :: String
+htBoCdrom = "cdrom"
+
+htBoDisk :: String
+htBoDisk = "disk"
+
+htBoFloppy :: String
+htBoFloppy = "floppy"
+
+htBoNetwork :: String
+htBoNetwork = "network"
+
+htKvmValidBoTypes :: FrozenSet String
+htKvmValidBoTypes =
+ ConstantUtils.mkSet [htBoCdrom, htBoDisk, htBoFloppy, htBoNetwork]
+
+-- * SPICE lossless image compression options
+
+htKvmSpiceLosslessImgComprAutoGlz :: String
+htKvmSpiceLosslessImgComprAutoGlz = "auto_glz"
+
+htKvmSpiceLosslessImgComprAutoLz :: String
+htKvmSpiceLosslessImgComprAutoLz = "auto_lz"
+
+htKvmSpiceLosslessImgComprGlz :: String
+htKvmSpiceLosslessImgComprGlz = "glz"
+
+htKvmSpiceLosslessImgComprLz :: String
+htKvmSpiceLosslessImgComprLz = "lz"
+
+htKvmSpiceLosslessImgComprOff :: String
+htKvmSpiceLosslessImgComprOff = "off"
+
+htKvmSpiceLosslessImgComprQuic :: String
+htKvmSpiceLosslessImgComprQuic = "quic"
+
+htKvmSpiceValidLosslessImgComprOptions :: FrozenSet String
+htKvmSpiceValidLosslessImgComprOptions =
+ ConstantUtils.mkSet [htKvmSpiceLosslessImgComprAutoGlz,
+ htKvmSpiceLosslessImgComprAutoLz,
+ htKvmSpiceLosslessImgComprGlz,
+ htKvmSpiceLosslessImgComprLz,
+ htKvmSpiceLosslessImgComprOff,
+ htKvmSpiceLosslessImgComprQuic]
+
+htKvmSpiceLossyImgComprAlways :: String
+htKvmSpiceLossyImgComprAlways = "always"
+
+htKvmSpiceLossyImgComprAuto :: String
+htKvmSpiceLossyImgComprAuto = "auto"
+
+htKvmSpiceLossyImgComprNever :: String
+htKvmSpiceLossyImgComprNever = "never"
+
+htKvmSpiceValidLossyImgComprOptions :: FrozenSet String
+htKvmSpiceValidLossyImgComprOptions =
+ ConstantUtils.mkSet [htKvmSpiceLossyImgComprAlways,
+ htKvmSpiceLossyImgComprAuto,
+ htKvmSpiceLossyImgComprNever]
+
+-- * SPICE video stream detection
+
+htKvmSpiceVideoStreamDetectionAll :: String
+htKvmSpiceVideoStreamDetectionAll = "all"
+
+htKvmSpiceVideoStreamDetectionFilter :: String
+htKvmSpiceVideoStreamDetectionFilter = "filter"
+
+htKvmSpiceVideoStreamDetectionOff :: String
+htKvmSpiceVideoStreamDetectionOff = "off"
+
+htKvmSpiceValidVideoStreamDetectionOptions :: FrozenSet String
+htKvmSpiceValidVideoStreamDetectionOptions =
+ ConstantUtils.mkSet [htKvmSpiceVideoStreamDetectionAll,
+ htKvmSpiceVideoStreamDetectionFilter,
+ htKvmSpiceVideoStreamDetectionOff]
+
+-- * Security models
+
+htSmNone :: String
+htSmNone = "none"
+
+htSmPool :: String
+htSmPool = "pool"
+
+htSmUser :: String
+htSmUser = "user"
+
+htKvmValidSmTypes :: FrozenSet String
+htKvmValidSmTypes = ConstantUtils.mkSet [htSmNone, htSmPool, htSmUser]
+
+-- * Kvm flag values
+
+htKvmDisabled :: String
+htKvmDisabled = "disabled"
+
+htKvmEnabled :: String
+htKvmEnabled = "enabled"
+
+htKvmFlagValues :: FrozenSet String
+htKvmFlagValues = ConstantUtils.mkSet [htKvmDisabled, htKvmEnabled]
+
+-- * Migration type
+
+htMigrationLive :: String
+htMigrationLive = Types.migrationModeToRaw MigrationLive
+
+htMigrationNonlive :: String
+htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
+
+htMigrationModes :: FrozenSet String
+htMigrationModes =
+ ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
+
+-- * Cluster verify steps
+
+verifyNplusoneMem :: String
+verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
+
+verifyOptionalChecks :: FrozenSet String
+verifyOptionalChecks =
+ ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
+
+-- * Cluster Verify error classes
+
+cvTcluster :: String
+cvTcluster = "cluster"
+
+cvTgroup :: String
+cvTgroup = "group"
+
+cvTnode :: String
+cvTnode = "node"
+
+cvTinstance :: String
+cvTinstance = "instance"
+
+-- * Cluster Verify error codes and documentation
+
+cvEclustercert :: (String, String, String)
+cvEclustercert =
+ ("cluster",
+ Types.cVErrorCodeToRaw CvECLUSTERCERT,
+ "Cluster certificate files verification failure")
+
+cvEclustercfg :: (String, String, String)
+cvEclustercfg =
+ ("cluster",
+ Types.cVErrorCodeToRaw CvECLUSTERCFG,
+ "Cluster configuration verification failure")
+
+cvEclusterdanglinginst :: (String, String, String)
+cvEclusterdanglinginst =
+ ("node",
+ Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
+ "Some instances have a non-existing primary node")
+
+cvEclusterdanglingnodes :: (String, String, String)
+cvEclusterdanglingnodes =
+ ("node",
+ Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
+ "Some nodes belong to non-existing groups")
+
+cvEclusterfilecheck :: (String, String, String)
+cvEclusterfilecheck =
+ ("cluster",
+ Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
+ "Cluster configuration verification failure")
+
+cvEgroupdifferentpvsize :: (String, String, String)
+cvEgroupdifferentpvsize =
+ ("group",
+ Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
+ "PVs in the group have different sizes")
+
+cvEinstancebadnode :: (String, String, String)
+cvEinstancebadnode =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
+ "Instance marked as running lives on an offline node")
+
+cvEinstancedown :: (String, String, String)
+cvEinstancedown =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
+ "Instance not running on its primary node")
+
+cvEinstancefaultydisk :: (String, String, String)
+cvEinstancefaultydisk =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
+ "Impossible to retrieve status for a disk")
+
+cvEinstancelayout :: (String, String, String)
+cvEinstancelayout =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
+ "Instance has multiple secondary nodes")
+
+cvEinstancemissingcfgparameter :: (String, String, String)
+cvEinstancemissingcfgparameter =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
+ "A configuration parameter for an instance is missing")
+
+cvEinstancemissingdisk :: (String, String, String)
+cvEinstancemissingdisk =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
+ "Missing volume on an instance")
+
+cvEinstancepolicy :: (String, String, String)
+cvEinstancepolicy =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
+ "Instance does not meet policy")
+
+cvEinstancesplitgroups :: (String, String, String)
+cvEinstancesplitgroups =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
+ "Instance with primary and secondary nodes in different groups")
+
+cvEinstanceunsuitablenode :: (String, String, String)
+cvEinstanceunsuitablenode =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
+ "Instance running on nodes that are not suitable for it")
+
+cvEinstancewrongnode :: (String, String, String)
+cvEinstancewrongnode =
+ ("instance",
+ Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
+ "Instance running on the wrong node")
+
+cvEnodedrbd :: (String, String, String)
+cvEnodedrbd =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEDRBD,
+ "Error parsing the DRBD status file")
+
+cvEnodedrbdhelper :: (String, String, String)
+cvEnodedrbdhelper =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
+ "Error caused by the DRBD helper")
+
+cvEnodedrbdversion :: (String, String, String)
+cvEnodedrbdversion =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
+ "DRBD version mismatch within a node group")
+
+cvEnodefilecheck :: (String, String, String)
+cvEnodefilecheck =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEFILECHECK,
+ "Error retrieving the checksum of the node files")
+
+cvEnodefilestoragepaths :: (String, String, String)
+cvEnodefilestoragepaths =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
+ "Detected bad file storage paths")
+
+cvEnodefilestoragepathunusable :: (String, String, String)
+cvEnodefilestoragepathunusable =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
+ "File storage path unusable")
+
+cvEnodehooks :: (String, String, String)
+cvEnodehooks =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEHOOKS,
+ "Communication failure in hooks execution")
+
+cvEnodehv :: (String, String, String)
+cvEnodehv =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEHV,
+ "Hypervisor parameters verification failure")
+
+cvEnodelvm :: (String, String, String)
+cvEnodelvm =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODELVM,
+ "LVM-related node error")
+
+cvEnoden1 :: (String, String, String)
+cvEnoden1 =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEN1,
+ "Not enough memory to accommodate instance failovers")
+
+cvEnodenet :: (String, String, String)
+cvEnodenet =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODENET,
+ "Network-related node error")
+
+cvEnodeoobpath :: (String, String, String)
+cvEnodeoobpath =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEOOBPATH,
+ "Invalid Out Of Band path")
+
+cvEnodeorphaninstance :: (String, String, String)
+cvEnodeorphaninstance =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
+ "Unknown intance running on a node")
+
+cvEnodeorphanlv :: (String, String, String)
+cvEnodeorphanlv =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEORPHANLV,
+ "Unknown LVM logical volume")
+
+cvEnodeos :: (String, String, String)
+cvEnodeos =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEOS,
+ "OS-related node error")
+
+cvEnoderpc :: (String, String, String)
+cvEnoderpc =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODERPC,
+ "Error during connection to the primary node of an instance")
+
+cvEnodesetup :: (String, String, String)
+cvEnodesetup =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODESETUP,
+ "Node setup error")
+
+cvEnodesharedfilestoragepathunusable :: (String, String, String)
+cvEnodesharedfilestoragepathunusable =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
+ "Shared file storage path unusable")
+
+cvEnodessh :: (String, String, String)
+cvEnodessh =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODESSH,
+ "SSH-related node error")
+
+cvEnodetime :: (String, String, String)
+cvEnodetime =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODETIME,
+ "Node returned invalid time")
+
+cvEnodeuserscripts :: (String, String, String)
+cvEnodeuserscripts =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
+ "User scripts not present or not executable")
+
+cvEnodeversion :: (String, String, String)
+cvEnodeversion =
+ ("node",
+ Types.cVErrorCodeToRaw CvENODEVERSION,
+ "Protocol version mismatch or Ganeti version mismatch")
+
+cvAllEcodes :: FrozenSet (String, String, String)
+cvAllEcodes =
+ ConstantUtils.mkSet
+ [cvEclustercert,
+ cvEclustercfg,
+ cvEclusterdanglinginst,
+ cvEclusterdanglingnodes,
+ cvEclusterfilecheck,
+ cvEgroupdifferentpvsize,
+ cvEinstancebadnode,
+ cvEinstancedown,
+ cvEinstancefaultydisk,
+ cvEinstancelayout,
+ cvEinstancemissingcfgparameter,
+ cvEinstancemissingdisk,
+ cvEinstancepolicy,
+ cvEinstancesplitgroups,
+ cvEinstanceunsuitablenode,
+ cvEinstancewrongnode,
+ cvEnodedrbd,
+ cvEnodedrbdhelper,
+ cvEnodedrbdversion,
+ cvEnodefilecheck,
+ cvEnodefilestoragepaths,
+ cvEnodefilestoragepathunusable,
+ cvEnodehooks,
+ cvEnodehv,
+ cvEnodelvm,
+ cvEnoden1,
+ cvEnodenet,
+ cvEnodeoobpath,
+ cvEnodeorphaninstance,
+ cvEnodeorphanlv,
+ cvEnodeos,
+ cvEnoderpc,
+ cvEnodesetup,
+ cvEnodesharedfilestoragepathunusable,
+ cvEnodessh,
+ cvEnodetime,
+ cvEnodeuserscripts,
+ cvEnodeversion]
+
+cvAllEcodesStrings :: FrozenSet String
+cvAllEcodesStrings =
+ ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
+
+-- * Node verify constants
+
+nvBridges :: String
+nvBridges = "bridges"
+
+nvDrbdhelper :: String
+nvDrbdhelper = "drbd-helper"
+
+nvDrbdversion :: String
+nvDrbdversion = "drbd-version"
+
+nvDrbdlist :: String
+nvDrbdlist = "drbd-list"
+
+nvExclusivepvs :: String
+nvExclusivepvs = "exclusive-pvs"
+
+nvFilelist :: String
+nvFilelist = "filelist"
+
+nvAcceptedStoragePaths :: String
+nvAcceptedStoragePaths = "allowed-file-storage-paths"
+
+nvFileStoragePath :: String
+nvFileStoragePath = "file-storage-path"
+
+nvSharedFileStoragePath :: String
+nvSharedFileStoragePath = "shared-file-storage-path"
+
+nvHvinfo :: String
+nvHvinfo = "hvinfo"
+
+nvHvparams :: String
+nvHvparams = "hvparms"
+
+nvHypervisor :: String
+nvHypervisor = "hypervisor"
+
+nvInstancelist :: String
+nvInstancelist = "instancelist"
+
+nvLvlist :: String
+nvLvlist = "lvlist"
+
+nvMasterip :: String
+nvMasterip = "master-ip"
+
+nvNodelist :: String
+nvNodelist = "nodelist"
+
+nvNodenettest :: String
+nvNodenettest = "node-net-test"
+
+nvNodesetup :: String
+nvNodesetup = "nodesetup"
+
+nvOobPaths :: String
+nvOobPaths = "oob-paths"
+
+nvOslist :: String
+nvOslist = "oslist"
+
+nvPvlist :: String
+nvPvlist = "pvlist"
+
+nvTime :: String
+nvTime = "time"
+
+nvUserscripts :: String
+nvUserscripts = "user-scripts"
+
+nvVersion :: String
+nvVersion = "version"
+
+nvVglist :: String
+nvVglist = "vglist"
+
+nvVmnodes :: String
+nvVmnodes = "vmnodes"
+
+-- * Instance status
+
+inststAdmindown :: String
+inststAdmindown = Types.instanceStatusToRaw StatusDown
+
+inststAdminoffline :: String
+inststAdminoffline = Types.instanceStatusToRaw StatusOffline
+
+inststErrordown :: String
+inststErrordown = Types.instanceStatusToRaw ErrorDown
+
+inststErrorup :: String
+inststErrorup = Types.instanceStatusToRaw ErrorUp
+
+inststNodedown :: String
+inststNodedown = Types.instanceStatusToRaw NodeDown
+
+inststNodeoffline :: String
+inststNodeoffline = Types.instanceStatusToRaw NodeOffline
+
+inststRunning :: String
+inststRunning = Types.instanceStatusToRaw Running
+
+inststUserdown :: String
+inststUserdown = Types.instanceStatusToRaw UserDown
+
+inststWrongnode :: String
+inststWrongnode = Types.instanceStatusToRaw WrongNode
+
+inststAll :: FrozenSet String
+inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
+
+-- * Admin states
+
+adminstDown :: String
+adminstDown = Types.adminStateToRaw AdminDown
+
+adminstOffline :: String
+adminstOffline = Types.adminStateToRaw AdminOffline
+
+adminstUp :: String
+adminstUp = Types.adminStateToRaw AdminUp
+
+adminstAll :: FrozenSet String
+adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
+
+-- * Node roles
+
+nrDrained :: String
+nrDrained = Types.nodeRoleToRaw NRDrained
+
+nrMaster :: String
+nrMaster = Types.nodeRoleToRaw NRMaster
+
+nrMcandidate :: String
+nrMcandidate = Types.nodeRoleToRaw NRCandidate
+
+nrOffline :: String
+nrOffline = Types.nodeRoleToRaw NROffline
+
+nrRegular :: String
+nrRegular = Types.nodeRoleToRaw NRRegular
+
+nrAll :: FrozenSet String
+nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
+
+-- * SSL certificate check constants (in days)
+
+sslCertExpirationError :: Int
+sslCertExpirationError = 7
+
+sslCertExpirationWarn :: Int
+sslCertExpirationWarn = 30
+
+-- * Allocator framework constants
+
+iallocatorVersion :: Int
+iallocatorVersion = 2
+
+iallocatorDirIn :: String
+iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
+
+iallocatorDirOut :: String
+iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
+
+validIallocatorDirections :: FrozenSet String
+validIallocatorDirections =
+ ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
+
+iallocatorModeAlloc :: String
+iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
+
+iallocatorModeChgGroup :: String
+iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
+
+iallocatorModeMultiAlloc :: String
+iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
+
+iallocatorModeNodeEvac :: String
+iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
+
+iallocatorModeReloc :: String
+iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
+
+validIallocatorModes :: FrozenSet String
+validIallocatorModes =
+ ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
+
+iallocatorSearchPath :: [String]
+iallocatorSearchPath = AutoConf.iallocatorSearchPath
+
+defaultIallocatorShortcut :: String
+defaultIallocatorShortcut = "."
+
+-- * Node evacuation
+
+nodeEvacPri :: String
+nodeEvacPri = Types.evacModeToRaw ChangePrimary
+
+nodeEvacSec :: String
+nodeEvacSec = Types.evacModeToRaw ChangeSecondary
+
+nodeEvacAll :: String
+nodeEvacAll = Types.evacModeToRaw ChangeAll
+
+nodeEvacModes :: FrozenSet String
+nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
+
+-- * Job queue
+
+jobQueueVersion :: Int
+jobQueueVersion = 1
+
+jobQueueSizeHardLimit :: Int
+jobQueueSizeHardLimit = 5000
+
+jobQueueFilesPerms :: Int
+jobQueueFilesPerms = 0o640
+
+-- * Unchanged job return
+
+jobNotchanged :: String
+jobNotchanged = "nochange"
+
+-- * Job status
+
+jobStatusQueued :: String
+jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
+
+jobStatusWaiting :: String
+jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
+
+jobStatusCanceling :: String
+jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
+
+jobStatusRunning :: String
+jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
+
+jobStatusCanceled :: String
+jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
+
+jobStatusSuccess :: String
+jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
+
+jobStatusError :: String
+jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
+
+jobsPending :: FrozenSet String
+jobsPending =
+ ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
+
+jobsFinalized :: FrozenSet String
+jobsFinalized =
+ ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
+
+jobStatusAll :: FrozenSet String
+jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
+
+-- * OpCode status
+
+-- ** Not yet finalized opcodes
+
+opStatusCanceling :: String
+opStatusCanceling = "canceling"
+
+opStatusQueued :: String
+opStatusQueued = "queued"
+
+opStatusRunning :: String
+opStatusRunning = "running"
+
+opStatusWaiting :: String
+opStatusWaiting = "waiting"
+
+-- ** Finalized opcodes
+
+opStatusCanceled :: String
+opStatusCanceled = "canceled"
+
+opStatusError :: String
+opStatusError = "error"
+
+opStatusSuccess :: String
+opStatusSuccess = "success"
+
+opsFinalized :: FrozenSet String
+opsFinalized =
+ ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
+
+-- * OpCode priority
+
+opPrioLowest :: Int
+opPrioLowest = 19
+
+opPrioHighest :: Int
+opPrioHighest = -20
+
+opPrioLow :: Int
+opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
+
+opPrioNormal :: Int
+opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
+
+opPrioHigh :: Int
+opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
+
+opPrioSubmitValid :: FrozenSet Int
+opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
+
+opPrioDefault :: Int
+opPrioDefault = opPrioNormal
+
+-- * Lock recalculate mode
+
+locksAppend :: String
+locksAppend = "append"
+
+locksReplace :: String
+locksReplace = "replace"
+
+-- * Lock timeout
+--
+-- The lock timeout (sum) before we transition into blocking acquire
+-- (this can still be reset by priority change). Computed as max time
+-- (10 hours) before we should actually go into blocking acquire,
+-- given that we start from the default priority level.
+
+lockAttemptsMaxwait :: Double
+lockAttemptsMaxwait = 15.0
+
+lockAttemptsMinwait :: Double
+lockAttemptsMinwait = 1.0
+
+lockAttemptsTimeout :: Int
+lockAttemptsTimeout = (10 * 3600) `div` (opPrioDefault - opPrioHighest)
+
+-- * Execution log types
+
+elogMessage :: String
+elogMessage = Types.eLogTypeToRaw ELogMessage
+
+elogRemoteImport :: String
+elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
+
+elogJqueueTest :: String
+elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
+
+-- * /etc/hosts modification
+
+etcHostsAdd :: String
+etcHostsAdd = "add"
+
+etcHostsRemove :: String
+etcHostsRemove = "remove"
+
+-- * Job queue test
+
+jqtMsgprefix :: String
+jqtMsgprefix = "TESTMSG="
+
+jqtExec :: String
+jqtExec = "exec"
+
+jqtExpandnames :: String
+jqtExpandnames = "expandnames"
+
+jqtLogmsg :: String
+jqtLogmsg = "logmsg"
+
+jqtStartmsg :: String
+jqtStartmsg = "startmsg"
+
+jqtAll :: FrozenSet String
+jqtAll = ConstantUtils.mkSet [jqtExec, jqtExpandnames, jqtLogmsg, jqtStartmsg]
+
+-- * Query resources
+
+qrCluster :: String
+qrCluster = "cluster"
+
+qrExport :: String
+qrExport = "export"
+
+qrExtstorage :: String
+qrExtstorage = "extstorage"
+
+qrGroup :: String
+qrGroup = "group"
+
+qrInstance :: String
+qrInstance = "instance"
+
+qrJob :: String
+qrJob = "job"
+
+qrLock :: String
+qrLock = "lock"
+
+qrNetwork :: String
+qrNetwork = "network"
+
+qrNode :: String
+qrNode = "node"
+
+qrOs :: String
+qrOs = "os"
+
+-- | List of resources which can be queried using 'Ganeti.OpCodes.OpQuery'
+qrViaOp :: FrozenSet String
+qrViaOp =
+ ConstantUtils.mkSet [qrCluster,
+ qrInstance,
+ qrNode,
+ qrGroup,
+ qrOs,
+ qrExport,
+ qrNetwork,
+ qrExtstorage]
+
+-- | List of resources which can be queried using Local UniX Interface
+qrViaLuxi :: FrozenSet String
+qrViaLuxi = ConstantUtils.mkSet [qrLock, qrJob]
+
+-- | List of resources which can be queried using RAPI
+qrViaRapi :: FrozenSet String
+qrViaRapi = qrViaLuxi
+
+-- * Query field types
+
+qftBool :: String
+qftBool = "bool"
+
+qftNumber :: String
+qftNumber = "number"
+
+qftOther :: String
+qftOther = "other"
+
+qftText :: String
+qftText = "text"
+
+qftTimestamp :: String
+qftTimestamp = "timestamp"
+
+qftUnit :: String
+qftUnit = "unit"
+
+qftUnknown :: String
+qftUnknown = "unknown"
+
+qftAll :: FrozenSet String
+qftAll =
+ ConstantUtils.mkSet [qftBool,
+ qftNumber,
+ qftOther,
+ qftText,
+ qftTimestamp,
+ qftUnit,
+ qftUnknown]
+
+-- * Query result field status
+--
+-- Don't change or reuse values as they're used by clients.
+--
+-- FIXME: link with 'Ganeti.Query.Language.ResultStatus'
+
+-- | No data (e.g. RPC error), can be used instead of 'rsOffline'
+rsNodata :: Int
+rsNodata = 2
+
+rsNormal :: Int
+rsNormal = 0
+
+-- | Resource marked offline
+rsOffline :: Int
+rsOffline = 4
+
+-- | Value unavailable/unsupported for item; if this field is
+-- supported but we cannot get the data for the moment, 'rsNodata' or
+-- 'rsOffline' should be used
+rsUnavail :: Int
+rsUnavail = 3
+
+rsUnknown :: Int
+rsUnknown = 1
+
+rsAll :: FrozenSet Int
+rsAll =
+ ConstantUtils.mkSet [rsNodata,
+ rsNormal,
+ rsOffline,
+ rsUnavail,
+ rsUnknown]
+
+-- | Special field cases and their verbose/terse formatting
+rssDescription :: Map Int (String, String)
+rssDescription =
+ Map.fromList [(rsUnknown, ("(unknown)", "??")),
+ (rsNodata, ("(nodata)", "?")),
+ (rsOffline, ("(offline)", "*")),
+ (rsUnavail, ("(unavail)", "-"))]
+
+-- * Max dynamic devices
+
+maxDisks :: Int
+maxDisks = Types.maxDisks
+
+maxNics :: Int
+maxNics = Types.maxNics
+
+-- | SSCONF file prefix
+ssconfFileprefix :: String
+ssconfFileprefix = "ssconf_"
+
+-- * SSCONF keys
+
+ssClusterName :: String
+ssClusterName = "cluster_name"
+
+ssClusterTags :: String
+ssClusterTags = "cluster_tags"
+
+ssFileStorageDir :: String
+ssFileStorageDir = "file_storage_dir"
+
+ssSharedFileStorageDir :: String
+ssSharedFileStorageDir = "shared_file_storage_dir"
+
+ssMasterCandidates :: String
+ssMasterCandidates = "master_candidates"
+
+ssMasterCandidatesIps :: String
+ssMasterCandidatesIps = "master_candidates_ips"
+
+ssMasterIp :: String
+ssMasterIp = "master_ip"
+
+ssMasterNetdev :: String
+ssMasterNetdev = "master_netdev"
+
+ssMasterNetmask :: String
+ssMasterNetmask = "master_netmask"
+
+ssMasterNode :: String
+ssMasterNode = "master_node"
+
+ssNodeList :: String
+ssNodeList = "node_list"
+
+ssNodePrimaryIps :: String
+ssNodePrimaryIps = "node_primary_ips"
+
+ssNodeSecondaryIps :: String
+ssNodeSecondaryIps = "node_secondary_ips"
+
+ssOfflineNodes :: String
+ssOfflineNodes = "offline_nodes"
+
+ssOnlineNodes :: String
+ssOnlineNodes = "online_nodes"
+
+ssPrimaryIpFamily :: String
+ssPrimaryIpFamily = "primary_ip_family"
+
+ssInstanceList :: String
+ssInstanceList = "instance_list"
+
+ssReleaseVersion :: String
+ssReleaseVersion = "release_version"
+
+ssHypervisorList :: String
+ssHypervisorList = "hypervisor_list"
+
+ssMaintainNodeHealth :: String
+ssMaintainNodeHealth = "maintain_node_health"
+
+ssUidPool :: String
+ssUidPool = "uid_pool"
+
+ssNodegroups :: String
+ssNodegroups = "nodegroups"
+
+ssNetworks :: String
+ssNetworks = "networks"
+
+-- | This is not a complete SSCONF key, but the prefix for the
+-- hypervisor keys
+ssHvparamsPref :: String
+ssHvparamsPref = "hvparams_"
+
+-- * Hvparams keys
+
+ssHvparamsXenChroot :: String
+ssHvparamsXenChroot = ssHvparamsPref ++ htChroot
+
+ssHvparamsXenFake :: String
+ssHvparamsXenFake = ssHvparamsPref ++ htFake
+
+ssHvparamsXenHvm :: String
+ssHvparamsXenHvm = ssHvparamsPref ++ htXenHvm
+
+ssHvparamsXenKvm :: String
+ssHvparamsXenKvm = ssHvparamsPref ++ htKvm
+
+ssHvparamsXenLxc :: String
+ssHvparamsXenLxc = ssHvparamsPref ++ htLxc
+
+ssHvparamsXenPvm :: String
+ssHvparamsXenPvm = ssHvparamsPref ++ htXenPvm
+
+validSsHvparamsKeys :: FrozenSet String
+validSsHvparamsKeys =
+ ConstantUtils.mkSet [ssHvparamsXenChroot,
+ ssHvparamsXenLxc,
+ ssHvparamsXenFake,
+ ssHvparamsXenHvm,
+ ssHvparamsXenKvm,
+ ssHvparamsXenPvm]
+
+ssFilePerms :: Int
+ssFilePerms = 0o444
+
+-- | Cluster wide default parameters
+defaultEnabledHypervisor :: String
+defaultEnabledHypervisor = htXenPvm
+
+hvcDefaults :: Map Hypervisor (Map String PyValueEx)
+hvcDefaults =
+ Map.fromList
+ [ (XenPvm, Map.fromList
+ [ (hvUseBootloader, PyValueEx False)
+ , (hvBootloaderPath, PyValueEx xenBootloader)
+ , (hvBootloaderArgs, PyValueEx "")
+ , (hvKernelPath, PyValueEx xenKernel)
+ , (hvInitrdPath, PyValueEx "")
+ , (hvRootPath, PyValueEx "/dev/xvda1")
+ , (hvKernelArgs, PyValueEx "ro")
+ , (hvMigrationPort, PyValueEx (8002 :: Int))
+ , (hvMigrationMode, PyValueEx htMigrationLive)
+ , (hvBlockdevPrefix, PyValueEx "sd")
+ , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
+ , (hvCpuMask, PyValueEx cpuPinningAll)
+ , (hvCpuCap, PyValueEx (0 :: Int))
+ , (hvCpuWeight, PyValueEx (256 :: Int))
+ , (hvVifScript, PyValueEx "")
+ , (hvXenCmd, PyValueEx xenCmdXm)
+ , (hvXenCpuid, PyValueEx "")
+ , (hvSoundhw, PyValueEx "")
+ ])
+ , (XenHvm, Map.fromList
+ [ (hvBootOrder, PyValueEx "cd")
+ , (hvCdromImagePath, PyValueEx "")
+ , (hvNicType, PyValueEx htNicRtl8139)
+ , (hvDiskType, PyValueEx htDiskParavirtual)
+ , (hvVncBindAddress, PyValueEx ip4AddressAny)
+ , (hvAcpi, PyValueEx True)
+ , (hvPae, PyValueEx True)
+ , (hvKernelPath, PyValueEx "/usr/lib/xen/boot/hvmloader")
+ , (hvDeviceModel, PyValueEx "/usr/lib/xen/bin/qemu-dm")
+ , (hvMigrationPort, PyValueEx (8002 :: Int))
+ , (hvMigrationMode, PyValueEx htMigrationNonlive)
+ , (hvUseLocaltime, PyValueEx False)
+ , (hvBlockdevPrefix, PyValueEx "hd")
+ , (hvPassthrough, PyValueEx "")
+ , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
+ , (hvCpuMask, PyValueEx cpuPinningAll)
+ , (hvCpuCap, PyValueEx (0 :: Int))
+ , (hvCpuWeight, PyValueEx (256 :: Int))
+ , (hvVifType, PyValueEx htHvmVifIoemu)
+ , (hvVifScript, PyValueEx "")
+ , (hvViridian, PyValueEx False)
+ , (hvXenCmd, PyValueEx xenCmdXm)
+ , (hvXenCpuid, PyValueEx "")
+ , (hvSoundhw, PyValueEx "")
+ ])
+ , (Kvm, Map.fromList
+ [ (hvKvmPath, PyValueEx kvmPath)
+ , (hvKernelPath, PyValueEx kvmKernel)
+ , (hvInitrdPath, PyValueEx "")
+ , (hvKernelArgs, PyValueEx "ro")
+ , (hvRootPath, PyValueEx "/dev/vda1")
+ , (hvAcpi, PyValueEx True)
+ , (hvSerialConsole, PyValueEx True)
+ , (hvSerialSpeed, PyValueEx (38400 :: Int))
+ , (hvVncBindAddress, PyValueEx "")
+ , (hvVncTls, PyValueEx False)
+ , (hvVncX509, PyValueEx "")
+ , (hvVncX509Verify, PyValueEx False)
+ , (hvVncPasswordFile, PyValueEx "")
+ , (hvKvmSpiceBind, PyValueEx "")
+ , (hvKvmSpiceIpVersion, PyValueEx ifaceNoIpVersionSpecified)
+ , (hvKvmSpicePasswordFile, PyValueEx "")
+ , (hvKvmSpiceLosslessImgCompr, PyValueEx "")
+ , (hvKvmSpiceJpegImgCompr, PyValueEx "")
+ , (hvKvmSpiceZlibGlzImgCompr, PyValueEx "")
+ , (hvKvmSpiceStreamingVideoDetection, PyValueEx "")
+ , (hvKvmSpiceAudioCompr, PyValueEx True)
+ , (hvKvmSpiceUseTls, PyValueEx False)
+ , (hvKvmSpiceTlsCiphers, PyValueEx opensslCiphers)
+ , (hvKvmSpiceUseVdagent, PyValueEx True)
+ , (hvKvmFloppyImagePath, PyValueEx "")
+ , (hvCdromImagePath, PyValueEx "")
+ , (hvKvmCdrom2ImagePath, PyValueEx "")
+ , (hvBootOrder, PyValueEx htBoDisk)
+ , (hvNicType, PyValueEx htNicParavirtual)
+ , (hvDiskType, PyValueEx htDiskParavirtual)
+ , (hvKvmCdromDiskType, PyValueEx "")
+ , (hvUsbMouse, PyValueEx "")
+ , (hvKeymap, PyValueEx "")
+ , (hvMigrationPort, PyValueEx (8102 :: Int))
+ , (hvMigrationBandwidth, PyValueEx (32 :: Int))
+ , (hvMigrationDowntime, PyValueEx (30 :: Int))
+ , (hvMigrationMode, PyValueEx htMigrationLive)
+ , (hvUseLocaltime, PyValueEx False)
+ , (hvDiskCache, PyValueEx htCacheDefault)
+ , (hvSecurityModel, PyValueEx htSmNone)
+ , (hvSecurityDomain, PyValueEx "")
+ , (hvKvmFlag, PyValueEx "")
+ , (hvVhostNet, PyValueEx False)
+ , (hvKvmUseChroot, PyValueEx False)
+ , (hvMemPath, PyValueEx "")
+ , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
+ , (hvCpuMask, PyValueEx cpuPinningAll)
+ , (hvCpuType, PyValueEx "")
+ , (hvCpuCores, PyValueEx (0 :: Int))
+ , (hvCpuThreads, PyValueEx (0 :: Int))
+ , (hvCpuSockets, PyValueEx (0 :: Int))
+ , (hvSoundhw, PyValueEx "")
+ , (hvUsbDevices, PyValueEx "")
+ , (hvVga, PyValueEx "")
+ , (hvKvmExtra, PyValueEx "")
+ , (hvKvmMachineVersion, PyValueEx "")
+ , (hvVnetHdr, PyValueEx True)])
+ , (Fake, Map.fromList [(hvMigrationMode, PyValueEx htMigrationLive)])
+ , (Chroot, Map.fromList [(hvInitScript, PyValueEx "/ganeti-chroot")])
+ , (Lxc, Map.fromList [(hvCpuMask, PyValueEx "")])
+ ]
+
+hvcGlobals :: FrozenSet String
+hvcGlobals =
+ ConstantUtils.mkSet [hvMigrationBandwidth,
+ hvMigrationMode,
+ hvMigrationPort,
+ hvXenCmd]
+
+becDefaults :: Map String PyValueEx
+becDefaults =
+ Map.fromList
+ [ (beMinmem, PyValueEx (128 :: Int))
+ , (beMaxmem, PyValueEx (128 :: Int))
+ , (beVcpus, PyValueEx (1 :: Int))
+ , (beAutoBalance, PyValueEx True)
+ , (beAlwaysFailover, PyValueEx False)
+ , (beSpindleUse, PyValueEx (1 :: Int))
+ ]
+
+ndcDefaults :: Map String PyValueEx
+ndcDefaults =
+ Map.fromList
+ [ (ndOobProgram, PyValueEx "")
+ , (ndSpindleCount, PyValueEx (1 :: Int))
+ , (ndExclusiveStorage, PyValueEx False)
+ , (ndOvs, PyValueEx False)
+ , (ndOvsName, PyValueEx defaultOvs)
+ , (ndOvsLink, PyValueEx "")
+ , (ndSshPort, PyValueEx (22 :: Int))
+ ]
+
+ndcGlobals :: FrozenSet String
+ndcGlobals = ConstantUtils.mkSet [ndExclusiveStorage]
+
+-- | Default delay target measured in sectors
+defaultDelayTarget :: Int
+defaultDelayTarget = 1
+
+defaultDiskCustom :: String
+defaultDiskCustom = ""
+
+defaultDiskResync :: Bool
+defaultDiskResync = False
+
+-- | Default fill target measured in sectors
+defaultFillTarget :: Int
+defaultFillTarget = 0
+
+-- | Default mininum rate measured in KiB/s
+defaultMinRate :: Int
+defaultMinRate = 4 * 1024
+
+defaultNetCustom :: String
+defaultNetCustom = ""
+
+-- | Default plan ahead measured in sectors
+--
+-- The default values for the DRBD dynamic resync speed algorithm are
+-- taken from the drbsetup 8.3.11 man page, except for c-plan-ahead
+-- (that we don't need to set to 0, because we have a separate option
+-- to enable it) and for c-max-rate, that we cap to the default value
+-- for the static resync rate.
+defaultPlanAhead :: Int
+defaultPlanAhead = 20
+
+defaultRbdPool :: String
+defaultRbdPool = "rbd"
+
+diskLdDefaults :: Map DiskTemplate (Map String PyValueEx)
+diskLdDefaults =
+ Map.fromList
+ [ (DTBlock, Map.empty)
+ , (DTDrbd8, Map.fromList
+ [ (ldpBarriers, PyValueEx drbdBarriers)
+ , (ldpDefaultMetavg, PyValueEx defaultVg)
+ , (ldpDelayTarget, PyValueEx defaultDelayTarget)
+ , (ldpDiskCustom, PyValueEx defaultDiskCustom)
+ , (ldpDynamicResync, PyValueEx defaultDiskResync)
+ , (ldpFillTarget, PyValueEx defaultFillTarget)
+ , (ldpMaxRate, PyValueEx classicDrbdSyncSpeed)
+ , (ldpMinRate, PyValueEx defaultMinRate)
+ , (ldpNetCustom, PyValueEx defaultNetCustom)
+ , (ldpNoMetaFlush, PyValueEx drbdNoMetaFlush)
+ , (ldpPlanAhead, PyValueEx defaultPlanAhead)
+ , (ldpProtocol, PyValueEx drbdDefaultNetProtocol)
+ , (ldpResyncRate, PyValueEx classicDrbdSyncSpeed)
+ ])
+ , (DTExt, Map.empty)
+ , (DTFile, Map.empty)
+ , (DTPlain, Map.fromList [(ldpStripes, PyValueEx lvmStripecount)])
+ , (DTRbd, Map.fromList
+ [ (ldpPool, PyValueEx defaultRbdPool)
+ , (ldpAccess, PyValueEx diskKernelspace)
+ ])
+ , (DTSharedFile, Map.empty)
+ ]
+
+diskDtDefaults :: Map DiskTemplate (Map String PyValueEx)
+diskDtDefaults =
+ Map.fromList
+ [ (DTBlock, Map.empty)
+ , (DTDiskless, Map.empty)
+ , (DTDrbd8, Map.fromList
+ [ (drbdDataStripes, PyValueEx lvmStripecount)
+ , (drbdDefaultMetavg, PyValueEx defaultVg)
+ , (drbdDelayTarget, PyValueEx defaultDelayTarget)
+ , (drbdDiskBarriers, PyValueEx drbdBarriers)
+ , (drbdDiskCustom, PyValueEx defaultDiskCustom)
+ , (drbdDynamicResync, PyValueEx defaultDiskResync)
+ , (drbdFillTarget, PyValueEx defaultFillTarget)
+ , (drbdMaxRate, PyValueEx classicDrbdSyncSpeed)
+ , (drbdMetaBarriers, PyValueEx drbdNoMetaFlush)
+ , (drbdMetaStripes, PyValueEx lvmStripecount)
+ , (drbdMinRate, PyValueEx defaultMinRate)
+ , (drbdNetCustom, PyValueEx defaultNetCustom)
+ , (drbdPlanAhead, PyValueEx defaultPlanAhead)
+ , (drbdProtocol, PyValueEx drbdDefaultNetProtocol)
+ , (drbdResyncRate, PyValueEx classicDrbdSyncSpeed)
+ ])
+ , (DTExt, Map.empty)
+ , (DTFile, Map.empty)
+ , (DTPlain, Map.fromList [(lvStripes, PyValueEx lvmStripecount)])
+ , (DTRbd, Map.fromList
+ [ (rbdPool, PyValueEx defaultRbdPool)
+ , (rbdAccess, PyValueEx diskKernelspace)
+ ])
+ , (DTSharedFile, Map.empty)
+ ]
+
+niccDefaults :: Map String PyValueEx
+niccDefaults =
+ Map.fromList
+ [ (nicMode, PyValueEx nicModeBridged)
+ , (nicLink, PyValueEx defaultBridge)
+ , (nicVlan, PyValueEx "")
+ ]
+
+-- | All of the following values are quite arbitrary - there are no
+-- "good" defaults, these must be customised per-site
+ispecsMinmaxDefaults :: Map String (Map String Int)
+ispecsMinmaxDefaults =
+ Map.fromList
+ [(ispecsMin,
+ Map.fromList
+ [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec),
+ (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec),
+ (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec),
+ (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec),
+ (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec),
+ (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]),
+ (ispecsMax,
+ Map.fromList
+ [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec),
+ (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec),
+ (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec),
+ (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec),
+ (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec),
+ (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])]
+
+ipolicyDefaults :: Map String PyValueEx
+ipolicyDefaults =
+ Map.fromList
+ [ (ispecsMinmax, PyValueEx [ispecsMinmaxDefaults])
+ , (ispecsStd, PyValueEx (Map.fromList
+ [ (ispecMemSize, 128)
+ , (ispecCpuCount, 1)
+ , (ispecDiskCount, 1)
+ , (ispecDiskSize, 1024)
+ , (ispecNicCount, 1)
+ , (ispecSpindleUse, 1)
+ ] :: Map String Int))
+ , (ipolicyDts, PyValueEx (ConstantUtils.toList diskTemplates))
+ , (ipolicyVcpuRatio, PyValueEx (4.0 :: Double))
+ , (ipolicySpindleRatio, PyValueEx (32.0 :: Double))
+ ]
+
+masterPoolSizeDefault :: Int
+masterPoolSizeDefault = 10
+
+-- * Exclusive storage
+
+-- | Error margin used to compare physical disks
+partMargin :: Double
+partMargin = 0.01
+
+-- | Space reserved when creating instance disks
+partReserved :: Double
+partReserved = 0.02
+
+-- * Confd
+
+confdProtocolVersion :: Int
+confdProtocolVersion = ConstantUtils.confdProtocolVersion
+
+-- Confd request type
+
+confdReqPing :: Int
+confdReqPing = Types.confdRequestTypeToRaw ReqPing
+
+confdReqNodeRoleByname :: Int
+confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName
+
+confdReqNodePipByInstanceIp :: Int
+confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip
+
+confdReqClusterMaster :: Int
+confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster
+
+confdReqNodePipList :: Int
+confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList
+
+confdReqMcPipList :: Int
+confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList
+
+confdReqInstancesIpsList :: Int
+confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList
+
+confdReqNodeDrbd :: Int
+confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd
+
+confdReqNodeInstances :: Int
+confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances
+
+confdReqs :: FrozenSet Int
+confdReqs =
+ ConstantUtils.mkSet .
+ map Types.confdRequestTypeToRaw $
+ [minBound..] \\ [ReqNodeInstances]
+
+-- * Confd request type
+
+confdReqfieldName :: Int
+confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName
+
+confdReqfieldIp :: Int
+confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp
+
+confdReqfieldMnodePip :: Int
+confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip
+
+-- * Confd repl status
+
+confdReplStatusOk :: Int
+confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk
+
+confdReplStatusError :: Int
+confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError
+
+confdReplStatusNotimplemented :: Int
+confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl
+
+confdReplStatuses :: FrozenSet Int
+confdReplStatuses =
+ ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..]
+
+-- * Confd node role
+
+confdNodeRoleMaster :: Int
+confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster
+
+confdNodeRoleCandidate :: Int
+confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate
+
+confdNodeRoleOffline :: Int
+confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline
+
+confdNodeRoleDrained :: Int
+confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained
+
+confdNodeRoleRegular :: Int
+confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular
+
+-- * A few common errors for confd
+
+confdErrorUnknownEntry :: Int
+confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry
+
+confdErrorInternal :: Int
+confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal
+
+confdErrorArgument :: Int
+confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument
+
+-- * Confd request query fields
+
+confdReqqLink :: String
+confdReqqLink = ConstantUtils.confdReqqLink
+
+confdReqqIp :: String
+confdReqqIp = ConstantUtils.confdReqqIp
+
+confdReqqIplist :: String
+confdReqqIplist = ConstantUtils.confdReqqIplist
+
+confdReqqFields :: String
+confdReqqFields = ConstantUtils.confdReqqFields
+
+-- | Each request is "salted" by the current timestamp.
+--
+-- This constant decides how many seconds of skew to accept.
+--
+-- TODO: make this a default and allow the value to be more
+-- configurable
+confdMaxClockSkew :: Int
+confdMaxClockSkew = 2 * nodeMaxClockSkew
+
+-- | 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. Using a
+-- prime number to ensure we get less chance of 'same wakeup' with
+-- other processes.
+confdConfigReloadTimeout :: Int
+confdConfigReloadTimeout = 17
+
+-- | If we receive more than one update in this amount of
+-- microseconds, we move to polling every RATELIMIT seconds, rather
+-- than relying on inotify, to be able to serve more requests.
+confdConfigReloadRatelimit :: Int
+confdConfigReloadRatelimit = 250000
+
+-- | 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.
+confdMagicFourcc :: String
+confdMagicFourcc = "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.
+confdDefaultReqCoverage :: Int
+confdDefaultReqCoverage = 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.
+confdClientExpireTimeout :: Int
+confdClientExpireTimeout = 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
+maxUdpDataSize :: Int
+maxUdpDataSize = 61440
+
+-- * User-id pool minimum/maximum acceptable user-ids
+
+uidpoolUidMin :: Int
+uidpoolUidMin = 0
+
+-- | Assuming 32 bit user-ids
+uidpoolUidMax :: Integer
+uidpoolUidMax = 2 ^ 32 - 1
+
+-- | Name or path of the pgrep command
+pgrep :: String
+pgrep = "pgrep"
+
+-- | Name of the node group that gets created at cluster init or
+-- upgrade
+initialNodeGroupName :: String
+initialNodeGroupName = "default"
+
+-- * Possible values for NodeGroup.alloc_policy
+
+allocPolicyLastResort :: String
+allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
+
+allocPolicyPreferred :: String
+allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
+
+allocPolicyUnallocable :: String
+allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
+
+validAllocPolicies :: [String]
+validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
+
+-- | Temporary external/shared storage parameters
+blockdevDriverManual :: String
+blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
+
+-- | 'qemu-img' path, required for 'ovfconverter'
+qemuimgPath :: String
+qemuimgPath = AutoConf.qemuimgPath
+
+-- | Whether htools was enabled at compilation time
+--
+-- FIXME: this should be moved next to the other enable constants,
+-- such as, 'enableConfd', and renamed to 'enableHtools'.
+htools :: Bool
+htools = AutoConf.htools
+
+-- | The hail iallocator
+iallocHail :: String
+iallocHail = "hail"
+
+-- * Fake opcodes for functions that have hooks attached to them via
+-- backend.RunLocalHooks
+
+fakeOpMasterTurndown :: String
+fakeOpMasterTurndown = "OP_CLUSTER_IP_TURNDOWN"
+
+fakeOpMasterTurnup :: String
+fakeOpMasterTurnup = "OP_CLUSTER_IP_TURNUP"
+
+-- * SSH key types
+
+sshkDsa :: String
+sshkDsa = "dsa"
+
+sshkRsa :: String
+sshkRsa = "rsa"
+
+sshkAll :: FrozenSet String
+sshkAll = ConstantUtils.mkSet [sshkRsa, sshkDsa]
+
+-- * SSH authorized key types
+
+sshakDss :: String
+sshakDss = "ssh-dss"
+
+sshakRsa :: String
+sshakRsa = "ssh-rsa"
+
+sshakAll :: FrozenSet String
+sshakAll = ConstantUtils.mkSet [sshakDss, sshakRsa]
+
+-- * SSH setup
+
+sshsClusterName :: String
+sshsClusterName = "cluster_name"
+
+sshsSshHostKey :: String
+sshsSshHostKey = "ssh_host_key"
+
+sshsSshRootKey :: String
+sshsSshRootKey = "ssh_root_key"
+
+sshsNodeDaemonCertificate :: String
+sshsNodeDaemonCertificate = "node_daemon_certificate"
+
+-- * Key files for SSH daemon
+
+sshHostDsaPriv :: String
+sshHostDsaPriv = sshConfigDir ++ "/ssh_host_dsa_key"
+
+sshHostDsaPub :: String
+sshHostDsaPub = sshHostDsaPriv ++ ".pub"
+
+sshHostRsaPriv :: String
+sshHostRsaPriv = sshConfigDir ++ "/ssh_host_rsa_key"
+
+sshHostRsaPub :: String
+sshHostRsaPub = sshHostRsaPriv ++ ".pub"
+
+sshDaemonKeyfiles :: Map String (String, String)
+sshDaemonKeyfiles =
+ Map.fromList [ (sshkRsa, (sshHostRsaPriv, sshHostRsaPub))
+ , (sshkDsa, (sshHostDsaPriv, sshHostDsaPub))
+ ]
+
+-- * Node daemon setup
+
+ndsClusterName :: String
+ndsClusterName = "cluster_name"
+
+ndsNodeDaemonCertificate :: String
+ndsNodeDaemonCertificate = "node_daemon_certificate"
+
+ndsSsconf :: String
+ndsSsconf = "ssconf"
+
+ndsStartNodeDaemon :: String
+ndsStartNodeDaemon = "start_node_daemon"
+
+-- * The source reasons for the execution of an OpCode
+
+opcodeReasonSrcClient :: String
+opcodeReasonSrcClient = "gnt:client"
+
+opcodeReasonSrcNoded :: String
+opcodeReasonSrcNoded = "gnt:daemon:noded"
+
+opcodeReasonSrcOpcode :: String
+opcodeReasonSrcOpcode = "gnt:opcode"
+
+opcodeReasonSrcRlib2 :: String
+opcodeReasonSrcRlib2 = "gnt:library:rlib2"
+
+opcodeReasonSrcUser :: String
+opcodeReasonSrcUser = "gnt:user"
+
+opcodeReasonSources :: FrozenSet String
+opcodeReasonSources =
+ ConstantUtils.mkSet [opcodeReasonSrcClient,
+ opcodeReasonSrcNoded,
+ opcodeReasonSrcOpcode,
+ opcodeReasonSrcRlib2,
+ opcodeReasonSrcUser]
+
+-- | Path generating random UUID
+randomUuidFile :: String
+randomUuidFile = ConstantUtils.randomUuidFile
+
+-- * Auto-repair tag prefixes
+
+autoRepairTagPrefix :: String
+autoRepairTagPrefix = "ganeti:watcher:autorepair:"
+
+autoRepairTagEnabled :: String
+autoRepairTagEnabled = autoRepairTagPrefix
+
+autoRepairTagPending :: String
+autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
+
+autoRepairTagResult :: String
+autoRepairTagResult = autoRepairTagPrefix ++ "result:"
+
+autoRepairTagSuspended :: String
+autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
+
+-- * Auto-repair levels
+
+autoRepairFailover :: String
+autoRepairFailover = Types.autoRepairTypeToRaw ArFailover
+
+autoRepairFixStorage :: String
+autoRepairFixStorage = Types.autoRepairTypeToRaw ArFixStorage
+
+autoRepairMigrate :: String
+autoRepairMigrate = Types.autoRepairTypeToRaw ArMigrate
+
+autoRepairReinstall :: String
+autoRepairReinstall = Types.autoRepairTypeToRaw ArReinstall
+
+autoRepairAllTypes :: FrozenSet String
+autoRepairAllTypes =
+ ConstantUtils.mkSet [autoRepairFailover,
+ autoRepairFixStorage,
+ autoRepairMigrate,
+ autoRepairReinstall]
+
+-- * Auto-repair results
+
+autoRepairEnoperm :: String
+autoRepairEnoperm = Types.autoRepairResultToRaw ArEnoperm
+
+autoRepairFailure :: String
+autoRepairFailure = Types.autoRepairResultToRaw ArFailure
+
+autoRepairSuccess :: String
+autoRepairSuccess = Types.autoRepairResultToRaw ArSuccess
+
+autoRepairAllResults :: FrozenSet String
+autoRepairAllResults =
+ ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
+
+-- | The version identifier for builtin data collectors
+builtinDataCollectorVersion :: String
+builtinDataCollectorVersion = "B"
+
+-- | The reason trail opcode parameter name
+opcodeReason :: String
+opcodeReason = "reason"
+
+diskstatsFile :: String
+diskstatsFile = "/proc/diskstats"
+
+-- * CPU load collector
+
+statFile :: String
+statFile = "/proc/stat"
+
+cpuavgloadBufferSize :: Int
+cpuavgloadBufferSize = 150
+
+cpuavgloadWindowSize :: Int
+cpuavgloadWindowSize = 600
+
+-- * Monitoring daemon
+
+-- | Mond's variable for periodical data collection
+mondTimeInterval :: Int
+mondTimeInterval = 5
+
+-- | Mond's latest API version
+mondLatestApiVersion :: Int
+mondLatestApiVersion = 1
+
+-- * Disk access modes
+
+diskUserspace :: String
+diskUserspace = Types.diskAccessModeToRaw DiskUserspace
+
+diskKernelspace :: String
+diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
+
+diskValidAccessModes :: FrozenSet String
+diskValidAccessModes =
+ ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
+
+-- | Timeout for queue draining in upgrades
+upgradeQueueDrainTimeout :: Int
+upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
+
+-- | Intervall at which the queue is polled during upgrades
+upgradeQueuePollInterval :: Int
+upgradeQueuePollInterval = 10
+
+-- * Hotplug Actions
+
+hotplugActionAdd :: String
+hotplugActionAdd = Types.hotplugActionToRaw HAAdd
+
+hotplugActionRemove :: String
+hotplugActionRemove = Types.hotplugActionToRaw HARemove
+
+hotplugActionModify :: String
+hotplugActionModify = Types.hotplugActionToRaw HAMod
+
+hotplugAllActions :: FrozenSet String
+hotplugAllActions =
+ ConstantUtils.mkSet $ map Types.hotplugActionToRaw [minBound..]
+
+-- * Hotplug Device Targets
+
+hotplugTargetNic :: String
+hotplugTargetNic = Types.hotplugTargetToRaw HTNic
+
+hotplugTargetDisk :: String
+hotplugTargetDisk = Types.hotplugTargetToRaw HTDisk
+
+hotplugAllTargets :: FrozenSet String
+hotplugAllTargets =
+ ConstantUtils.mkSet $ map Types.hotplugTargetToRaw [minBound..]
+
+-- | Timeout for disk removal (seconds)
+diskRemoveRetryTimeout :: Int
+diskRemoveRetryTimeout = 30
+
+-- | Interval between disk removal retries (seconds)
+diskRemoveRetryInterval :: Int
+diskRemoveRetryInterval = 3
+
+-- * UUID regex
+
+uuidRegex :: String
+uuidRegex = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
+
+-- * Luxi constants
+
+luxiKeyMethod :: String
+luxiKeyMethod = "method"
+
+luxiKeyArgs :: String
+luxiKeyArgs = "args"
+
+luxiKeySuccess :: String
+luxiKeySuccess = "success"
+
+luxiKeyResult :: String
+luxiKeyResult = "result"
+
+luxiKeyVersion :: String
+luxiKeyVersion = "version"
+
+luxiReqSubmitJob :: String
+luxiReqSubmitJob = "SubmitJob"
+
+luxiReqSubmitJobToDrainedQueue :: String
+luxiReqSubmitJobToDrainedQueue = "SubmitJobToDrainedQueue"
+
+luxiReqSubmitManyJobs :: String
+luxiReqSubmitManyJobs = "SubmitManyJobs"
+
+luxiReqWaitForJobChange :: String
+luxiReqWaitForJobChange = "WaitForJobChange"
+
+luxiReqPickupJob :: String
+luxiReqPickupJob = "PickupJob"
+
+luxiReqCancelJob :: String
+luxiReqCancelJob = "CancelJob"
+
+luxiReqArchiveJob :: String
+luxiReqArchiveJob = "ArchiveJob"
+
+luxiReqChangeJobPriority :: String
+luxiReqChangeJobPriority = "ChangeJobPriority"
+
+luxiReqAutoArchiveJobs :: String
+luxiReqAutoArchiveJobs = "AutoArchiveJobs"
+
+luxiReqQuery :: String
+luxiReqQuery = "Query"
+
+luxiReqQueryFields :: String
+luxiReqQueryFields = "QueryFields"
+
+luxiReqQueryJobs :: String
+luxiReqQueryJobs = "QueryJobs"
+
+luxiReqQueryInstances :: String
+luxiReqQueryInstances = "QueryInstances"
+
+luxiReqQueryNodes :: String
+luxiReqQueryNodes = "QueryNodes"
+
+luxiReqQueryGroups :: String
+luxiReqQueryGroups = "QueryGroups"
+
+luxiReqQueryNetworks :: String
+luxiReqQueryNetworks = "QueryNetworks"
+
+luxiReqQueryExports :: String
+luxiReqQueryExports = "QueryExports"
+
+luxiReqQueryConfigValues :: String
+luxiReqQueryConfigValues = "QueryConfigValues"
+
+luxiReqQueryClusterInfo :: String
+luxiReqQueryClusterInfo = "QueryClusterInfo"
+
+luxiReqQueryTags :: String
+luxiReqQueryTags = "QueryTags"
+
+luxiReqSetDrainFlag :: String
+luxiReqSetDrainFlag = "SetDrainFlag"
+
+luxiReqSetWatcherPause :: String
+luxiReqSetWatcherPause = "SetWatcherPause"
+
+luxiReqAll :: FrozenSet String
+luxiReqAll =
+ ConstantUtils.mkSet
+ [ luxiReqArchiveJob
+ , luxiReqAutoArchiveJobs
+ , luxiReqCancelJob
+ , luxiReqChangeJobPriority
+ , luxiReqQuery
+ , luxiReqQueryClusterInfo
+ , luxiReqQueryConfigValues
+ , luxiReqQueryExports
+ , luxiReqQueryFields
+ , luxiReqQueryGroups
+ , luxiReqQueryInstances
+ , luxiReqQueryJobs
+ , luxiReqQueryNodes
+ , luxiReqQueryNetworks
+ , luxiReqQueryTags
+ , luxiReqSetDrainFlag
+ , luxiReqSetWatcherPause
+ , luxiReqSubmitJob
+ , luxiReqSubmitJobToDrainedQueue
+ , luxiReqSubmitManyJobs
+ , luxiReqWaitForJobChange
+ , luxiReqPickupJob
+ ]
+
+luxiDefCtmo :: Int
+luxiDefCtmo = 10
+
+luxiDefRwto :: Int
+luxiDefRwto = 60
+
+-- | 'WaitForJobChange' timeout
+luxiWfjcTimeout :: Int
+luxiWfjcTimeout = (luxiDefRwto - 1) `div` 2
+
+-- * Query language constants
+
+-- ** Logic operators with one or more operands, each of which is a
+-- filter on its own
+
+qlangOpAnd :: String
+qlangOpAnd = "&"
+
+qlangOpOr :: String
+qlangOpOr = "|"
+
+-- ** Unary operators with exactly one operand
+
+qlangOpNot :: String
+qlangOpNot = "!"
+
+qlangOpTrue :: String
+qlangOpTrue = "?"
+
+-- ** Binary operators with exactly two operands, the field name and
+-- an operator-specific value
+
+qlangOpContains :: String
+qlangOpContains = "=[]"
+
+qlangOpEqual :: String
+qlangOpEqual = "="
+
+qlangOpGe :: String
+qlangOpGe = ">="
+
+qlangOpGt :: String
+qlangOpGt = ">"
+
+qlangOpLe :: String
+qlangOpLe = "<="
+
+qlangOpLt :: String
+qlangOpLt = "<"
+
+qlangOpNotEqual :: String
+qlangOpNotEqual = "!="
+
+qlangOpRegexp :: String
+qlangOpRegexp = "=~"
+
+-- | Characters used for detecting user-written filters (see
+-- L{_CheckFilter})
+
+qlangFilterDetectionChars :: FrozenSet String
+qlangFilterDetectionChars =
+ ConstantUtils.mkSet ["!", " ", "\"", "\'",
+ ")", "(", "\x0b", "\n",
+ "\r", "\x0c", "/", "<",
+ "\t", ">", "=", "\\", "~"]
+
+-- | Characters used to detect globbing filters
+qlangGlobDetectionChars :: FrozenSet String
+qlangGlobDetectionChars = ConstantUtils.mkSet ["*", "?"]
+
+-- * Error related constants
+--
+-- 'OpPrereqError' failure types
+
+-- | Environment error (e.g. node disk error)
+errorsEcodeEnviron :: String
+errorsEcodeEnviron = "environment_error"
+
+-- | Entity already exists
+errorsEcodeExists :: String
+errorsEcodeExists = "already_exists"
+
+-- | Internal cluster error
+errorsEcodeFault :: String
+errorsEcodeFault = "internal_error"
+
+-- | Wrong arguments (at syntax level)
+errorsEcodeInval :: String
+errorsEcodeInval = "wrong_input"
+
+-- | Entity not found
+errorsEcodeNoent :: String
+errorsEcodeNoent = "unknown_entity"
+
+-- | Not enough resources (iallocator failure, disk space, memory, etc)
+errorsEcodeNores :: String
+errorsEcodeNores = "insufficient_resources"
+
+-- | Resource not unique (e.g. MAC or IP duplication)
+errorsEcodeNotunique :: String
+errorsEcodeNotunique = "resource_not_unique"
+
+-- | Resolver errors
+errorsEcodeResolver :: String
+errorsEcodeResolver = "resolver_error"
+
+-- | Wrong entity state
+errorsEcodeState :: String
+errorsEcodeState = "wrong_state"
+
+-- | Temporarily out of resources; operation can be tried again
+errorsEcodeTempNores :: String
+errorsEcodeTempNores = "temp_insufficient_resources"
+
+errorsEcodeAll :: FrozenSet String
+errorsEcodeAll =
+ ConstantUtils.mkSet [ errorsEcodeNores
+ , errorsEcodeExists
+ , errorsEcodeState
+ , errorsEcodeNotunique
+ , errorsEcodeTempNores
+ , errorsEcodeNoent
+ , errorsEcodeFault
+ , errorsEcodeResolver
+ , errorsEcodeInval
+ , errorsEcodeEnviron
+ ]
-module Ganeti.Constants (module Ganeti.HsConstants,
- module Ganeti.PyConstants) where
+-- * Jstore related constants
-import Ganeti.HsConstants
-import Ganeti.PyConstants
+jstoreJobsPerArchiveDirectory :: Int
+jstoreJobsPerArchiveDirectory = 10000
diff --git a/src/Ganeti/Hs2Py/ListConstants.hs.in b/src/Ganeti/Hs2Py/ListConstants.hs.in
index ba839553ffccd9652fa99e5124335505d6699653..afca97f675d593346e390b9bf570ab77aabfb19f 100644
--- a/src/Ganeti/Hs2Py/ListConstants.hs.in
+++ b/src/Ganeti/Hs2Py/ListConstants.hs.in
@@ -28,8 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
{-# LANGUAGE TemplateHaskell #-}
module Ganeti.Hs2Py.ListConstants where
+import Ganeti.Constants
import Ganeti.Hs2Py.GenConstants
-import Ganeti.HsConstants
import Ganeti.PyValueInstances ()
$(genPyConstants "pyConstants"
diff --git a/src/Ganeti/HsConstants.hs b/src/Ganeti/HsConstants.hs
deleted file mode 100644
index 9b679d9afad9671248ea24653ada31568c5bf00b..0000000000000000000000000000000000000000
--- a/src/Ganeti/HsConstants.hs
+++ /dev/null
@@ -1,4320 +0,0 @@
-{-# OPTIONS -fno-warn-type-defaults #-}
-{-| HsConstants contains the Haskell constants
-
-This is a transitional module complementary to 'Ganeti.Constants'. It
-is intended to contain the Haskell constants that are meant to be
-generated in Python.
-
-Do not write any definitions in this file other than constants. Do
-not even write helper functions. The definitions in this module are
-automatically stripped to build the Makefile.am target
-'ListConstants.hs'. If there are helper functions in this module,
-they will also be dragged and it will cause compilation to fail.
-Therefore, all helper functions should go to a separate module and
-imported.
-
--}
-
-{-
-
-Copyright (C) 2013 Google Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.
-
--}
-module Ganeti.HsConstants where
-
-import Control.Arrow ((***))
-import Data.List ((\\))
-import Data.Map (Map)
-import qualified Data.Map as Map (empty, fromList, keys, insert)
-
-import qualified AutoConf
-import Ganeti.ConstantUtils (PythonChar(..), PythonNone(..), FrozenSet,
- Protocol(..), buildVersion)
-import qualified Ganeti.ConstantUtils as ConstantUtils
-import Ganeti.HTools.Types (AutoRepairResult(..), AutoRepairType(..))
-import qualified Ganeti.HTools.Types as Types
-import Ganeti.Logging (SyslogUsage(..))
-import qualified Ganeti.Logging as Logging (syslogUsageToRaw)
-import qualified Ganeti.Runtime as Runtime
-import Ganeti.Runtime (GanetiDaemon(..), MiscGroup(..), GanetiGroup(..),
- ExtraLogReason(..))
-import Ganeti.THH (PyValueEx(..))
-import Ganeti.Types
-import qualified Ganeti.Types as Types
-import Ganeti.Confd.Types (ConfdRequestType(..), ConfdReqField(..),
- ConfdReplyStatus(..), ConfdNodeRole(..),
- ConfdErrorType(..))
-import qualified Ganeti.Confd.Types as Types
-
-{-# ANN module "HLint: ignore Use camelCase" #-}
-
--- * 'autoconf' constants for Python only ('autotools/build-bash-completion')
-
-htoolsProgs :: [String]
-htoolsProgs = AutoConf.htoolsProgs
-
--- * 'autoconf' constants for Python only ('lib/constants.py')
-
-drbdBarriers :: String
-drbdBarriers = AutoConf.drbdBarriers
-
-drbdNoMetaFlush :: Bool
-drbdNoMetaFlush = AutoConf.drbdNoMetaFlush
-
-lvmStripecount :: Int
-lvmStripecount = AutoConf.lvmStripecount
-
-hasGnuLn :: Bool
-hasGnuLn = AutoConf.hasGnuLn
-
--- * 'autoconf' constants for Python only ('lib/pathutils.py')
-
--- ** Build-time constants
-
-exportDir :: String
-exportDir = AutoConf.exportDir
-
-osSearchPath :: [String]
-osSearchPath = AutoConf.osSearchPath
-
-esSearchPath :: [String]
-esSearchPath = AutoConf.esSearchPath
-
-sshConfigDir :: String
-sshConfigDir = AutoConf.sshConfigDir
-
-xenConfigDir :: String
-xenConfigDir = AutoConf.xenConfigDir
-
-sysconfdir :: String
-sysconfdir = AutoConf.sysconfdir
-
-toolsdir :: String
-toolsdir = AutoConf.toolsdir
-
-localstatedir :: String
-localstatedir = AutoConf.localstatedir
-
--- ** Paths which don't change for a virtual cluster
-
-pkglibdir :: String
-pkglibdir = AutoConf.pkglibdir
-
-sharedir :: String
-sharedir = AutoConf.sharedir
-
--- * 'autoconf' constants for Python only ('lib/build/sphinx_ext.py')
-
-manPages :: Map String Int
-manPages = Map.fromList AutoConf.manPages
-
--- * 'autoconf' constants for QA cluster only ('qa/qa_cluster.py')
-
-versionedsharedir :: String
-versionedsharedir = AutoConf.versionedsharedir
-
--- * 'autoconf' constants for Python only ('tests/py/docs_unittest.py')
-
-gntScripts :: [String]
-gntScripts = AutoConf.gntScripts
-
--- * Various versions
-
-releaseVersion :: String
-releaseVersion = AutoConf.packageVersion
-
-versionMajor :: Int
-versionMajor = AutoConf.versionMajor
-
-versionMinor :: Int
-versionMinor = AutoConf.versionMinor
-
-versionRevision :: Int
-versionRevision = AutoConf.versionRevision
-
-dirVersion :: String
-dirVersion = AutoConf.dirVersion
-
-osApiV10 :: Int
-osApiV10 = 10
-
-osApiV15 :: Int
-osApiV15 = 15
-
-osApiV20 :: Int
-osApiV20 = 20
-
-osApiVersions :: FrozenSet Int
-osApiVersions = ConstantUtils.mkSet [osApiV10, osApiV15, osApiV20]
-
-exportVersion :: Int
-exportVersion = 0
-
-rapiVersion :: Int
-rapiVersion = 2
-
-configMajor :: Int
-configMajor = AutoConf.versionMajor
-
-configMinor :: Int
-configMinor = AutoConf.versionMinor
-
--- | The configuration is supposed to remain stable across
--- revisions. Therefore, the revision number is cleared to '0'.
-configRevision :: Int
-configRevision = 0
-
-configVersion :: Int
-configVersion = buildVersion configMajor configMinor configRevision
-
--- | Similarly to the configuration (see 'configRevision'), the
--- protocols are supposed to remain stable across revisions.
-protocolVersion :: Int
-protocolVersion = buildVersion configMajor configMinor configRevision
-
--- * User separation
-
-daemonsGroup :: String
-daemonsGroup = Runtime.daemonGroup (ExtraGroup DaemonsGroup)
-
-adminGroup :: String
-adminGroup = Runtime.daemonGroup (ExtraGroup AdminGroup)
-
-masterdUser :: String
-masterdUser = Runtime.daemonUser GanetiMasterd
-
-masterdGroup :: String
-masterdGroup = Runtime.daemonGroup (DaemonGroup GanetiMasterd)
-
-rapiUser :: String
-rapiUser = Runtime.daemonUser GanetiRapi
-
-rapiGroup :: String
-rapiGroup = Runtime.daemonGroup (DaemonGroup GanetiRapi)
-
-confdUser :: String
-confdUser = Runtime.daemonUser GanetiConfd
-
-confdGroup :: String
-confdGroup = Runtime.daemonGroup (DaemonGroup GanetiConfd)
-
-luxidUser :: String
-luxidUser = Runtime.daemonUser GanetiLuxid
-
-luxidGroup :: String
-luxidGroup = Runtime.daemonGroup (DaemonGroup GanetiLuxid)
-
-nodedUser :: String
-nodedUser = Runtime.daemonUser GanetiNoded
-
-nodedGroup :: String
-nodedGroup = Runtime.daemonGroup (DaemonGroup GanetiNoded)
-
-mondUser :: String
-mondUser = Runtime.daemonUser GanetiMond
-
-mondGroup :: String
-mondGroup = Runtime.daemonGroup (DaemonGroup GanetiMond)
-
-sshLoginUser :: String
-sshLoginUser = AutoConf.sshLoginUser
-
-sshConsoleUser :: String
-sshConsoleUser = AutoConf.sshConsoleUser
-
--- * Cpu pinning separators and constants
-
-cpuPinningSep :: String
-cpuPinningSep = ":"
-
-cpuPinningAll :: String
-cpuPinningAll = "all"
-
--- | Internal representation of "all"
-cpuPinningAllVal :: Int
-cpuPinningAllVal = -1
-
--- | One "all" entry in a CPU list means CPU pinning is off
-cpuPinningOff :: [Int]
-cpuPinningOff = [cpuPinningAllVal]
-
--- | A Xen-specific implementation detail is that there is no way to
--- actually say "use any cpu for pinning" in a Xen configuration file,
--- as opposed to the command line, where you can say
--- @
--- xm vcpu-pin <domain> <vcpu> all
--- @
---
--- The workaround used in Xen is "0-63" (see source code function
--- "xm_vcpu_pin" in @<xen-source>/tools/python/xen/xm/main.py@).
---
--- To support future changes, the following constant is treated as a
--- blackbox string that simply means "use any cpu for pinning under
--- xen".
-cpuPinningAllXen :: String
-cpuPinningAllXen = "0-63"
-
--- | A KVM-specific implementation detail - the following value is
--- used to set CPU affinity to all processors (--0 through --31), per
--- taskset man page.
---
--- FIXME: This only works for machines with up to 32 CPU cores
-cpuPinningAllKvm :: Int
-cpuPinningAllKvm = 0xFFFFFFFF
-
--- * Wipe
-
-ddCmd :: String
-ddCmd = "dd"
-
--- | 1GB
-maxWipeChunk :: Int
-maxWipeChunk = 1024
-
-minWipeChunkPercent :: Int
-minWipeChunkPercent = 10
-
--- * Directories
-
-runDirsMode :: Int
-runDirsMode = 0o775
-
-secureDirMode :: Int
-secureDirMode = 0o700
-
-secureFileMode :: Int
-secureFileMode = 0o600
-
-adoptableBlockdevRoot :: String
-adoptableBlockdevRoot = "/dev/disk/"
-
--- * 'autoconf' enable/disable
-
-enableConfd :: Bool
-enableConfd = AutoConf.enableConfd
-
-enableMond :: Bool
-enableMond = AutoConf.enableMond
-
-enableRestrictedCommands :: Bool
-enableRestrictedCommands = AutoConf.enableRestrictedCommands
-
-enableSplitQuery :: Bool
-enableSplitQuery = AutoConf.enableSplitQuery
-
--- * SSH constants
-
-ssh :: String
-ssh = "ssh"
-
-scp :: String
-scp = "scp"
-
--- * Daemons
-
-confd :: String
-confd = Runtime.daemonName GanetiConfd
-
-masterd :: String
-masterd = Runtime.daemonName GanetiMasterd
-
-mond :: String
-mond = Runtime.daemonName GanetiMond
-
-noded :: String
-noded = Runtime.daemonName GanetiNoded
-
-luxid :: String
-luxid = Runtime.daemonName GanetiLuxid
-
-rapi :: String
-rapi = Runtime.daemonName GanetiRapi
-
-daemons :: FrozenSet String
-daemons =
- ConstantUtils.mkSet [confd,
- luxid,
- masterd,
- mond,
- noded,
- rapi]
-
-defaultConfdPort :: Int
-defaultConfdPort = 1814
-
-defaultMondPort :: Int
-defaultMondPort = 1815
-
-defaultNodedPort :: Int
-defaultNodedPort = 1811
-
-defaultRapiPort :: Int
-defaultRapiPort = 5080
-
-daemonsPorts :: Map String (Protocol, Int)
-daemonsPorts =
- Map.fromList [(confd, (Udp, defaultConfdPort)),
- (mond, (Tcp, defaultMondPort)),
- (noded, (Tcp, defaultNodedPort)),
- (rapi, (Tcp, defaultRapiPort)),
- (ssh, (Tcp, 22))]
-
-firstDrbdPort :: Int
-firstDrbdPort = 11000
-
-lastDrbdPort :: Int
-lastDrbdPort = 14999
-
-daemonsLogbase :: Map String String
-daemonsLogbase =
- Map.fromList
- [ (Runtime.daemonName d, Runtime.daemonLogBase d) | d <- [minBound..] ]
-
-daemonsExtraLogbase :: Map String (Map String String)
-daemonsExtraLogbase =
- Map.fromList $
- map (Runtime.daemonName *** id)
- [ (GanetiMond, Map.fromList
- [ ("access", Runtime.daemonsExtraLogbase GanetiMond AccessLog)
- , ("error", Runtime.daemonsExtraLogbase GanetiMond ErrorLog)
- ])
- ]
-
-extraLogreasonAccess :: String
-extraLogreasonAccess = Runtime.daemonsExtraLogbase GanetiMond AccessLog
-
-extraLogreasonError :: String
-extraLogreasonError = Runtime.daemonsExtraLogbase GanetiMond ErrorLog
-
-devConsole :: String
-devConsole = ConstantUtils.devConsole
-
-procMounts :: String
-procMounts = "/proc/mounts"
-
--- * Luxi (Local UniX Interface) related constants
-
-luxiEom :: PythonChar
-luxiEom = PythonChar '\x03'
-
--- | Environment variable for the luxi override socket
-luxiOverride :: String
-luxiOverride = "FORCE_LUXI_SOCKET"
-
-luxiOverrideMaster :: String
-luxiOverrideMaster = "master"
-
-luxiOverrideQuery :: String
-luxiOverrideQuery = "query"
-
-luxiVersion :: Int
-luxiVersion = configVersion
-
--- * Syslog
-
-syslogUsage :: String
-syslogUsage = AutoConf.syslogUsage
-
-syslogNo :: String
-syslogNo = Logging.syslogUsageToRaw SyslogNo
-
-syslogYes :: String
-syslogYes = Logging.syslogUsageToRaw SyslogYes
-
-syslogOnly :: String
-syslogOnly = Logging.syslogUsageToRaw SyslogOnly
-
-syslogSocket :: String
-syslogSocket = "/dev/log"
-
-exportConfFile :: String
-exportConfFile = "config.ini"
-
--- * Xen
-
-xenBootloader :: String
-xenBootloader = AutoConf.xenBootloader
-
-xenCmdXl :: String
-xenCmdXl = "xl"
-
-xenCmdXm :: String
-xenCmdXm = "xm"
-
-xenInitrd :: String
-xenInitrd = AutoConf.xenInitrd
-
-xenKernel :: String
-xenKernel = AutoConf.xenKernel
-
--- FIXME: perhaps rename to 'validXenCommands' for consistency with
--- other constants
-knownXenCommands :: FrozenSet String
-knownXenCommands = ConstantUtils.mkSet [xenCmdXl, xenCmdXm]
-
--- * KVM and socat
-
-kvmPath :: String
-kvmPath = AutoConf.kvmPath
-
-kvmKernel :: String
-kvmKernel = AutoConf.kvmKernel
-
-socatEscapeCode :: String
-socatEscapeCode = "0x1d"
-
-socatPath :: String
-socatPath = AutoConf.socatPath
-
-socatUseCompress :: Bool
-socatUseCompress = AutoConf.socatUseCompress
-
-socatUseEscape :: Bool
-socatUseEscape = AutoConf.socatUseEscape
-
--- * Console types
-
--- | Display a message for console access
-consMessage :: String
-consMessage = "msg"
-
--- | Console as SPICE server
-consSpice :: String
-consSpice = "spice"
-
--- | Console as SSH command
-consSsh :: String
-consSsh = "ssh"
-
--- | Console as VNC server
-consVnc :: String
-consVnc = "vnc"
-
-consAll :: FrozenSet String
-consAll = ConstantUtils.mkSet [consMessage, consSpice, consSsh, consVnc]
-
--- | RSA key bit length
---
--- For RSA keys more bits are better, but they also make operations
--- more expensive. NIST SP 800-131 recommends a minimum of 2048 bits
--- from the year 2010 on.
-rsaKeyBits :: Int
-rsaKeyBits = 2048
-
--- | Ciphers allowed for SSL connections.
---
--- For the format, see ciphers(1). A better way to disable ciphers
--- would be to use the exclamation mark (!), but socat versions below
--- 1.5 can't parse exclamation marks in options properly. When
--- modifying the ciphers, ensure not to accidentially add something
--- after it's been removed. Use the "openssl" utility to check the
--- allowed ciphers, e.g. "openssl ciphers -v HIGH:-DES".
-opensslCiphers :: String
-opensslCiphers = "HIGH:-DES:-3DES:-EXPORT:-ADH"
-
--- * X509
-
--- | commonName (CN) used in certificates
-x509CertCn :: String
-x509CertCn = "ganeti.example.com"
-
--- | Default validity of certificates in days
-x509CertDefaultValidity :: Int
-x509CertDefaultValidity = 365 * 5
-
-x509CertSignatureHeader :: String
-x509CertSignatureHeader = "X-Ganeti-Signature"
-
--- | Digest used to sign certificates ("openssl x509" uses SHA1 by default)
-x509CertSignDigest :: String
-x509CertSignDigest = "SHA1"
-
--- * Import/export daemon mode
-
-iemExport :: String
-iemExport = "export"
-
-iemImport :: String
-iemImport = "import"
-
--- * Import/export transport compression
-
-iecGzip :: String
-iecGzip = Types.importExportCompressionToRaw GZip
-
-iecNone :: String
-iecNone = Types.importExportCompressionToRaw None
-
-iecAll :: FrozenSet String
-iecAll =
- ConstantUtils.mkSet $ map Types.importExportCompressionToRaw [minBound..]
-
-ieCustomSize :: String
-ieCustomSize = "fd"
-
--- * Import/export I/O
-
--- | Direct file I/O, equivalent to a shell's I/O redirection using
--- '<' or '>'
-ieioFile :: String
-ieioFile = "file"
-
--- | Raw block device I/O using "dd"
-ieioRawDisk :: String
-ieioRawDisk = "raw"
-
--- | OS definition import/export script
-ieioScript :: String
-ieioScript = "script"
-
--- * Values
-
-valueDefault :: String
-valueDefault = "default"
-
-valueAuto :: String
-valueAuto = "auto"
-
-valueGenerate :: String
-valueGenerate = "generate"
-
-valueNone :: String
-valueNone = "none"
-
-valueTrue :: String
-valueTrue = "true"
-
-valueFalse :: String
-valueFalse = "false"
-
-valueHsNothing :: Map String PythonNone
-valueHsNothing = Map.fromList [("Nothing", PythonNone)]
-
--- * Hooks
-
-hooksNameCfgupdate :: String
-hooksNameCfgupdate = "config-update"
-
-hooksNameWatcher :: String
-hooksNameWatcher = "watcher"
-
-hooksPath :: String
-hooksPath = "/sbin:/bin:/usr/sbin:/usr/bin"
-
-hooksPhasePost :: String
-hooksPhasePost = "post"
-
-hooksPhasePre :: String
-hooksPhasePre = "pre"
-
-hooksVersion :: Int
-hooksVersion = 2
-
--- * Hooks subject type (what object type does the LU deal with)
-
-htypeCluster :: String
-htypeCluster = "CLUSTER"
-
-htypeGroup :: String
-htypeGroup = "GROUP"
-
-htypeInstance :: String
-htypeInstance = "INSTANCE"
-
-htypeNetwork :: String
-htypeNetwork = "NETWORK"
-
-htypeNode :: String
-htypeNode = "NODE"
-
--- * Hkr
-
-hkrSkip :: Int
-hkrSkip = 0
-
-hkrFail :: Int
-hkrFail = 1
-
-hkrSuccess :: Int
-hkrSuccess = 2
-
--- * Storage types
-
-stBlock :: String
-stBlock = Types.storageTypeToRaw StorageBlock
-
-stDiskless :: String
-stDiskless = Types.storageTypeToRaw StorageDiskless
-
-stExt :: String
-stExt = Types.storageTypeToRaw StorageExt
-
-stFile :: String
-stFile = Types.storageTypeToRaw StorageFile
-
-stLvmPv :: String
-stLvmPv = Types.storageTypeToRaw StorageLvmPv
-
-stLvmVg :: String
-stLvmVg = Types.storageTypeToRaw StorageLvmVg
-
-stRados :: String
-stRados = Types.storageTypeToRaw StorageRados
-
-storageTypes :: FrozenSet String
-storageTypes = ConstantUtils.mkSet $ map Types.storageTypeToRaw [minBound..]
-
--- | The set of storage types for which storage reporting is available
---
--- FIXME: Remove this, once storage reporting is available for all
--- types.
-stsReport :: FrozenSet String
-stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg]
-
--- * Storage fields
--- ** First two are valid in LU context only, not passed to backend
-
-sfNode :: String
-sfNode = "node"
-
-sfType :: String
-sfType = "type"
-
--- ** and the rest are valid in backend
-
-sfAllocatable :: String
-sfAllocatable = Types.storageFieldToRaw SFAllocatable
-
-sfFree :: String
-sfFree = Types.storageFieldToRaw SFFree
-
-sfName :: String
-sfName = Types.storageFieldToRaw SFName
-
-sfSize :: String
-sfSize = Types.storageFieldToRaw SFSize
-
-sfUsed :: String
-sfUsed = Types.storageFieldToRaw SFUsed
-
-validStorageFields :: FrozenSet String
-validStorageFields =
- ConstantUtils.mkSet $ map Types.storageFieldToRaw [minBound..] ++
- [sfNode, sfType]
-
-modifiableStorageFields :: Map String (FrozenSet String)
-modifiableStorageFields =
- Map.fromList [(Types.storageTypeToRaw StorageLvmPv,
- ConstantUtils.mkSet [sfAllocatable])]
-
--- * Storage operations
-
-soFixConsistency :: String
-soFixConsistency = "fix-consistency"
-
-validStorageOperations :: Map String (FrozenSet String)
-validStorageOperations =
- Map.fromList [(Types.storageTypeToRaw StorageLvmVg,
- ConstantUtils.mkSet [soFixConsistency])]
-
--- * Volume fields
-
-vfDev :: String
-vfDev = "dev"
-
-vfInstance :: String
-vfInstance = "instance"
-
-vfName :: String
-vfName = "name"
-
-vfNode :: String
-vfNode = "node"
-
-vfPhys :: String
-vfPhys = "phys"
-
-vfSize :: String
-vfSize = "size"
-
-vfVg :: String
-vfVg = "vg"
-
--- * Local disk status
-
-ldsFaulty :: Int
-ldsFaulty = Types.localDiskStatusToRaw DiskStatusFaulty
-
-ldsOkay :: Int
-ldsOkay = Types.localDiskStatusToRaw DiskStatusOk
-
-ldsUnknown :: Int
-ldsUnknown = Types.localDiskStatusToRaw DiskStatusUnknown
-
-ldsNames :: Map Int String
-ldsNames =
- Map.fromList [ (Types.localDiskStatusToRaw ds,
- localDiskStatusName ds) | ds <- [minBound..] ]
-
--- * Disk template types
-
-dtDiskless :: String
-dtDiskless = Types.diskTemplateToRaw DTDiskless
-
-dtFile :: String
-dtFile = Types.diskTemplateToRaw DTFile
-
-dtSharedFile :: String
-dtSharedFile = Types.diskTemplateToRaw DTSharedFile
-
-dtPlain :: String
-dtPlain = Types.diskTemplateToRaw DTPlain
-
-dtBlock :: String
-dtBlock = Types.diskTemplateToRaw DTBlock
-
-dtDrbd8 :: String
-dtDrbd8 = Types.diskTemplateToRaw DTDrbd8
-
-dtRbd :: String
-dtRbd = Types.diskTemplateToRaw DTRbd
-
-dtExt :: String
-dtExt = Types.diskTemplateToRaw DTExt
-
--- | This is used to order determine the default disk template when
--- the list of enabled disk templates is inferred from the current
--- state of the cluster. This only happens on an upgrade from a
--- version of Ganeti that did not support the 'enabled_disk_templates'
--- so far.
-diskTemplatePreference :: [String]
-diskTemplatePreference =
- map Types.diskTemplateToRaw
- [DTBlock, DTDiskless, DTDrbd8, DTExt, DTFile, DTPlain, DTRbd, DTSharedFile]
-
-diskTemplates :: FrozenSet String
-diskTemplates = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [minBound..]
-
--- | Disk templates that are enabled by default
-defaultEnabledDiskTemplates :: [String]
-defaultEnabledDiskTemplates = map Types.diskTemplateToRaw [DTDrbd8, DTPlain]
-
--- | Mapping of disk templates to storage types
-mapDiskTemplateStorageType :: Map String String
-mapDiskTemplateStorageType =
- Map.fromList $
- map (Types.diskTemplateToRaw *** Types.storageTypeToRaw)
- [(DTBlock, StorageBlock),
- (DTDrbd8, StorageLvmVg),
- (DTExt, StorageExt),
- (DTSharedFile, StorageFile),
- (DTFile, StorageFile),
- (DTDiskless, StorageDiskless),
- (DTPlain, StorageLvmVg),
- (DTRbd, StorageRados)]
-
--- | The set of network-mirrored disk templates
-dtsIntMirror :: FrozenSet String
-dtsIntMirror = ConstantUtils.mkSet [dtDrbd8]
-
--- | 'DTDiskless' is 'trivially' externally mirrored
-dtsExtMirror :: FrozenSet String
-dtsExtMirror =
- ConstantUtils.mkSet $
- map Types.diskTemplateToRaw [DTDiskless, DTBlock, DTExt, DTSharedFile, DTRbd]
-
--- | The set of non-lvm-based disk templates
-dtsNotLvm :: FrozenSet String
-dtsNotLvm =
- ConstantUtils.mkSet $
- map Types.diskTemplateToRaw
- [DTSharedFile, DTDiskless, DTBlock, DTExt, DTFile, DTRbd]
-
--- | The set of disk templates which can be grown
-dtsGrowable :: FrozenSet String
-dtsGrowable =
- ConstantUtils.mkSet $
- map Types.diskTemplateToRaw
- [DTSharedFile, DTDrbd8, DTPlain, DTExt, DTFile, DTRbd]
-
--- | The set of disk templates that allow adoption
-dtsMayAdopt :: FrozenSet String
-dtsMayAdopt =
- ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTBlock, DTPlain]
-
--- | The set of disk templates that *must* use adoption
-dtsMustAdopt :: FrozenSet String
-dtsMustAdopt = ConstantUtils.mkSet [Types.diskTemplateToRaw DTBlock]
-
--- | The set of disk templates that allow migrations
-dtsMirrored :: FrozenSet String
-dtsMirrored = dtsIntMirror `ConstantUtils.union` dtsExtMirror
-
--- | The set of file based disk templates
-dtsFilebased :: FrozenSet String
-dtsFilebased =
- ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTSharedFile, DTFile]
-
--- | The set of disk templates that can be moved by copying
---
--- Note: a requirement is that they're not accessed externally or
--- shared between nodes; in particular, sharedfile is not suitable.
-dtsCopyable :: FrozenSet String
-dtsCopyable =
- ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain, DTFile]
-
--- | The set of disk templates that are supported by exclusive_storage
-dtsExclStorage :: FrozenSet String
-dtsExclStorage = ConstantUtils.mkSet $ map Types.diskTemplateToRaw [DTPlain]
-
--- | Templates for which we don't perform checks on free space
-dtsNoFreeSpaceCheck :: FrozenSet String
-dtsNoFreeSpaceCheck =
- ConstantUtils.mkSet $
- map Types.diskTemplateToRaw [DTExt, DTSharedFile, DTFile, DTRbd]
-
-dtsBlock :: FrozenSet String
-dtsBlock =
- ConstantUtils.mkSet $
- map Types.diskTemplateToRaw [DTPlain, DTDrbd8, DTBlock, DTRbd, DTExt]
-
--- | The set of lvm-based disk templates
-dtsLvm :: FrozenSet String
-dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm
-
--- * Drbd
-
-drbdHmacAlg :: String
-drbdHmacAlg = "md5"
-
-drbdDefaultNetProtocol :: String
-drbdDefaultNetProtocol = "C"
-
-drbdMigrationNetProtocol :: String
-drbdMigrationNetProtocol = "C"
-
-drbdStatusFile :: String
-drbdStatusFile = "/proc/drbd"
-
--- | Size of DRBD meta block device
-drbdMetaSize :: Int
-drbdMetaSize = 128
-
--- * Drbd barrier types
-
-drbdBDiskBarriers :: String
-drbdBDiskBarriers = "b"
-
-drbdBDiskDrain :: String
-drbdBDiskDrain = "d"
-
-drbdBDiskFlush :: String
-drbdBDiskFlush = "f"
-
-drbdBNone :: String
-drbdBNone = "n"
-
--- | Valid barrier combinations: "n" or any non-null subset of "bfd"
-drbdValidBarrierOpt :: FrozenSet (FrozenSet String)
-drbdValidBarrierOpt =
- ConstantUtils.mkSet
- [ ConstantUtils.mkSet [drbdBNone]
- , ConstantUtils.mkSet [drbdBDiskBarriers]
- , ConstantUtils.mkSet [drbdBDiskDrain]
- , ConstantUtils.mkSet [drbdBDiskFlush]
- , ConstantUtils.mkSet [drbdBDiskDrain, drbdBDiskFlush]
- , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskDrain]
- , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush]
- , ConstantUtils.mkSet [drbdBDiskBarriers, drbdBDiskFlush, drbdBDiskDrain]
- ]
-
--- | Rbd tool command
-rbdCmd :: String
-rbdCmd = "rbd"
-
--- * File backend driver
-
-fdBlktap :: String
-fdBlktap = Types.fileDriverToRaw FileBlktap
-
-fdLoop :: String
-fdLoop = Types.fileDriverToRaw FileLoop
-
-fileDriver :: FrozenSet String
-fileDriver =
- ConstantUtils.mkSet $
- map Types.fileDriverToRaw [minBound..]
-
--- | The set of drbd-like disk types
-dtsDrbd :: FrozenSet String
-dtsDrbd = ConstantUtils.mkSet [Types.diskTemplateToRaw DTDrbd8]
-
--- * Disk access mode
-
-diskRdonly :: String
-diskRdonly = Types.diskModeToRaw DiskRdOnly
-
-diskRdwr :: String
-diskRdwr = Types.diskModeToRaw DiskRdWr
-
-diskAccessSet :: FrozenSet String
-diskAccessSet = ConstantUtils.mkSet $ map Types.diskModeToRaw [minBound..]
-
--- * Disk replacement mode
-
-replaceDiskAuto :: String
-replaceDiskAuto = Types.replaceDisksModeToRaw ReplaceAuto
-
-replaceDiskChg :: String
-replaceDiskChg = Types.replaceDisksModeToRaw ReplaceNewSecondary
-
-replaceDiskPri :: String
-replaceDiskPri = Types.replaceDisksModeToRaw ReplaceOnPrimary
-
-replaceDiskSec :: String
-replaceDiskSec = Types.replaceDisksModeToRaw ReplaceOnSecondary
-
-replaceModes :: FrozenSet String
-replaceModes =
- ConstantUtils.mkSet $ map Types.replaceDisksModeToRaw [minBound..]
-
--- * Instance export mode
-
-exportModeLocal :: String
-exportModeLocal = Types.exportModeToRaw ExportModeLocal
-
-exportModeRemote :: String
-exportModeRemote = Types.exportModeToRaw ExportModeRemote
-
-exportModes :: FrozenSet String
-exportModes = ConstantUtils.mkSet $ map Types.exportModeToRaw [minBound..]
-
--- * Instance creation modes
-
-instanceCreate :: String
-instanceCreate = Types.instCreateModeToRaw InstCreate
-
-instanceImport :: String
-instanceImport = Types.instCreateModeToRaw InstImport
-
-instanceRemoteImport :: String
-instanceRemoteImport = Types.instCreateModeToRaw InstRemoteImport
-
-instanceCreateModes :: FrozenSet String
-instanceCreateModes =
- ConstantUtils.mkSet $ map Types.instCreateModeToRaw [minBound..]
-
--- * Remote import/export handshake message and version
-
-rieHandshake :: String
-rieHandshake = "Hi, I'm Ganeti"
-
-rieVersion :: Int
-rieVersion = 0
-
--- | Remote import/export certificate validity (seconds)
-rieCertValidity :: Int
-rieCertValidity = 24 * 60 * 60
-
--- | Export only: how long to wait per connection attempt (seconds)
-rieConnectAttemptTimeout :: Int
-rieConnectAttemptTimeout = 20
-
--- | Export only: number of attempts to connect
-rieConnectRetries :: Int
-rieConnectRetries = 10
-
--- | Overall timeout for establishing connection
-rieConnectTimeout :: Int
-rieConnectTimeout = 180
-
--- | Give child process up to 5 seconds to exit after sending a signal
-childLingerTimeout :: Double
-childLingerTimeout = 5.0
-
--- * Import/export config options
-
-inisectBep :: String
-inisectBep = "backend"
-
-inisectExp :: String
-inisectExp = "export"
-
-inisectHyp :: String
-inisectHyp = "hypervisor"
-
-inisectIns :: String
-inisectIns = "instance"
-
-inisectOsp :: String
-inisectOsp = "os"
-
--- * Dynamic device modification
-
-ddmAdd :: String
-ddmAdd = Types.ddmFullToRaw DdmFullAdd
-
-ddmModify :: String
-ddmModify = Types.ddmFullToRaw DdmFullModify
-
-ddmRemove :: String
-ddmRemove = Types.ddmFullToRaw DdmFullRemove
-
-ddmsValues :: FrozenSet String
-ddmsValues = ConstantUtils.mkSet [ddmAdd, ddmRemove]
-
-ddmsValuesWithModify :: FrozenSet String
-ddmsValuesWithModify = ConstantUtils.mkSet $ map Types.ddmFullToRaw [minBound..]
-
--- * Common exit codes
-
-exitSuccess :: Int
-exitSuccess = 0
-
-exitFailure :: Int
-exitFailure = ConstantUtils.exitFailure
-
-exitNotcluster :: Int
-exitNotcluster = 5
-
-exitNotmaster :: Int
-exitNotmaster = 11
-
-exitNodesetupError :: Int
-exitNodesetupError = 12
-
--- | Need user confirmation
-exitConfirmation :: Int
-exitConfirmation = 13
-
--- | Exit code for query operations with unknown fields
-exitUnknownField :: Int
-exitUnknownField = 14
-
--- * Tags
-
-tagCluster :: String
-tagCluster = Types.tagKindToRaw TagKindCluster
-
-tagInstance :: String
-tagInstance = Types.tagKindToRaw TagKindInstance
-
-tagNetwork :: String
-tagNetwork = Types.tagKindToRaw TagKindNetwork
-
-tagNode :: String
-tagNode = Types.tagKindToRaw TagKindNode
-
-tagNodegroup :: String
-tagNodegroup = Types.tagKindToRaw TagKindGroup
-
-validTagTypes :: FrozenSet String
-validTagTypes = ConstantUtils.mkSet $ map Types.tagKindToRaw [minBound..]
-
-maxTagLen :: Int
-maxTagLen = 128
-
-maxTagsPerObj :: Int
-maxTagsPerObj = 4096
-
--- * Others
-
-defaultBridge :: String
-defaultBridge = "xen-br0"
-
-defaultOvs :: String
-defaultOvs = "switch1"
-
--- | 60 MiB/s, expressed in KiB/s
-classicDrbdSyncSpeed :: Int
-classicDrbdSyncSpeed = 60 * 1024
-
-ip4AddressAny :: String
-ip4AddressAny = "0.0.0.0"
-
-ip4AddressLocalhost :: String
-ip4AddressLocalhost = "127.0.0.1"
-
-ip6AddressAny :: String
-ip6AddressAny = "::"
-
-ip6AddressLocalhost :: String
-ip6AddressLocalhost = "::1"
-
-ip4Version :: Int
-ip4Version = 4
-
-ip6Version :: Int
-ip6Version = 6
-
-validIpVersions :: FrozenSet Int
-validIpVersions = ConstantUtils.mkSet [ip4Version, ip6Version]
-
-tcpPingTimeout :: Int
-tcpPingTimeout = 10
-
-defaultVg :: String
-defaultVg = "xenvg"
-
-defaultDrbdHelper :: String
-defaultDrbdHelper = "/bin/true"
-
-minVgSize :: Int
-minVgSize = 20480
-
-defaultMacPrefix :: String
-defaultMacPrefix = "aa:00:00"
-
--- | Default maximum instance wait time (seconds)
-defaultShutdownTimeout :: Int
-defaultShutdownTimeout = 120
-
--- | Node clock skew (seconds)
-nodeMaxClockSkew :: Int
-nodeMaxClockSkew = 150
-
--- | Time for an intra-cluster disk transfer to wait for a connection
-diskTransferConnectTimeout :: Int
-diskTransferConnectTimeout = 60
-
--- | Disk index separator
-diskSeparator :: String
-diskSeparator = AutoConf.diskSeparator
-
-ipCommandPath :: String
-ipCommandPath = AutoConf.ipPath
-
--- | Key for job IDs in opcode result
-jobIdsKey :: String
-jobIdsKey = "jobs"
-
--- * Runparts results
-
-runpartsErr :: Int
-runpartsErr = 2
-
-runpartsRun :: Int
-runpartsRun = 1
-
-runpartsSkip :: Int
-runpartsSkip = 0
-
-runpartsStatus :: [Int]
-runpartsStatus = [runpartsErr, runpartsRun, runpartsSkip]
-
--- * RPC
-
-rpcEncodingNone :: Int
-rpcEncodingNone = 0
-
-rpcEncodingZlibBase64 :: Int
-rpcEncodingZlibBase64 = 1
-
--- * Timeout table
---
--- Various time constants for the timeout table
-
-rpcTmoUrgent :: Int
-rpcTmoUrgent = Types.rpcTimeoutToRaw Urgent
-
-rpcTmoFast :: Int
-rpcTmoFast = Types.rpcTimeoutToRaw Fast
-
-rpcTmoNormal :: Int
-rpcTmoNormal = Types.rpcTimeoutToRaw Normal
-
-rpcTmoSlow :: Int
-rpcTmoSlow = Types.rpcTimeoutToRaw Slow
-
--- | 'rpcTmo_4hrs' contains an underscore to circumvent a limitation
--- in the 'Ganeti.THH.deCamelCase' function and generate the correct
--- Python name.
-rpcTmo_4hrs :: Int
-rpcTmo_4hrs = Types.rpcTimeoutToRaw FourHours
-
--- | 'rpcTmo_1day' contains an underscore to circumvent a limitation
--- in the 'Ganeti.THH.deCamelCase' function and generate the correct
--- Python name.
-rpcTmo_1day :: Int
-rpcTmo_1day = Types.rpcTimeoutToRaw OneDay
-
--- | Timeout for connecting to nodes (seconds)
-rpcConnectTimeout :: Int
-rpcConnectTimeout = 5
-
--- OS
-
-osScriptCreate :: String
-osScriptCreate = "create"
-
-osScriptExport :: String
-osScriptExport = "export"
-
-osScriptImport :: String
-osScriptImport = "import"
-
-osScriptRename :: String
-osScriptRename = "rename"
-
-osScriptVerify :: String
-osScriptVerify = "verify"
-
-osScripts :: [String]
-osScripts = [osScriptCreate, osScriptExport, osScriptImport, osScriptRename,
- osScriptVerify]
-
-osApiFile :: String
-osApiFile = "ganeti_api_version"
-
-osVariantsFile :: String
-osVariantsFile = "variants.list"
-
-osParametersFile :: String
-osParametersFile = "parameters.list"
-
-osValidateParameters :: String
-osValidateParameters = "parameters"
-
-osValidateCalls :: FrozenSet String
-osValidateCalls = ConstantUtils.mkSet [osValidateParameters]
-
--- | External Storage (ES) related constants
-
-esActionAttach :: String
-esActionAttach = "attach"
-
-esActionCreate :: String
-esActionCreate = "create"
-
-esActionDetach :: String
-esActionDetach = "detach"
-
-esActionGrow :: String
-esActionGrow = "grow"
-
-esActionRemove :: String
-esActionRemove = "remove"
-
-esActionSetinfo :: String
-esActionSetinfo = "setinfo"
-
-esActionVerify :: String
-esActionVerify = "verify"
-
-esScriptCreate :: String
-esScriptCreate = esActionCreate
-
-esScriptRemove :: String
-esScriptRemove = esActionRemove
-
-esScriptGrow :: String
-esScriptGrow = esActionGrow
-
-esScriptAttach :: String
-esScriptAttach = esActionAttach
-
-esScriptDetach :: String
-esScriptDetach = esActionDetach
-
-esScriptSetinfo :: String
-esScriptSetinfo = esActionSetinfo
-
-esScriptVerify :: String
-esScriptVerify = esActionVerify
-
-esScripts :: FrozenSet String
-esScripts =
- ConstantUtils.mkSet [esScriptAttach,
- esScriptCreate,
- esScriptDetach,
- esScriptGrow,
- esScriptRemove,
- esScriptSetinfo,
- esScriptVerify]
-
-esParametersFile :: String
-esParametersFile = "parameters.list"
-
--- * Reboot types
-
-instanceRebootSoft :: String
-instanceRebootSoft = Types.rebootTypeToRaw RebootSoft
-
-instanceRebootHard :: String
-instanceRebootHard = Types.rebootTypeToRaw RebootHard
-
-instanceRebootFull :: String
-instanceRebootFull = Types.rebootTypeToRaw RebootFull
-
-rebootTypes :: FrozenSet String
-rebootTypes = ConstantUtils.mkSet $ map Types.rebootTypeToRaw [minBound..]
-
--- * Instance reboot behaviors
-
-instanceRebootAllowed :: String
-instanceRebootAllowed = "reboot"
-
-instanceRebootExit :: String
-instanceRebootExit = "exit"
-
-rebootBehaviors :: [String]
-rebootBehaviors = [instanceRebootAllowed, instanceRebootExit]
-
--- * VTypes
-
-vtypeBool :: VType
-vtypeBool = VTypeBool
-
-vtypeInt :: VType
-vtypeInt = VTypeInt
-
-vtypeMaybeString :: VType
-vtypeMaybeString = VTypeMaybeString
-
--- | Size in MiBs
-vtypeSize :: VType
-vtypeSize = VTypeSize
-
-vtypeString :: VType
-vtypeString = VTypeString
-
-enforceableTypes :: FrozenSet VType
-enforceableTypes = ConstantUtils.mkSet [minBound..]
-
--- | Constant representing that the user does not specify any IP version
-ifaceNoIpVersionSpecified :: Int
-ifaceNoIpVersionSpecified = 0
-
-validSerialSpeeds :: [Int]
-validSerialSpeeds =
- [75,
- 110,
- 300,
- 600,
- 1200,
- 1800,
- 2400,
- 4800,
- 9600,
- 14400,
- 19200,
- 28800,
- 38400,
- 57600,
- 115200,
- 230400,
- 345600,
- 460800]
-
--- * HV parameter names (global namespace)
-
-hvAcpi :: String
-hvAcpi = "acpi"
-
-hvBlockdevPrefix :: String
-hvBlockdevPrefix = "blockdev_prefix"
-
-hvBootloaderArgs :: String
-hvBootloaderArgs = "bootloader_args"
-
-hvBootloaderPath :: String
-hvBootloaderPath = "bootloader_path"
-
-hvBootOrder :: String
-hvBootOrder = "boot_order"
-
-hvCdromImagePath :: String
-hvCdromImagePath = "cdrom_image_path"
-
-hvCpuCap :: String
-hvCpuCap = "cpu_cap"
-
-hvCpuCores :: String
-hvCpuCores = "cpu_cores"
-
-hvCpuMask :: String
-hvCpuMask = "cpu_mask"
-
-hvCpuSockets :: String
-hvCpuSockets = "cpu_sockets"
-
-hvCpuThreads :: String
-hvCpuThreads = "cpu_threads"
-
-hvCpuType :: String
-hvCpuType = "cpu_type"
-
-hvCpuWeight :: String
-hvCpuWeight = "cpu_weight"
-
-hvDeviceModel :: String
-hvDeviceModel = "device_model"
-
-hvDiskCache :: String
-hvDiskCache = "disk_cache"
-
-hvDiskType :: String
-hvDiskType = "disk_type"
-
-hvInitrdPath :: String
-hvInitrdPath = "initrd_path"
-
-hvInitScript :: String
-hvInitScript = "init_script"
-
-hvKernelArgs :: String
-hvKernelArgs = "kernel_args"
-
-hvKernelPath :: String
-hvKernelPath = "kernel_path"
-
-hvKeymap :: String
-hvKeymap = "keymap"
-
-hvKvmCdrom2ImagePath :: String
-hvKvmCdrom2ImagePath = "cdrom2_image_path"
-
-hvKvmCdromDiskType :: String
-hvKvmCdromDiskType = "cdrom_disk_type"
-
-hvKvmExtra :: String
-hvKvmExtra = "kvm_extra"
-
-hvKvmFlag :: String
-hvKvmFlag = "kvm_flag"
-
-hvKvmFloppyImagePath :: String
-hvKvmFloppyImagePath = "floppy_image_path"
-
-hvKvmMachineVersion :: String
-hvKvmMachineVersion = "machine_version"
-
-hvKvmPath :: String
-hvKvmPath = "kvm_path"
-
-hvKvmSpiceAudioCompr :: String
-hvKvmSpiceAudioCompr = "spice_playback_compression"
-
-hvKvmSpiceBind :: String
-hvKvmSpiceBind = "spice_bind"
-
-hvKvmSpiceIpVersion :: String
-hvKvmSpiceIpVersion = "spice_ip_version"
-
-hvKvmSpiceJpegImgCompr :: String
-hvKvmSpiceJpegImgCompr = "spice_jpeg_wan_compression"
-
-hvKvmSpiceLosslessImgCompr :: String
-hvKvmSpiceLosslessImgCompr = "spice_image_compression"
-
-hvKvmSpicePasswordFile :: String
-hvKvmSpicePasswordFile = "spice_password_file"
-
-hvKvmSpiceStreamingVideoDetection :: String
-hvKvmSpiceStreamingVideoDetection = "spice_streaming_video"
-
-hvKvmSpiceTlsCiphers :: String
-hvKvmSpiceTlsCiphers = "spice_tls_ciphers"
-
-hvKvmSpiceUseTls :: String
-hvKvmSpiceUseTls = "spice_use_tls"
-
-hvKvmSpiceUseVdagent :: String
-hvKvmSpiceUseVdagent = "spice_use_vdagent"
-
-hvKvmSpiceZlibGlzImgCompr :: String
-hvKvmSpiceZlibGlzImgCompr = "spice_zlib_glz_wan_compression"
-
-hvKvmUseChroot :: String
-hvKvmUseChroot = "use_chroot"
-
-hvMemPath :: String
-hvMemPath = "mem_path"
-
-hvMigrationBandwidth :: String
-hvMigrationBandwidth = "migration_bandwidth"
-
-hvMigrationDowntime :: String
-hvMigrationDowntime = "migration_downtime"
-
-hvMigrationMode :: String
-hvMigrationMode = "migration_mode"
-
-hvMigrationPort :: String
-hvMigrationPort = "migration_port"
-
-hvNicType :: String
-hvNicType = "nic_type"
-
-hvPae :: String
-hvPae = "pae"
-
-hvPassthrough :: String
-hvPassthrough = "pci_pass"
-
-hvRebootBehavior :: String
-hvRebootBehavior = "reboot_behavior"
-
-hvRootPath :: String
-hvRootPath = "root_path"
-
-hvSecurityDomain :: String
-hvSecurityDomain = "security_domain"
-
-hvSecurityModel :: String
-hvSecurityModel = "security_model"
-
-hvSerialConsole :: String
-hvSerialConsole = "serial_console"
-
-hvSerialSpeed :: String
-hvSerialSpeed = "serial_speed"
-
-hvSoundhw :: String
-hvSoundhw = "soundhw"
-
-hvUsbDevices :: String
-hvUsbDevices = "usb_devices"
-
-hvUsbMouse :: String
-hvUsbMouse = "usb_mouse"
-
-hvUseBootloader :: String
-hvUseBootloader = "use_bootloader"
-
-hvUseLocaltime :: String
-hvUseLocaltime = "use_localtime"
-
-hvVga :: String
-hvVga = "vga"
-
-hvVhostNet :: String
-hvVhostNet = "vhost_net"
-
-hvVifScript :: String
-hvVifScript = "vif_script"
-
-hvVifType :: String
-hvVifType = "vif_type"
-
-hvViridian :: String
-hvViridian = "viridian"
-
-hvVncBindAddress :: String
-hvVncBindAddress = "vnc_bind_address"
-
-hvVncPasswordFile :: String
-hvVncPasswordFile = "vnc_password_file"
-
-hvVncTls :: String
-hvVncTls = "vnc_tls"
-
-hvVncX509 :: String
-hvVncX509 = "vnc_x509_path"
-
-hvVncX509Verify :: String
-hvVncX509Verify = "vnc_x509_verify"
-
-hvVnetHdr :: String
-hvVnetHdr = "vnet_hdr"
-
-hvXenCmd :: String
-hvXenCmd = "xen_cmd"
-
-hvXenCpuid :: String
-hvXenCpuid = "cpuid"
-
-hvsParameterTitles :: Map String String
-hvsParameterTitles =
- Map.fromList
- [(hvAcpi, "ACPI"),
- (hvBootOrder, "Boot_order"),
- (hvCdromImagePath, "CDROM_image_path"),
- (hvCpuType, "cpu_type"),
- (hvDiskType, "Disk_type"),
- (hvInitrdPath, "Initrd_path"),
- (hvKernelPath, "Kernel_path"),
- (hvNicType, "NIC_type"),
- (hvPae, "PAE"),
- (hvPassthrough, "pci_pass"),
- (hvVncBindAddress, "VNC_bind_address")]
-
-hvsParameters :: FrozenSet String
-hvsParameters = ConstantUtils.mkSet $ Map.keys hvsParameterTypes
-
-hvsParameterTypes :: Map String VType
-hvsParameterTypes = Map.fromList
- [ (hvAcpi, VTypeBool)
- , (hvBlockdevPrefix, VTypeString)
- , (hvBootloaderArgs, VTypeString)
- , (hvBootloaderPath, VTypeString)
- , (hvBootOrder, VTypeString)
- , (hvCdromImagePath, VTypeString)
- , (hvCpuCap, VTypeInt)
- , (hvCpuCores, VTypeInt)
- , (hvCpuMask, VTypeString)
- , (hvCpuSockets, VTypeInt)
- , (hvCpuThreads, VTypeInt)
- , (hvCpuType, VTypeString)
- , (hvCpuWeight, VTypeInt)
- , (hvDeviceModel, VTypeString)
- , (hvDiskCache, VTypeString)
- , (hvDiskType, VTypeString)
- , (hvInitrdPath, VTypeString)
- , (hvInitScript, VTypeString)
- , (hvKernelArgs, VTypeString)
- , (hvKernelPath, VTypeString)
- , (hvKeymap, VTypeString)
- , (hvKvmCdrom2ImagePath, VTypeString)
- , (hvKvmCdromDiskType, VTypeString)
- , (hvKvmExtra, VTypeString)
- , (hvKvmFlag, VTypeString)
- , (hvKvmFloppyImagePath, VTypeString)
- , (hvKvmMachineVersion, VTypeString)
- , (hvKvmPath, VTypeString)
- , (hvKvmSpiceAudioCompr, VTypeBool)
- , (hvKvmSpiceBind, VTypeString)
- , (hvKvmSpiceIpVersion, VTypeInt)
- , (hvKvmSpiceJpegImgCompr, VTypeString)
- , (hvKvmSpiceLosslessImgCompr, VTypeString)
- , (hvKvmSpicePasswordFile, VTypeString)
- , (hvKvmSpiceStreamingVideoDetection, VTypeString)
- , (hvKvmSpiceTlsCiphers, VTypeString)
- , (hvKvmSpiceUseTls, VTypeBool)
- , (hvKvmSpiceUseVdagent, VTypeBool)
- , (hvKvmSpiceZlibGlzImgCompr, VTypeString)
- , (hvKvmUseChroot, VTypeBool)
- , (hvMemPath, VTypeString)
- , (hvMigrationBandwidth, VTypeInt)
- , (hvMigrationDowntime, VTypeInt)
- , (hvMigrationMode, VTypeString)
- , (hvMigrationPort, VTypeInt)
- , (hvNicType, VTypeString)
- , (hvPae, VTypeBool)
- , (hvPassthrough, VTypeString)
- , (hvRebootBehavior, VTypeString)
- , (hvRootPath, VTypeMaybeString)
- , (hvSecurityDomain, VTypeString)
- , (hvSecurityModel, VTypeString)
- , (hvSerialConsole, VTypeBool)
- , (hvSerialSpeed, VTypeInt)
- , (hvSoundhw, VTypeString)
- , (hvUsbDevices, VTypeString)
- , (hvUsbMouse, VTypeString)
- , (hvUseBootloader, VTypeBool)
- , (hvUseLocaltime, VTypeBool)
- , (hvVga, VTypeString)
- , (hvVhostNet, VTypeBool)
- , (hvVifScript, VTypeString)
- , (hvVifType, VTypeString)
- , (hvViridian, VTypeBool)
- , (hvVncBindAddress, VTypeString)
- , (hvVncPasswordFile, VTypeString)
- , (hvVncTls, VTypeBool)
- , (hvVncX509, VTypeString)
- , (hvVncX509Verify, VTypeBool)
- , (hvVnetHdr, VTypeBool)
- , (hvXenCmd, VTypeString)
- , (hvXenCpuid, VTypeString)
- ]
-
--- * Migration statuses
-
-hvMigrationActive :: String
-hvMigrationActive = "active"
-
-hvMigrationCancelled :: String
-hvMigrationCancelled = "cancelled"
-
-hvMigrationCompleted :: String
-hvMigrationCompleted = "completed"
-
-hvMigrationFailed :: String
-hvMigrationFailed = "failed"
-
-hvMigrationValidStatuses :: FrozenSet String
-hvMigrationValidStatuses =
- ConstantUtils.mkSet [hvMigrationActive,
- hvMigrationCancelled,
- hvMigrationCompleted,
- hvMigrationFailed]
-
-hvMigrationFailedStatuses :: FrozenSet String
-hvMigrationFailedStatuses =
- ConstantUtils.mkSet [hvMigrationFailed, hvMigrationCancelled]
-
--- | KVM-specific statuses
---
--- FIXME: this constant seems unnecessary
-hvKvmMigrationValidStatuses :: FrozenSet String
-hvKvmMigrationValidStatuses = hvMigrationValidStatuses
-
--- | Node info keys
-hvNodeinfoKeyVersion :: String
-hvNodeinfoKeyVersion = "hv_version"
-
--- * Hypervisor state
-
-hvstCpuNode :: String
-hvstCpuNode = "cpu_node"
-
-hvstCpuTotal :: String
-hvstCpuTotal = "cpu_total"
-
-hvstMemoryHv :: String
-hvstMemoryHv = "mem_hv"
-
-hvstMemoryNode :: String
-hvstMemoryNode = "mem_node"
-
-hvstMemoryTotal :: String
-hvstMemoryTotal = "mem_total"
-
-hvstsParameters :: FrozenSet String
-hvstsParameters =
- ConstantUtils.mkSet [hvstCpuNode,
- hvstCpuTotal,
- hvstMemoryHv,
- hvstMemoryNode,
- hvstMemoryTotal]
-
-hvstDefaults :: Map String Int
-hvstDefaults =
- Map.fromList
- [(hvstCpuNode, 1),
- (hvstCpuTotal, 1),
- (hvstMemoryHv, 0),
- (hvstMemoryTotal, 0),
- (hvstMemoryNode, 0)]
-
-hvstsParameterTypes :: Map String VType
-hvstsParameterTypes =
- Map.fromList [(hvstMemoryTotal, VTypeInt),
- (hvstMemoryNode, VTypeInt),
- (hvstMemoryHv, VTypeInt),
- (hvstCpuTotal, VTypeInt),
- (hvstCpuNode, VTypeInt)]
-
--- * Disk state
-
-dsDiskOverhead :: String
-dsDiskOverhead = "disk_overhead"
-
-dsDiskReserved :: String
-dsDiskReserved = "disk_reserved"
-
-dsDiskTotal :: String
-dsDiskTotal = "disk_total"
-
-dsDefaults :: Map String Int
-dsDefaults =
- Map.fromList
- [(dsDiskTotal, 0),
- (dsDiskReserved, 0),
- (dsDiskOverhead, 0)]
-
-dssParameterTypes :: Map String VType
-dssParameterTypes =
- Map.fromList [(dsDiskTotal, VTypeInt),
- (dsDiskReserved, VTypeInt),
- (dsDiskOverhead, VTypeInt)]
-
-dssParameters :: FrozenSet String
-dssParameters =
- ConstantUtils.mkSet [dsDiskTotal, dsDiskReserved, dsDiskOverhead]
-
-dsValidTypes :: FrozenSet String
-dsValidTypes = ConstantUtils.mkSet [Types.diskTemplateToRaw DTPlain]
-
--- Backend parameter names
-
-beAlwaysFailover :: String
-beAlwaysFailover = "always_failover"
-
-beAutoBalance :: String
-beAutoBalance = "auto_balance"
-
-beMaxmem :: String
-beMaxmem = "maxmem"
-
--- | Deprecated and replaced by max and min mem
-beMemory :: String
-beMemory = "memory"
-
-beMinmem :: String
-beMinmem = "minmem"
-
-beSpindleUse :: String
-beSpindleUse = "spindle_use"
-
-beVcpus :: String
-beVcpus = "vcpus"
-
-besParameterTypes :: Map String VType
-besParameterTypes =
- Map.fromList [(beAlwaysFailover, VTypeBool),
- (beAutoBalance, VTypeBool),
- (beMaxmem, VTypeSize),
- (beMinmem, VTypeSize),
- (beSpindleUse, VTypeInt),
- (beVcpus, VTypeInt)]
-
-besParameterTitles :: Map String String
-besParameterTitles =
- Map.fromList [(beAutoBalance, "Auto_balance"),
- (beMinmem, "ConfigMinMem"),
- (beVcpus, "ConfigVCPUs"),
- (beMaxmem, "ConfigMaxMem")]
-
-besParameterCompat :: Map String VType
-besParameterCompat = Map.insert beMemory VTypeSize besParameterTypes
-
-besParameters :: FrozenSet String
-besParameters =
- ConstantUtils.mkSet [beAlwaysFailover,
- beAutoBalance,
- beMaxmem,
- beMinmem,
- beSpindleUse,
- beVcpus]
-
--- | Instance specs
---
--- FIXME: these should be associated with 'Ganeti.HTools.Types.ISpec'
-
-ispecMemSize :: String
-ispecMemSize = ConstantUtils.ispecMemSize
-
-ispecCpuCount :: String
-ispecCpuCount = ConstantUtils.ispecCpuCount
-
-ispecDiskCount :: String
-ispecDiskCount = ConstantUtils.ispecDiskCount
-
-ispecDiskSize :: String
-ispecDiskSize = ConstantUtils.ispecDiskSize
-
-ispecNicCount :: String
-ispecNicCount = ConstantUtils.ispecNicCount
-
-ispecSpindleUse :: String
-ispecSpindleUse = ConstantUtils.ispecSpindleUse
-
-ispecsParameterTypes :: Map String VType
-ispecsParameterTypes =
- Map.fromList
- [(ConstantUtils.ispecDiskSize, VTypeInt),
- (ConstantUtils.ispecCpuCount, VTypeInt),
- (ConstantUtils.ispecSpindleUse, VTypeInt),
- (ConstantUtils.ispecMemSize, VTypeInt),
- (ConstantUtils.ispecNicCount, VTypeInt),
- (ConstantUtils.ispecDiskCount, VTypeInt)]
-
-ispecsParameters :: FrozenSet String
-ispecsParameters =
- ConstantUtils.mkSet [ConstantUtils.ispecCpuCount,
- ConstantUtils.ispecDiskCount,
- ConstantUtils.ispecDiskSize,
- ConstantUtils.ispecMemSize,
- ConstantUtils.ispecNicCount,
- ConstantUtils.ispecSpindleUse]
-
-ispecsMinmax :: String
-ispecsMinmax = ConstantUtils.ispecsMinmax
-
-ispecsMax :: String
-ispecsMax = "max"
-
-ispecsMin :: String
-ispecsMin = "min"
-
-ispecsStd :: String
-ispecsStd = ConstantUtils.ispecsStd
-
-ipolicyDts :: String
-ipolicyDts = ConstantUtils.ipolicyDts
-
-ipolicyVcpuRatio :: String
-ipolicyVcpuRatio = ConstantUtils.ipolicyVcpuRatio
-
-ipolicySpindleRatio :: String
-ipolicySpindleRatio = ConstantUtils.ipolicySpindleRatio
-
-ispecsMinmaxKeys :: FrozenSet String
-ispecsMinmaxKeys = ConstantUtils.mkSet [ispecsMax, ispecsMin]
-
-ipolicyParameters :: FrozenSet String
-ipolicyParameters =
- ConstantUtils.mkSet [ConstantUtils.ipolicyVcpuRatio,
- ConstantUtils.ipolicySpindleRatio]
-
-ipolicyAllKeys :: FrozenSet String
-ipolicyAllKeys =
- ConstantUtils.union ipolicyParameters $
- ConstantUtils.mkSet [ConstantUtils.ipolicyDts,
- ConstantUtils.ispecsMinmax,
- ispecsStd]
-
--- | Node parameter names
-
-ndExclusiveStorage :: String
-ndExclusiveStorage = "exclusive_storage"
-
-ndOobProgram :: String
-ndOobProgram = "oob_program"
-
-ndSpindleCount :: String
-ndSpindleCount = "spindle_count"
-
-ndOvs :: String
-ndOvs = "ovs"
-
-ndOvsLink :: String
-ndOvsLink = "ovs_link"
-
-ndOvsName :: String
-ndOvsName = "ovs_name"
-
-ndSshPort :: String
-ndSshPort = "ssh_port"
-
-ndsParameterTypes :: Map String VType
-ndsParameterTypes =
- Map.fromList
- [(ndExclusiveStorage, VTypeBool),
- (ndOobProgram, VTypeString),
- (ndOvs, VTypeBool),
- (ndOvsLink, VTypeMaybeString),
- (ndOvsName, VTypeMaybeString),
- (ndSpindleCount, VTypeInt),
- (ndSshPort, VTypeInt)]
-
-ndsParameters :: FrozenSet String
-ndsParameters = ConstantUtils.mkSet (Map.keys ndsParameterTypes)
-
-ndsParameterTitles :: Map String String
-ndsParameterTitles =
- Map.fromList
- [(ndExclusiveStorage, "ExclusiveStorage"),
- (ndOobProgram, "OutOfBandProgram"),
- (ndOvs, "OpenvSwitch"),
- (ndOvsLink, "OpenvSwitchLink"),
- (ndOvsName, "OpenvSwitchName"),
- (ndSpindleCount, "SpindleCount")]
-
--- * Logical Disks parameters
-
-ldpAccess :: String
-ldpAccess = "access"
-
-ldpBarriers :: String
-ldpBarriers = "disabled-barriers"
-
-ldpDefaultMetavg :: String
-ldpDefaultMetavg = "default-metavg"
-
-ldpDelayTarget :: String
-ldpDelayTarget = "c-delay-target"
-
-ldpDiskCustom :: String
-ldpDiskCustom = "disk-custom"
-
-ldpDynamicResync :: String
-ldpDynamicResync = "dynamic-resync"
-
-ldpFillTarget :: String
-ldpFillTarget = "c-fill-target"
-
-ldpMaxRate :: String
-ldpMaxRate = "c-max-rate"
-
-ldpMinRate :: String
-ldpMinRate = "c-min-rate"
-
-ldpNetCustom :: String
-ldpNetCustom = "net-custom"
-
-ldpNoMetaFlush :: String
-ldpNoMetaFlush = "disable-meta-flush"
-
-ldpPlanAhead :: String
-ldpPlanAhead = "c-plan-ahead"
-
-ldpPool :: String
-ldpPool = "pool"
-
-ldpProtocol :: String
-ldpProtocol = "protocol"
-
-ldpResyncRate :: String
-ldpResyncRate = "resync-rate"
-
-ldpStripes :: String
-ldpStripes = "stripes"
-
-diskLdTypes :: Map String VType
-diskLdTypes =
- Map.fromList
- [(ldpAccess, VTypeString),
- (ldpResyncRate, VTypeInt),
- (ldpStripes, VTypeInt),
- (ldpBarriers, VTypeString),
- (ldpNoMetaFlush, VTypeBool),
- (ldpDefaultMetavg, VTypeString),
- (ldpDiskCustom, VTypeString),
- (ldpNetCustom, VTypeString),
- (ldpProtocol, VTypeString),
- (ldpDynamicResync, VTypeBool),
- (ldpPlanAhead, VTypeInt),
- (ldpFillTarget, VTypeInt),
- (ldpDelayTarget, VTypeInt),
- (ldpMaxRate, VTypeInt),
- (ldpMinRate, VTypeInt),
- (ldpPool, VTypeString)]
-
-diskLdParameters :: FrozenSet String
-diskLdParameters = ConstantUtils.mkSet (Map.keys diskLdTypes)
-
--- * Disk template parameters
---
--- Disk template parameters can be set/changed by the user via
--- gnt-cluster and gnt-group)
-
-drbdResyncRate :: String
-drbdResyncRate = "resync-rate"
-
-drbdDataStripes :: String
-drbdDataStripes = "data-stripes"
-
-drbdMetaStripes :: String
-drbdMetaStripes = "meta-stripes"
-
-drbdDiskBarriers :: String
-drbdDiskBarriers = "disk-barriers"
-
-drbdMetaBarriers :: String
-drbdMetaBarriers = "meta-barriers"
-
-drbdDefaultMetavg :: String
-drbdDefaultMetavg = "metavg"
-
-drbdDiskCustom :: String
-drbdDiskCustom = "disk-custom"
-
-drbdNetCustom :: String
-drbdNetCustom = "net-custom"
-
-drbdProtocol :: String
-drbdProtocol = "protocol"
-
-drbdDynamicResync :: String
-drbdDynamicResync = "dynamic-resync"
-
-drbdPlanAhead :: String
-drbdPlanAhead = "c-plan-ahead"
-
-drbdFillTarget :: String
-drbdFillTarget = "c-fill-target"
-
-drbdDelayTarget :: String
-drbdDelayTarget = "c-delay-target"
-
-drbdMaxRate :: String
-drbdMaxRate = "c-max-rate"
-
-drbdMinRate :: String
-drbdMinRate = "c-min-rate"
-
-lvStripes :: String
-lvStripes = "stripes"
-
-rbdAccess :: String
-rbdAccess = "access"
-
-rbdPool :: String
-rbdPool = "pool"
-
-diskDtTypes :: Map String VType
-diskDtTypes =
- Map.fromList [(drbdResyncRate, VTypeInt),
- (drbdDataStripes, VTypeInt),
- (drbdMetaStripes, VTypeInt),
- (drbdDiskBarriers, VTypeString),
- (drbdMetaBarriers, VTypeBool),
- (drbdDefaultMetavg, VTypeString),
- (drbdDiskCustom, VTypeString),
- (drbdNetCustom, VTypeString),
- (drbdProtocol, VTypeString),
- (drbdDynamicResync, VTypeBool),
- (drbdPlanAhead, VTypeInt),
- (drbdFillTarget, VTypeInt),
- (drbdDelayTarget, VTypeInt),
- (drbdMaxRate, VTypeInt),
- (drbdMinRate, VTypeInt),
- (lvStripes, VTypeInt),
- (rbdAccess, VTypeString),
- (rbdPool, VTypeString)]
-
-diskDtParameters :: FrozenSet String
-diskDtParameters = ConstantUtils.mkSet (Map.keys diskDtTypes)
-
--- * Dynamic disk parameters
-
-ddpLocalIp :: String
-ddpLocalIp = "local-ip"
-
-ddpRemoteIp :: String
-ddpRemoteIp = "remote-ip"
-
-ddpPort :: String
-ddpPort = "port"
-
-ddpLocalMinor :: String
-ddpLocalMinor = "local-minor"
-
-ddpRemoteMinor :: String
-ddpRemoteMinor = "remote-minor"
-
--- * OOB supported commands
-
-oobPowerOn :: String
-oobPowerOn = Types.oobCommandToRaw OobPowerOn
-
-oobPowerOff :: String
-oobPowerOff = Types.oobCommandToRaw OobPowerOff
-
-oobPowerCycle :: String
-oobPowerCycle = Types.oobCommandToRaw OobPowerCycle
-
-oobPowerStatus :: String
-oobPowerStatus = Types.oobCommandToRaw OobPowerStatus
-
-oobHealth :: String
-oobHealth = Types.oobCommandToRaw OobHealth
-
-oobCommands :: FrozenSet String
-oobCommands = ConstantUtils.mkSet $ map Types.oobCommandToRaw [minBound..]
-
-oobPowerStatusPowered :: String
-oobPowerStatusPowered = "powered"
-
--- | 60 seconds
-oobTimeout :: Int
-oobTimeout = 60
-
--- | 2 seconds
-oobPowerDelay :: Double
-oobPowerDelay = 2.0
-
-oobStatusCritical :: String
-oobStatusCritical = Types.oobStatusToRaw OobStatusCritical
-
-oobStatusOk :: String
-oobStatusOk = Types.oobStatusToRaw OobStatusOk
-
-oobStatusUnknown :: String
-oobStatusUnknown = Types.oobStatusToRaw OobStatusUnknown
-
-oobStatusWarning :: String
-oobStatusWarning = Types.oobStatusToRaw OobStatusWarning
-
-oobStatuses :: FrozenSet String
-oobStatuses = ConstantUtils.mkSet $ map Types.oobStatusToRaw [minBound..]
-
--- | Instance Parameters Profile
-ppDefault :: String
-ppDefault = "default"
-
--- * nic* constants are used inside the ganeti config
-
-nicLink :: String
-nicLink = "link"
-
-nicMode :: String
-nicMode = "mode"
-
-nicVlan :: String
-nicVlan = "vlan"
-
-nicsParameterTypes :: Map String VType
-nicsParameterTypes =
- Map.fromList [(nicMode, vtypeString),
- (nicLink, vtypeString),
- (nicVlan, vtypeMaybeString)]
-
-nicsParameters :: FrozenSet String
-nicsParameters = ConstantUtils.mkSet (Map.keys nicsParameterTypes)
-
-nicModeBridged :: String
-nicModeBridged = Types.nICModeToRaw NMBridged
-
-nicModeRouted :: String
-nicModeRouted = Types.nICModeToRaw NMRouted
-
-nicModeOvs :: String
-nicModeOvs = Types.nICModeToRaw NMOvs
-
-nicIpPool :: String
-nicIpPool = Types.nICModeToRaw NMPool
-
-nicValidModes :: FrozenSet String
-nicValidModes = ConstantUtils.mkSet $ map Types.nICModeToRaw [minBound..]
-
-releaseAction :: String
-releaseAction = "release"
-
-reserveAction :: String
-reserveAction = "reserve"
-
--- * idisk* constants are used in opcodes, to create/change disks
-
-idiskAdopt :: String
-idiskAdopt = "adopt"
-
-idiskMetavg :: String
-idiskMetavg = "metavg"
-
-idiskMode :: String
-idiskMode = "mode"
-
-idiskName :: String
-idiskName = "name"
-
-idiskSize :: String
-idiskSize = "size"
-
-idiskSpindles :: String
-idiskSpindles = "spindles"
-
-idiskVg :: String
-idiskVg = "vg"
-
-idiskProvider :: String
-idiskProvider = "provider"
-
-idiskParamsTypes :: Map String VType
-idiskParamsTypes =
- Map.fromList [(idiskSize, VTypeSize),
- (idiskSpindles, VTypeInt),
- (idiskMode, VTypeString),
- (idiskAdopt, VTypeString),
- (idiskVg, VTypeString),
- (idiskMetavg, VTypeString),
- (idiskProvider, VTypeString),
- (idiskName, VTypeMaybeString)]
-
-idiskParams :: FrozenSet String
-idiskParams = ConstantUtils.mkSet (Map.keys idiskParamsTypes)
-
--- * inic* constants are used in opcodes, to create/change nics
-
-inicBridge :: String
-inicBridge = "bridge"
-
-inicIp :: String
-inicIp = "ip"
-
-inicLink :: String
-inicLink = "link"
-
-inicMac :: String
-inicMac = "mac"
-
-inicMode :: String
-inicMode = "mode"
-
-inicName :: String
-inicName = "name"
-
-inicNetwork :: String
-inicNetwork = "network"
-
-inicVlan :: String
-inicVlan = "vlan"
-
-inicParamsTypes :: Map String VType
-inicParamsTypes =
- Map.fromList [(inicBridge, VTypeMaybeString),
- (inicIp, VTypeMaybeString),
- (inicLink, VTypeString),
- (inicMac, VTypeString),
- (inicMode, VTypeString),
- (inicName, VTypeMaybeString),
- (inicNetwork, VTypeMaybeString),
- (inicVlan, VTypeMaybeString)]
-
-inicParams :: FrozenSet String
-inicParams = ConstantUtils.mkSet (Map.keys inicParamsTypes)
-
--- * Hypervisor constants
-
-htXenPvm :: String
-htXenPvm = Types.hypervisorToRaw XenPvm
-
-htFake :: String
-htFake = Types.hypervisorToRaw Fake
-
-htXenHvm :: String
-htXenHvm = Types.hypervisorToRaw XenHvm
-
-htKvm :: String
-htKvm = Types.hypervisorToRaw Kvm
-
-htChroot :: String
-htChroot = Types.hypervisorToRaw Chroot
-
-htLxc :: String
-htLxc = Types.hypervisorToRaw Lxc
-
-hyperTypes :: FrozenSet String
-hyperTypes = ConstantUtils.mkSet $ map Types.hypervisorToRaw [minBound..]
-
-htsReqPort :: FrozenSet String
-htsReqPort = ConstantUtils.mkSet [htXenHvm, htKvm]
-
-vncBasePort :: Int
-vncBasePort = 5900
-
-vncDefaultBindAddress :: String
-vncDefaultBindAddress = ip4AddressAny
-
--- * NIC types
-
-htNicE1000 :: String
-htNicE1000 = "e1000"
-
-htNicI82551 :: String
-htNicI82551 = "i82551"
-
-htNicI8259er :: String
-htNicI8259er = "i82559er"
-
-htNicI85557b :: String
-htNicI85557b = "i82557b"
-
-htNicNe2kIsa :: String
-htNicNe2kIsa = "ne2k_isa"
-
-htNicNe2kPci :: String
-htNicNe2kPci = "ne2k_pci"
-
-htNicParavirtual :: String
-htNicParavirtual = "paravirtual"
-
-htNicPcnet :: String
-htNicPcnet = "pcnet"
-
-htNicRtl8139 :: String
-htNicRtl8139 = "rtl8139"
-
-htHvmValidNicTypes :: FrozenSet String
-htHvmValidNicTypes =
- ConstantUtils.mkSet [htNicE1000,
- htNicNe2kIsa,
- htNicNe2kPci,
- htNicParavirtual,
- htNicRtl8139]
-
-htKvmValidNicTypes :: FrozenSet String
-htKvmValidNicTypes =
- ConstantUtils.mkSet [htNicE1000,
- htNicI82551,
- htNicI8259er,
- htNicI85557b,
- htNicNe2kIsa,
- htNicNe2kPci,
- htNicParavirtual,
- htNicPcnet,
- htNicRtl8139]
-
--- * Vif types
-
--- | Default vif type in xen-hvm
-htHvmVifIoemu :: String
-htHvmVifIoemu = "ioemu"
-
-htHvmVifVif :: String
-htHvmVifVif = "vif"
-
-htHvmValidVifTypes :: FrozenSet String
-htHvmValidVifTypes = ConstantUtils.mkSet [htHvmVifIoemu, htHvmVifVif]
-
--- * Disk types
-
-htDiskIde :: String
-htDiskIde = "ide"
-
-htDiskIoemu :: String
-htDiskIoemu = "ioemu"
-
-htDiskMtd :: String
-htDiskMtd = "mtd"
-
-htDiskParavirtual :: String
-htDiskParavirtual = "paravirtual"
-
-htDiskPflash :: String
-htDiskPflash = "pflash"
-
-htDiskScsi :: String
-htDiskScsi = "scsi"
-
-htDiskSd :: String
-htDiskSd = "sd"
-
-htHvmValidDiskTypes :: FrozenSet String
-htHvmValidDiskTypes = ConstantUtils.mkSet [htDiskIoemu, htDiskParavirtual]
-
-htKvmValidDiskTypes :: FrozenSet String
-htKvmValidDiskTypes =
- ConstantUtils.mkSet [htDiskIde,
- htDiskMtd,
- htDiskParavirtual,
- htDiskPflash,
- htDiskScsi,
- htDiskSd]
-
-htCacheDefault :: String
-htCacheDefault = "default"
-
-htCacheNone :: String
-htCacheNone = "none"
-
-htCacheWback :: String
-htCacheWback = "writeback"
-
-htCacheWthrough :: String
-htCacheWthrough = "writethrough"
-
-htValidCacheTypes :: FrozenSet String
-htValidCacheTypes =
- ConstantUtils.mkSet [htCacheDefault,
- htCacheNone,
- htCacheWback,
- htCacheWthrough]
-
--- * Mouse types
-
-htMouseMouse :: String
-htMouseMouse = "mouse"
-
-htMouseTablet :: String
-htMouseTablet = "tablet"
-
-htKvmValidMouseTypes :: FrozenSet String
-htKvmValidMouseTypes = ConstantUtils.mkSet [htMouseMouse, htMouseTablet]
-
--- * Boot order
-
-htBoCdrom :: String
-htBoCdrom = "cdrom"
-
-htBoDisk :: String
-htBoDisk = "disk"
-
-htBoFloppy :: String
-htBoFloppy = "floppy"
-
-htBoNetwork :: String
-htBoNetwork = "network"
-
-htKvmValidBoTypes :: FrozenSet String
-htKvmValidBoTypes =
- ConstantUtils.mkSet [htBoCdrom, htBoDisk, htBoFloppy, htBoNetwork]
-
--- * SPICE lossless image compression options
-
-htKvmSpiceLosslessImgComprAutoGlz :: String
-htKvmSpiceLosslessImgComprAutoGlz = "auto_glz"
-
-htKvmSpiceLosslessImgComprAutoLz :: String
-htKvmSpiceLosslessImgComprAutoLz = "auto_lz"
-
-htKvmSpiceLosslessImgComprGlz :: String
-htKvmSpiceLosslessImgComprGlz = "glz"
-
-htKvmSpiceLosslessImgComprLz :: String
-htKvmSpiceLosslessImgComprLz = "lz"
-
-htKvmSpiceLosslessImgComprOff :: String
-htKvmSpiceLosslessImgComprOff = "off"
-
-htKvmSpiceLosslessImgComprQuic :: String
-htKvmSpiceLosslessImgComprQuic = "quic"
-
-htKvmSpiceValidLosslessImgComprOptions :: FrozenSet String
-htKvmSpiceValidLosslessImgComprOptions =
- ConstantUtils.mkSet [htKvmSpiceLosslessImgComprAutoGlz,
- htKvmSpiceLosslessImgComprAutoLz,
- htKvmSpiceLosslessImgComprGlz,
- htKvmSpiceLosslessImgComprLz,
- htKvmSpiceLosslessImgComprOff,
- htKvmSpiceLosslessImgComprQuic]
-
-htKvmSpiceLossyImgComprAlways :: String
-htKvmSpiceLossyImgComprAlways = "always"
-
-htKvmSpiceLossyImgComprAuto :: String
-htKvmSpiceLossyImgComprAuto = "auto"
-
-htKvmSpiceLossyImgComprNever :: String
-htKvmSpiceLossyImgComprNever = "never"
-
-htKvmSpiceValidLossyImgComprOptions :: FrozenSet String
-htKvmSpiceValidLossyImgComprOptions =
- ConstantUtils.mkSet [htKvmSpiceLossyImgComprAlways,
- htKvmSpiceLossyImgComprAuto,
- htKvmSpiceLossyImgComprNever]
-
--- * SPICE video stream detection
-
-htKvmSpiceVideoStreamDetectionAll :: String
-htKvmSpiceVideoStreamDetectionAll = "all"
-
-htKvmSpiceVideoStreamDetectionFilter :: String
-htKvmSpiceVideoStreamDetectionFilter = "filter"
-
-htKvmSpiceVideoStreamDetectionOff :: String
-htKvmSpiceVideoStreamDetectionOff = "off"
-
-htKvmSpiceValidVideoStreamDetectionOptions :: FrozenSet String
-htKvmSpiceValidVideoStreamDetectionOptions =
- ConstantUtils.mkSet [htKvmSpiceVideoStreamDetectionAll,
- htKvmSpiceVideoStreamDetectionFilter,
- htKvmSpiceVideoStreamDetectionOff]
-
--- * Security models
-
-htSmNone :: String
-htSmNone = "none"
-
-htSmPool :: String
-htSmPool = "pool"
-
-htSmUser :: String
-htSmUser = "user"
-
-htKvmValidSmTypes :: FrozenSet String
-htKvmValidSmTypes = ConstantUtils.mkSet [htSmNone, htSmPool, htSmUser]
-
--- * Kvm flag values
-
-htKvmDisabled :: String
-htKvmDisabled = "disabled"
-
-htKvmEnabled :: String
-htKvmEnabled = "enabled"
-
-htKvmFlagValues :: FrozenSet String
-htKvmFlagValues = ConstantUtils.mkSet [htKvmDisabled, htKvmEnabled]
-
--- * Migration type
-
-htMigrationLive :: String
-htMigrationLive = Types.migrationModeToRaw MigrationLive
-
-htMigrationNonlive :: String
-htMigrationNonlive = Types.migrationModeToRaw MigrationNonLive
-
-htMigrationModes :: FrozenSet String
-htMigrationModes =
- ConstantUtils.mkSet $ map Types.migrationModeToRaw [minBound..]
-
--- * Cluster verify steps
-
-verifyNplusoneMem :: String
-verifyNplusoneMem = Types.verifyOptionalChecksToRaw VerifyNPlusOneMem
-
-verifyOptionalChecks :: FrozenSet String
-verifyOptionalChecks =
- ConstantUtils.mkSet $ map Types.verifyOptionalChecksToRaw [minBound..]
-
--- * Cluster Verify error classes
-
-cvTcluster :: String
-cvTcluster = "cluster"
-
-cvTgroup :: String
-cvTgroup = "group"
-
-cvTnode :: String
-cvTnode = "node"
-
-cvTinstance :: String
-cvTinstance = "instance"
-
--- * Cluster Verify error codes and documentation
-
-cvEclustercert :: (String, String, String)
-cvEclustercert =
- ("cluster",
- Types.cVErrorCodeToRaw CvECLUSTERCERT,
- "Cluster certificate files verification failure")
-
-cvEclustercfg :: (String, String, String)
-cvEclustercfg =
- ("cluster",
- Types.cVErrorCodeToRaw CvECLUSTERCFG,
- "Cluster configuration verification failure")
-
-cvEclusterdanglinginst :: (String, String, String)
-cvEclusterdanglinginst =
- ("node",
- Types.cVErrorCodeToRaw CvECLUSTERDANGLINGINST,
- "Some instances have a non-existing primary node")
-
-cvEclusterdanglingnodes :: (String, String, String)
-cvEclusterdanglingnodes =
- ("node",
- Types.cVErrorCodeToRaw CvECLUSTERDANGLINGNODES,
- "Some nodes belong to non-existing groups")
-
-cvEclusterfilecheck :: (String, String, String)
-cvEclusterfilecheck =
- ("cluster",
- Types.cVErrorCodeToRaw CvECLUSTERFILECHECK,
- "Cluster configuration verification failure")
-
-cvEgroupdifferentpvsize :: (String, String, String)
-cvEgroupdifferentpvsize =
- ("group",
- Types.cVErrorCodeToRaw CvEGROUPDIFFERENTPVSIZE,
- "PVs in the group have different sizes")
-
-cvEinstancebadnode :: (String, String, String)
-cvEinstancebadnode =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEBADNODE,
- "Instance marked as running lives on an offline node")
-
-cvEinstancedown :: (String, String, String)
-cvEinstancedown =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEDOWN,
- "Instance not running on its primary node")
-
-cvEinstancefaultydisk :: (String, String, String)
-cvEinstancefaultydisk =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEFAULTYDISK,
- "Impossible to retrieve status for a disk")
-
-cvEinstancelayout :: (String, String, String)
-cvEinstancelayout =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCELAYOUT,
- "Instance has multiple secondary nodes")
-
-cvEinstancemissingcfgparameter :: (String, String, String)
-cvEinstancemissingcfgparameter =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEMISSINGCFGPARAMETER,
- "A configuration parameter for an instance is missing")
-
-cvEinstancemissingdisk :: (String, String, String)
-cvEinstancemissingdisk =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEMISSINGDISK,
- "Missing volume on an instance")
-
-cvEinstancepolicy :: (String, String, String)
-cvEinstancepolicy =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEPOLICY,
- "Instance does not meet policy")
-
-cvEinstancesplitgroups :: (String, String, String)
-cvEinstancesplitgroups =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCESPLITGROUPS,
- "Instance with primary and secondary nodes in different groups")
-
-cvEinstanceunsuitablenode :: (String, String, String)
-cvEinstanceunsuitablenode =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEUNSUITABLENODE,
- "Instance running on nodes that are not suitable for it")
-
-cvEinstancewrongnode :: (String, String, String)
-cvEinstancewrongnode =
- ("instance",
- Types.cVErrorCodeToRaw CvEINSTANCEWRONGNODE,
- "Instance running on the wrong node")
-
-cvEnodedrbd :: (String, String, String)
-cvEnodedrbd =
- ("node",
- Types.cVErrorCodeToRaw CvENODEDRBD,
- "Error parsing the DRBD status file")
-
-cvEnodedrbdhelper :: (String, String, String)
-cvEnodedrbdhelper =
- ("node",
- Types.cVErrorCodeToRaw CvENODEDRBDHELPER,
- "Error caused by the DRBD helper")
-
-cvEnodedrbdversion :: (String, String, String)
-cvEnodedrbdversion =
- ("node",
- Types.cVErrorCodeToRaw CvENODEDRBDVERSION,
- "DRBD version mismatch within a node group")
-
-cvEnodefilecheck :: (String, String, String)
-cvEnodefilecheck =
- ("node",
- Types.cVErrorCodeToRaw CvENODEFILECHECK,
- "Error retrieving the checksum of the node files")
-
-cvEnodefilestoragepaths :: (String, String, String)
-cvEnodefilestoragepaths =
- ("node",
- Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHS,
- "Detected bad file storage paths")
-
-cvEnodefilestoragepathunusable :: (String, String, String)
-cvEnodefilestoragepathunusable =
- ("node",
- Types.cVErrorCodeToRaw CvENODEFILESTORAGEPATHUNUSABLE,
- "File storage path unusable")
-
-cvEnodehooks :: (String, String, String)
-cvEnodehooks =
- ("node",
- Types.cVErrorCodeToRaw CvENODEHOOKS,
- "Communication failure in hooks execution")
-
-cvEnodehv :: (String, String, String)
-cvEnodehv =
- ("node",
- Types.cVErrorCodeToRaw CvENODEHV,
- "Hypervisor parameters verification failure")
-
-cvEnodelvm :: (String, String, String)
-cvEnodelvm =
- ("node",
- Types.cVErrorCodeToRaw CvENODELVM,
- "LVM-related node error")
-
-cvEnoden1 :: (String, String, String)
-cvEnoden1 =
- ("node",
- Types.cVErrorCodeToRaw CvENODEN1,
- "Not enough memory to accommodate instance failovers")
-
-cvEnodenet :: (String, String, String)
-cvEnodenet =
- ("node",
- Types.cVErrorCodeToRaw CvENODENET,
- "Network-related node error")
-
-cvEnodeoobpath :: (String, String, String)
-cvEnodeoobpath =
- ("node",
- Types.cVErrorCodeToRaw CvENODEOOBPATH,
- "Invalid Out Of Band path")
-
-cvEnodeorphaninstance :: (String, String, String)
-cvEnodeorphaninstance =
- ("node",
- Types.cVErrorCodeToRaw CvENODEORPHANINSTANCE,
- "Unknown intance running on a node")
-
-cvEnodeorphanlv :: (String, String, String)
-cvEnodeorphanlv =
- ("node",
- Types.cVErrorCodeToRaw CvENODEORPHANLV,
- "Unknown LVM logical volume")
-
-cvEnodeos :: (String, String, String)
-cvEnodeos =
- ("node",
- Types.cVErrorCodeToRaw CvENODEOS,
- "OS-related node error")
-
-cvEnoderpc :: (String, String, String)
-cvEnoderpc =
- ("node",
- Types.cVErrorCodeToRaw CvENODERPC,
- "Error during connection to the primary node of an instance")
-
-cvEnodesetup :: (String, String, String)
-cvEnodesetup =
- ("node",
- Types.cVErrorCodeToRaw CvENODESETUP,
- "Node setup error")
-
-cvEnodesharedfilestoragepathunusable :: (String, String, String)
-cvEnodesharedfilestoragepathunusable =
- ("node",
- Types.cVErrorCodeToRaw CvENODESHAREDFILESTORAGEPATHUNUSABLE,
- "Shared file storage path unusable")
-
-cvEnodessh :: (String, String, String)
-cvEnodessh =
- ("node",
- Types.cVErrorCodeToRaw CvENODESSH,
- "SSH-related node error")
-
-cvEnodetime :: (String, String, String)
-cvEnodetime =
- ("node",
- Types.cVErrorCodeToRaw CvENODETIME,
- "Node returned invalid time")
-
-cvEnodeuserscripts :: (String, String, String)
-cvEnodeuserscripts =
- ("node",
- Types.cVErrorCodeToRaw CvENODEUSERSCRIPTS,
- "User scripts not present or not executable")
-
-cvEnodeversion :: (String, String, String)
-cvEnodeversion =
- ("node",
- Types.cVErrorCodeToRaw CvENODEVERSION,
- "Protocol version mismatch or Ganeti version mismatch")
-
-cvAllEcodes :: FrozenSet (String, String, String)
-cvAllEcodes =
- ConstantUtils.mkSet
- [cvEclustercert,
- cvEclustercfg,
- cvEclusterdanglinginst,
- cvEclusterdanglingnodes,
- cvEclusterfilecheck,
- cvEgroupdifferentpvsize,
- cvEinstancebadnode,
- cvEinstancedown,
- cvEinstancefaultydisk,
- cvEinstancelayout,
- cvEinstancemissingcfgparameter,
- cvEinstancemissingdisk,
- cvEinstancepolicy,
- cvEinstancesplitgroups,
- cvEinstanceunsuitablenode,
- cvEinstancewrongnode,
- cvEnodedrbd,
- cvEnodedrbdhelper,
- cvEnodedrbdversion,
- cvEnodefilecheck,
- cvEnodefilestoragepaths,
- cvEnodefilestoragepathunusable,
- cvEnodehooks,
- cvEnodehv,
- cvEnodelvm,
- cvEnoden1,
- cvEnodenet,
- cvEnodeoobpath,
- cvEnodeorphaninstance,
- cvEnodeorphanlv,
- cvEnodeos,
- cvEnoderpc,
- cvEnodesetup,
- cvEnodesharedfilestoragepathunusable,
- cvEnodessh,
- cvEnodetime,
- cvEnodeuserscripts,
- cvEnodeversion]
-
-cvAllEcodesStrings :: FrozenSet String
-cvAllEcodesStrings =
- ConstantUtils.mkSet $ map Types.cVErrorCodeToRaw [minBound..]
-
--- * Node verify constants
-
-nvBridges :: String
-nvBridges = "bridges"
-
-nvDrbdhelper :: String
-nvDrbdhelper = "drbd-helper"
-
-nvDrbdversion :: String
-nvDrbdversion = "drbd-version"
-
-nvDrbdlist :: String
-nvDrbdlist = "drbd-list"
-
-nvExclusivepvs :: String
-nvExclusivepvs = "exclusive-pvs"
-
-nvFilelist :: String
-nvFilelist = "filelist"
-
-nvAcceptedStoragePaths :: String
-nvAcceptedStoragePaths = "allowed-file-storage-paths"
-
-nvFileStoragePath :: String
-nvFileStoragePath = "file-storage-path"
-
-nvSharedFileStoragePath :: String
-nvSharedFileStoragePath = "shared-file-storage-path"
-
-nvHvinfo :: String
-nvHvinfo = "hvinfo"
-
-nvHvparams :: String
-nvHvparams = "hvparms"
-
-nvHypervisor :: String
-nvHypervisor = "hypervisor"
-
-nvInstancelist :: String
-nvInstancelist = "instancelist"
-
-nvLvlist :: String
-nvLvlist = "lvlist"
-
-nvMasterip :: String
-nvMasterip = "master-ip"
-
-nvNodelist :: String
-nvNodelist = "nodelist"
-
-nvNodenettest :: String
-nvNodenettest = "node-net-test"
-
-nvNodesetup :: String
-nvNodesetup = "nodesetup"
-
-nvOobPaths :: String
-nvOobPaths = "oob-paths"
-
-nvOslist :: String
-nvOslist = "oslist"
-
-nvPvlist :: String
-nvPvlist = "pvlist"
-
-nvTime :: String
-nvTime = "time"
-
-nvUserscripts :: String
-nvUserscripts = "user-scripts"
-
-nvVersion :: String
-nvVersion = "version"
-
-nvVglist :: String
-nvVglist = "vglist"
-
-nvVmnodes :: String
-nvVmnodes = "vmnodes"
-
--- * Instance status
-
-inststAdmindown :: String
-inststAdmindown = Types.instanceStatusToRaw StatusDown
-
-inststAdminoffline :: String
-inststAdminoffline = Types.instanceStatusToRaw StatusOffline
-
-inststErrordown :: String
-inststErrordown = Types.instanceStatusToRaw ErrorDown
-
-inststErrorup :: String
-inststErrorup = Types.instanceStatusToRaw ErrorUp
-
-inststNodedown :: String
-inststNodedown = Types.instanceStatusToRaw NodeDown
-
-inststNodeoffline :: String
-inststNodeoffline = Types.instanceStatusToRaw NodeOffline
-
-inststRunning :: String
-inststRunning = Types.instanceStatusToRaw Running
-
-inststUserdown :: String
-inststUserdown = Types.instanceStatusToRaw UserDown
-
-inststWrongnode :: String
-inststWrongnode = Types.instanceStatusToRaw WrongNode
-
-inststAll :: FrozenSet String
-inststAll = ConstantUtils.mkSet $ map Types.instanceStatusToRaw [minBound..]
-
--- * Admin states
-
-adminstDown :: String
-adminstDown = Types.adminStateToRaw AdminDown
-
-adminstOffline :: String
-adminstOffline = Types.adminStateToRaw AdminOffline
-
-adminstUp :: String
-adminstUp = Types.adminStateToRaw AdminUp
-
-adminstAll :: FrozenSet String
-adminstAll = ConstantUtils.mkSet $ map Types.adminStateToRaw [minBound..]
-
--- * Node roles
-
-nrDrained :: String
-nrDrained = Types.nodeRoleToRaw NRDrained
-
-nrMaster :: String
-nrMaster = Types.nodeRoleToRaw NRMaster
-
-nrMcandidate :: String
-nrMcandidate = Types.nodeRoleToRaw NRCandidate
-
-nrOffline :: String
-nrOffline = Types.nodeRoleToRaw NROffline
-
-nrRegular :: String
-nrRegular = Types.nodeRoleToRaw NRRegular
-
-nrAll :: FrozenSet String
-nrAll = ConstantUtils.mkSet $ map Types.nodeRoleToRaw [minBound..]
-
--- * SSL certificate check constants (in days)
-
-sslCertExpirationError :: Int
-sslCertExpirationError = 7
-
-sslCertExpirationWarn :: Int
-sslCertExpirationWarn = 30
-
--- * Allocator framework constants
-
-iallocatorVersion :: Int
-iallocatorVersion = 2
-
-iallocatorDirIn :: String
-iallocatorDirIn = Types.iAllocatorTestDirToRaw IAllocatorDirIn
-
-iallocatorDirOut :: String
-iallocatorDirOut = Types.iAllocatorTestDirToRaw IAllocatorDirOut
-
-validIallocatorDirections :: FrozenSet String
-validIallocatorDirections =
- ConstantUtils.mkSet $ map Types.iAllocatorTestDirToRaw [minBound..]
-
-iallocatorModeAlloc :: String
-iallocatorModeAlloc = Types.iAllocatorModeToRaw IAllocatorAlloc
-
-iallocatorModeChgGroup :: String
-iallocatorModeChgGroup = Types.iAllocatorModeToRaw IAllocatorChangeGroup
-
-iallocatorModeMultiAlloc :: String
-iallocatorModeMultiAlloc = Types.iAllocatorModeToRaw IAllocatorMultiAlloc
-
-iallocatorModeNodeEvac :: String
-iallocatorModeNodeEvac = Types.iAllocatorModeToRaw IAllocatorNodeEvac
-
-iallocatorModeReloc :: String
-iallocatorModeReloc = Types.iAllocatorModeToRaw IAllocatorReloc
-
-validIallocatorModes :: FrozenSet String
-validIallocatorModes =
- ConstantUtils.mkSet $ map Types.iAllocatorModeToRaw [minBound..]
-
-iallocatorSearchPath :: [String]
-iallocatorSearchPath = AutoConf.iallocatorSearchPath
-
-defaultIallocatorShortcut :: String
-defaultIallocatorShortcut = "."
-
--- * Node evacuation
-
-nodeEvacPri :: String
-nodeEvacPri = Types.evacModeToRaw ChangePrimary
-
-nodeEvacSec :: String
-nodeEvacSec = Types.evacModeToRaw ChangeSecondary
-
-nodeEvacAll :: String
-nodeEvacAll = Types.evacModeToRaw ChangeAll
-
-nodeEvacModes :: FrozenSet String
-nodeEvacModes = ConstantUtils.mkSet $ map Types.evacModeToRaw [minBound..]
-
--- * Job queue
-
-jobQueueVersion :: Int
-jobQueueVersion = 1
-
-jobQueueSizeHardLimit :: Int
-jobQueueSizeHardLimit = 5000
-
-jobQueueFilesPerms :: Int
-jobQueueFilesPerms = 0o640
-
--- * Unchanged job return
-
-jobNotchanged :: String
-jobNotchanged = "nochange"
-
--- * Job status
-
-jobStatusQueued :: String
-jobStatusQueued = Types.jobStatusToRaw JOB_STATUS_QUEUED
-
-jobStatusWaiting :: String
-jobStatusWaiting = Types.jobStatusToRaw JOB_STATUS_WAITING
-
-jobStatusCanceling :: String
-jobStatusCanceling = Types.jobStatusToRaw JOB_STATUS_CANCELING
-
-jobStatusRunning :: String
-jobStatusRunning = Types.jobStatusToRaw JOB_STATUS_RUNNING
-
-jobStatusCanceled :: String
-jobStatusCanceled = Types.jobStatusToRaw JOB_STATUS_CANCELED
-
-jobStatusSuccess :: String
-jobStatusSuccess = Types.jobStatusToRaw JOB_STATUS_SUCCESS
-
-jobStatusError :: String
-jobStatusError = Types.jobStatusToRaw JOB_STATUS_ERROR
-
-jobsPending :: FrozenSet String
-jobsPending =
- ConstantUtils.mkSet [jobStatusQueued, jobStatusWaiting, jobStatusCanceling]
-
-jobsFinalized :: FrozenSet String
-jobsFinalized =
- ConstantUtils.mkSet $ map Types.finalizedJobStatusToRaw [minBound..]
-
-jobStatusAll :: FrozenSet String
-jobStatusAll = ConstantUtils.mkSet $ map Types.jobStatusToRaw [minBound..]
-
--- * OpCode status
-
--- ** Not yet finalized opcodes
-
-opStatusCanceling :: String
-opStatusCanceling = "canceling"
-
-opStatusQueued :: String
-opStatusQueued = "queued"
-
-opStatusRunning :: String
-opStatusRunning = "running"
-
-opStatusWaiting :: String
-opStatusWaiting = "waiting"
-
--- ** Finalized opcodes
-
-opStatusCanceled :: String
-opStatusCanceled = "canceled"
-
-opStatusError :: String
-opStatusError = "error"
-
-opStatusSuccess :: String
-opStatusSuccess = "success"
-
-opsFinalized :: FrozenSet String
-opsFinalized =
- ConstantUtils.mkSet [opStatusCanceled, opStatusError, opStatusSuccess]
-
--- * OpCode priority
-
-opPrioLowest :: Int
-opPrioLowest = 19
-
-opPrioHighest :: Int
-opPrioHighest = -20
-
-opPrioLow :: Int
-opPrioLow = Types.opSubmitPriorityToRaw OpPrioLow
-
-opPrioNormal :: Int
-opPrioNormal = Types.opSubmitPriorityToRaw OpPrioNormal
-
-opPrioHigh :: Int
-opPrioHigh = Types.opSubmitPriorityToRaw OpPrioHigh
-
-opPrioSubmitValid :: FrozenSet Int
-opPrioSubmitValid = ConstantUtils.mkSet [opPrioLow, opPrioNormal, opPrioHigh]
-
-opPrioDefault :: Int
-opPrioDefault = opPrioNormal
-
--- * Lock recalculate mode
-
-locksAppend :: String
-locksAppend = "append"
-
-locksReplace :: String
-locksReplace = "replace"
-
--- * Lock timeout
---
--- The lock timeout (sum) before we transition into blocking acquire
--- (this can still be reset by priority change). Computed as max time
--- (10 hours) before we should actually go into blocking acquire,
--- given that we start from the default priority level.
-
-lockAttemptsMaxwait :: Double
-lockAttemptsMaxwait = 15.0
-
-lockAttemptsMinwait :: Double
-lockAttemptsMinwait = 1.0
-
-lockAttemptsTimeout :: Int
-lockAttemptsTimeout = (10 * 3600) `div` (opPrioDefault - opPrioHighest)
-
--- * Execution log types
-
-elogMessage :: String
-elogMessage = Types.eLogTypeToRaw ELogMessage
-
-elogRemoteImport :: String
-elogRemoteImport = Types.eLogTypeToRaw ELogRemoteImport
-
-elogJqueueTest :: String
-elogJqueueTest = Types.eLogTypeToRaw ELogJqueueTest
-
--- * /etc/hosts modification
-
-etcHostsAdd :: String
-etcHostsAdd = "add"
-
-etcHostsRemove :: String
-etcHostsRemove = "remove"
-
--- * Job queue test
-
-jqtMsgprefix :: String
-jqtMsgprefix = "TESTMSG="
-
-jqtExec :: String
-jqtExec = "exec"
-
-jqtExpandnames :: String
-jqtExpandnames = "expandnames"
-
-jqtLogmsg :: String
-jqtLogmsg = "logmsg"
-
-jqtStartmsg :: String
-jqtStartmsg = "startmsg"
-
-jqtAll :: FrozenSet String
-jqtAll = ConstantUtils.mkSet [jqtExec, jqtExpandnames, jqtLogmsg, jqtStartmsg]
-
--- * Query resources
-
-qrCluster :: String
-qrCluster = "cluster"
-
-qrExport :: String
-qrExport = "export"
-
-qrExtstorage :: String
-qrExtstorage = "extstorage"
-
-qrGroup :: String
-qrGroup = "group"
-
-qrInstance :: String
-qrInstance = "instance"
-
-qrJob :: String
-qrJob = "job"
-
-qrLock :: String
-qrLock = "lock"
-
-qrNetwork :: String
-qrNetwork = "network"
-
-qrNode :: String
-qrNode = "node"
-
-qrOs :: String
-qrOs = "os"
-
--- | List of resources which can be queried using 'Ganeti.OpCodes.OpQuery'
-qrViaOp :: FrozenSet String
-qrViaOp =
- ConstantUtils.mkSet [qrCluster,
- qrInstance,
- qrNode,
- qrGroup,
- qrOs,
- qrExport,
- qrNetwork,
- qrExtstorage]
-
--- | List of resources which can be queried using Local UniX Interface
-qrViaLuxi :: FrozenSet String
-qrViaLuxi = ConstantUtils.mkSet [qrLock, qrJob]
-
--- | List of resources which can be queried using RAPI
-qrViaRapi :: FrozenSet String
-qrViaRapi = qrViaLuxi
-
--- * Query field types
-
-qftBool :: String
-qftBool = "bool"
-
-qftNumber :: String
-qftNumber = "number"
-
-qftOther :: String
-qftOther = "other"
-
-qftText :: String
-qftText = "text"
-
-qftTimestamp :: String
-qftTimestamp = "timestamp"
-
-qftUnit :: String
-qftUnit = "unit"
-
-qftUnknown :: String
-qftUnknown = "unknown"
-
-qftAll :: FrozenSet String
-qftAll =
- ConstantUtils.mkSet [qftBool,
- qftNumber,
- qftOther,
- qftText,
- qftTimestamp,
- qftUnit,
- qftUnknown]
-
--- * Query result field status
---
--- Don't change or reuse values as they're used by clients.
---
--- FIXME: link with 'Ganeti.Query.Language.ResultStatus'
-
--- | No data (e.g. RPC error), can be used instead of 'rsOffline'
-rsNodata :: Int
-rsNodata = 2
-
-rsNormal :: Int
-rsNormal = 0
-
--- | Resource marked offline
-rsOffline :: Int
-rsOffline = 4
-
--- | Value unavailable/unsupported for item; if this field is
--- supported but we cannot get the data for the moment, 'rsNodata' or
--- 'rsOffline' should be used
-rsUnavail :: Int
-rsUnavail = 3
-
-rsUnknown :: Int
-rsUnknown = 1
-
-rsAll :: FrozenSet Int
-rsAll =
- ConstantUtils.mkSet [rsNodata,
- rsNormal,
- rsOffline,
- rsUnavail,
- rsUnknown]
-
--- | Special field cases and their verbose/terse formatting
-rssDescription :: Map Int (String, String)
-rssDescription =
- Map.fromList [(rsUnknown, ("(unknown)", "??")),
- (rsNodata, ("(nodata)", "?")),
- (rsOffline, ("(offline)", "*")),
- (rsUnavail, ("(unavail)", "-"))]
-
--- * Max dynamic devices
-
-maxDisks :: Int
-maxDisks = Types.maxDisks
-
-maxNics :: Int
-maxNics = Types.maxNics
-
--- | SSCONF file prefix
-ssconfFileprefix :: String
-ssconfFileprefix = "ssconf_"
-
--- * SSCONF keys
-
-ssClusterName :: String
-ssClusterName = "cluster_name"
-
-ssClusterTags :: String
-ssClusterTags = "cluster_tags"
-
-ssFileStorageDir :: String
-ssFileStorageDir = "file_storage_dir"
-
-ssSharedFileStorageDir :: String
-ssSharedFileStorageDir = "shared_file_storage_dir"
-
-ssMasterCandidates :: String
-ssMasterCandidates = "master_candidates"
-
-ssMasterCandidatesIps :: String
-ssMasterCandidatesIps = "master_candidates_ips"
-
-ssMasterIp :: String
-ssMasterIp = "master_ip"
-
-ssMasterNetdev :: String
-ssMasterNetdev = "master_netdev"
-
-ssMasterNetmask :: String
-ssMasterNetmask = "master_netmask"
-
-ssMasterNode :: String
-ssMasterNode = "master_node"
-
-ssNodeList :: String
-ssNodeList = "node_list"
-
-ssNodePrimaryIps :: String
-ssNodePrimaryIps = "node_primary_ips"
-
-ssNodeSecondaryIps :: String
-ssNodeSecondaryIps = "node_secondary_ips"
-
-ssOfflineNodes :: String
-ssOfflineNodes = "offline_nodes"
-
-ssOnlineNodes :: String
-ssOnlineNodes = "online_nodes"
-
-ssPrimaryIpFamily :: String
-ssPrimaryIpFamily = "primary_ip_family"
-
-ssInstanceList :: String
-ssInstanceList = "instance_list"
-
-ssReleaseVersion :: String
-ssReleaseVersion = "release_version"
-
-ssHypervisorList :: String
-ssHypervisorList = "hypervisor_list"
-
-ssMaintainNodeHealth :: String
-ssMaintainNodeHealth = "maintain_node_health"
-
-ssUidPool :: String
-ssUidPool = "uid_pool"
-
-ssNodegroups :: String
-ssNodegroups = "nodegroups"
-
-ssNetworks :: String
-ssNetworks = "networks"
-
--- | This is not a complete SSCONF key, but the prefix for the
--- hypervisor keys
-ssHvparamsPref :: String
-ssHvparamsPref = "hvparams_"
-
--- * Hvparams keys
-
-ssHvparamsXenChroot :: String
-ssHvparamsXenChroot = ssHvparamsPref ++ htChroot
-
-ssHvparamsXenFake :: String
-ssHvparamsXenFake = ssHvparamsPref ++ htFake
-
-ssHvparamsXenHvm :: String
-ssHvparamsXenHvm = ssHvparamsPref ++ htXenHvm
-
-ssHvparamsXenKvm :: String
-ssHvparamsXenKvm = ssHvparamsPref ++ htKvm
-
-ssHvparamsXenLxc :: String
-ssHvparamsXenLxc = ssHvparamsPref ++ htLxc
-
-ssHvparamsXenPvm :: String
-ssHvparamsXenPvm = ssHvparamsPref ++ htXenPvm
-
-validSsHvparamsKeys :: FrozenSet String
-validSsHvparamsKeys =
- ConstantUtils.mkSet [ssHvparamsXenChroot,
- ssHvparamsXenLxc,
- ssHvparamsXenFake,
- ssHvparamsXenHvm,
- ssHvparamsXenKvm,
- ssHvparamsXenPvm]
-
-ssFilePerms :: Int
-ssFilePerms = 0o444
-
--- | Cluster wide default parameters
-defaultEnabledHypervisor :: String
-defaultEnabledHypervisor = htXenPvm
-
-hvcDefaults :: Map Hypervisor (Map String PyValueEx)
-hvcDefaults =
- Map.fromList
- [ (XenPvm, Map.fromList
- [ (hvUseBootloader, PyValueEx False)
- , (hvBootloaderPath, PyValueEx xenBootloader)
- , (hvBootloaderArgs, PyValueEx "")
- , (hvKernelPath, PyValueEx xenKernel)
- , (hvInitrdPath, PyValueEx "")
- , (hvRootPath, PyValueEx "/dev/xvda1")
- , (hvKernelArgs, PyValueEx "ro")
- , (hvMigrationPort, PyValueEx (8002 :: Int))
- , (hvMigrationMode, PyValueEx htMigrationLive)
- , (hvBlockdevPrefix, PyValueEx "sd")
- , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
- , (hvCpuMask, PyValueEx cpuPinningAll)
- , (hvCpuCap, PyValueEx (0 :: Int))
- , (hvCpuWeight, PyValueEx (256 :: Int))
- , (hvVifScript, PyValueEx "")
- , (hvXenCmd, PyValueEx xenCmdXm)
- , (hvXenCpuid, PyValueEx "")
- , (hvSoundhw, PyValueEx "")
- ])
- , (XenHvm, Map.fromList
- [ (hvBootOrder, PyValueEx "cd")
- , (hvCdromImagePath, PyValueEx "")
- , (hvNicType, PyValueEx htNicRtl8139)
- , (hvDiskType, PyValueEx htDiskParavirtual)
- , (hvVncBindAddress, PyValueEx ip4AddressAny)
- , (hvAcpi, PyValueEx True)
- , (hvPae, PyValueEx True)
- , (hvKernelPath, PyValueEx "/usr/lib/xen/boot/hvmloader")
- , (hvDeviceModel, PyValueEx "/usr/lib/xen/bin/qemu-dm")
- , (hvMigrationPort, PyValueEx (8002 :: Int))
- , (hvMigrationMode, PyValueEx htMigrationNonlive)
- , (hvUseLocaltime, PyValueEx False)
- , (hvBlockdevPrefix, PyValueEx "hd")
- , (hvPassthrough, PyValueEx "")
- , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
- , (hvCpuMask, PyValueEx cpuPinningAll)
- , (hvCpuCap, PyValueEx (0 :: Int))
- , (hvCpuWeight, PyValueEx (256 :: Int))
- , (hvVifType, PyValueEx htHvmVifIoemu)
- , (hvVifScript, PyValueEx "")
- , (hvViridian, PyValueEx False)
- , (hvXenCmd, PyValueEx xenCmdXm)
- , (hvXenCpuid, PyValueEx "")
- , (hvSoundhw, PyValueEx "")
- ])
- , (Kvm, Map.fromList
- [ (hvKvmPath, PyValueEx kvmPath)
- , (hvKernelPath, PyValueEx kvmKernel)
- , (hvInitrdPath, PyValueEx "")
- , (hvKernelArgs, PyValueEx "ro")
- , (hvRootPath, PyValueEx "/dev/vda1")
- , (hvAcpi, PyValueEx True)
- , (hvSerialConsole, PyValueEx True)
- , (hvSerialSpeed, PyValueEx (38400 :: Int))
- , (hvVncBindAddress, PyValueEx "")
- , (hvVncTls, PyValueEx False)
- , (hvVncX509, PyValueEx "")
- , (hvVncX509Verify, PyValueEx False)
- , (hvVncPasswordFile, PyValueEx "")
- , (hvKvmSpiceBind, PyValueEx "")
- , (hvKvmSpiceIpVersion, PyValueEx ifaceNoIpVersionSpecified)
- , (hvKvmSpicePasswordFile, PyValueEx "")
- , (hvKvmSpiceLosslessImgCompr, PyValueEx "")
- , (hvKvmSpiceJpegImgCompr, PyValueEx "")
- , (hvKvmSpiceZlibGlzImgCompr, PyValueEx "")
- , (hvKvmSpiceStreamingVideoDetection, PyValueEx "")
- , (hvKvmSpiceAudioCompr, PyValueEx True)
- , (hvKvmSpiceUseTls, PyValueEx False)
- , (hvKvmSpiceTlsCiphers, PyValueEx opensslCiphers)
- , (hvKvmSpiceUseVdagent, PyValueEx True)
- , (hvKvmFloppyImagePath, PyValueEx "")
- , (hvCdromImagePath, PyValueEx "")
- , (hvKvmCdrom2ImagePath, PyValueEx "")
- , (hvBootOrder, PyValueEx htBoDisk)
- , (hvNicType, PyValueEx htNicParavirtual)
- , (hvDiskType, PyValueEx htDiskParavirtual)
- , (hvKvmCdromDiskType, PyValueEx "")
- , (hvUsbMouse, PyValueEx "")
- , (hvKeymap, PyValueEx "")
- , (hvMigrationPort, PyValueEx (8102 :: Int))
- , (hvMigrationBandwidth, PyValueEx (32 :: Int))
- , (hvMigrationDowntime, PyValueEx (30 :: Int))
- , (hvMigrationMode, PyValueEx htMigrationLive)
- , (hvUseLocaltime, PyValueEx False)
- , (hvDiskCache, PyValueEx htCacheDefault)
- , (hvSecurityModel, PyValueEx htSmNone)
- , (hvSecurityDomain, PyValueEx "")
- , (hvKvmFlag, PyValueEx "")
- , (hvVhostNet, PyValueEx False)
- , (hvKvmUseChroot, PyValueEx False)
- , (hvMemPath, PyValueEx "")
- , (hvRebootBehavior, PyValueEx instanceRebootAllowed)
- , (hvCpuMask, PyValueEx cpuPinningAll)
- , (hvCpuType, PyValueEx "")
- , (hvCpuCores, PyValueEx (0 :: Int))
- , (hvCpuThreads, PyValueEx (0 :: Int))
- , (hvCpuSockets, PyValueEx (0 :: Int))
- , (hvSoundhw, PyValueEx "")
- , (hvUsbDevices, PyValueEx "")
- , (hvVga, PyValueEx "")
- , (hvKvmExtra, PyValueEx "")
- , (hvKvmMachineVersion, PyValueEx "")
- , (hvVnetHdr, PyValueEx True)])
- , (Fake, Map.fromList [(hvMigrationMode, PyValueEx htMigrationLive)])
- , (Chroot, Map.fromList [(hvInitScript, PyValueEx "/ganeti-chroot")])
- , (Lxc, Map.fromList [(hvCpuMask, PyValueEx "")])
- ]
-
-hvcGlobals :: FrozenSet String
-hvcGlobals =
- ConstantUtils.mkSet [hvMigrationBandwidth,
- hvMigrationMode,
- hvMigrationPort,
- hvXenCmd]
-
-becDefaults :: Map String PyValueEx
-becDefaults =
- Map.fromList
- [ (beMinmem, PyValueEx (128 :: Int))
- , (beMaxmem, PyValueEx (128 :: Int))
- , (beVcpus, PyValueEx (1 :: Int))
- , (beAutoBalance, PyValueEx True)
- , (beAlwaysFailover, PyValueEx False)
- , (beSpindleUse, PyValueEx (1 :: Int))
- ]
-
-ndcDefaults :: Map String PyValueEx
-ndcDefaults =
- Map.fromList
- [ (ndOobProgram, PyValueEx "")
- , (ndSpindleCount, PyValueEx (1 :: Int))
- , (ndExclusiveStorage, PyValueEx False)
- , (ndOvs, PyValueEx False)
- , (ndOvsName, PyValueEx defaultOvs)
- , (ndOvsLink, PyValueEx "")
- , (ndSshPort, PyValueEx (22 :: Int))
- ]
-
-ndcGlobals :: FrozenSet String
-ndcGlobals = ConstantUtils.mkSet [ndExclusiveStorage]
-
--- | Default delay target measured in sectors
-defaultDelayTarget :: Int
-defaultDelayTarget = 1
-
-defaultDiskCustom :: String
-defaultDiskCustom = ""
-
-defaultDiskResync :: Bool
-defaultDiskResync = False
-
--- | Default fill target measured in sectors
-defaultFillTarget :: Int
-defaultFillTarget = 0
-
--- | Default mininum rate measured in KiB/s
-defaultMinRate :: Int
-defaultMinRate = 4 * 1024
-
-defaultNetCustom :: String
-defaultNetCustom = ""
-
--- | Default plan ahead measured in sectors
---
--- The default values for the DRBD dynamic resync speed algorithm are
--- taken from the drbsetup 8.3.11 man page, except for c-plan-ahead
--- (that we don't need to set to 0, because we have a separate option
--- to enable it) and for c-max-rate, that we cap to the default value
--- for the static resync rate.
-defaultPlanAhead :: Int
-defaultPlanAhead = 20
-
-defaultRbdPool :: String
-defaultRbdPool = "rbd"
-
-diskLdDefaults :: Map DiskTemplate (Map String PyValueEx)
-diskLdDefaults =
- Map.fromList
- [ (DTBlock, Map.empty)
- , (DTDrbd8, Map.fromList
- [ (ldpBarriers, PyValueEx drbdBarriers)
- , (ldpDefaultMetavg, PyValueEx defaultVg)
- , (ldpDelayTarget, PyValueEx defaultDelayTarget)
- , (ldpDiskCustom, PyValueEx defaultDiskCustom)
- , (ldpDynamicResync, PyValueEx defaultDiskResync)
- , (ldpFillTarget, PyValueEx defaultFillTarget)
- , (ldpMaxRate, PyValueEx classicDrbdSyncSpeed)
- , (ldpMinRate, PyValueEx defaultMinRate)
- , (ldpNetCustom, PyValueEx defaultNetCustom)
- , (ldpNoMetaFlush, PyValueEx drbdNoMetaFlush)
- , (ldpPlanAhead, PyValueEx defaultPlanAhead)
- , (ldpProtocol, PyValueEx drbdDefaultNetProtocol)
- , (ldpResyncRate, PyValueEx classicDrbdSyncSpeed)
- ])
- , (DTExt, Map.empty)
- , (DTFile, Map.empty)
- , (DTPlain, Map.fromList [(ldpStripes, PyValueEx lvmStripecount)])
- , (DTRbd, Map.fromList
- [ (ldpPool, PyValueEx defaultRbdPool)
- , (ldpAccess, PyValueEx diskKernelspace)
- ])
- , (DTSharedFile, Map.empty)
- ]
-
-diskDtDefaults :: Map DiskTemplate (Map String PyValueEx)
-diskDtDefaults =
- Map.fromList
- [ (DTBlock, Map.empty)
- , (DTDiskless, Map.empty)
- , (DTDrbd8, Map.fromList
- [ (drbdDataStripes, PyValueEx lvmStripecount)
- , (drbdDefaultMetavg, PyValueEx defaultVg)
- , (drbdDelayTarget, PyValueEx defaultDelayTarget)
- , (drbdDiskBarriers, PyValueEx drbdBarriers)
- , (drbdDiskCustom, PyValueEx defaultDiskCustom)
- , (drbdDynamicResync, PyValueEx defaultDiskResync)
- , (drbdFillTarget, PyValueEx defaultFillTarget)
- , (drbdMaxRate, PyValueEx classicDrbdSyncSpeed)
- , (drbdMetaBarriers, PyValueEx drbdNoMetaFlush)
- , (drbdMetaStripes, PyValueEx lvmStripecount)
- , (drbdMinRate, PyValueEx defaultMinRate)
- , (drbdNetCustom, PyValueEx defaultNetCustom)
- , (drbdPlanAhead, PyValueEx defaultPlanAhead)
- , (drbdProtocol, PyValueEx drbdDefaultNetProtocol)
- , (drbdResyncRate, PyValueEx classicDrbdSyncSpeed)
- ])
- , (DTExt, Map.empty)
- , (DTFile, Map.empty)
- , (DTPlain, Map.fromList [(lvStripes, PyValueEx lvmStripecount)])
- , (DTRbd, Map.fromList
- [ (rbdPool, PyValueEx defaultRbdPool)
- , (rbdAccess, PyValueEx diskKernelspace)
- ])
- , (DTSharedFile, Map.empty)
- ]
-
-niccDefaults :: Map String PyValueEx
-niccDefaults =
- Map.fromList
- [ (nicMode, PyValueEx nicModeBridged)
- , (nicLink, PyValueEx defaultBridge)
- , (nicVlan, PyValueEx valueHsNothing)
- ]
-
--- | All of the following values are quite arbitrary - there are no
--- "good" defaults, these must be customised per-site
-ispecsMinmaxDefaults :: Map String (Map String Int)
-ispecsMinmaxDefaults =
- Map.fromList
- [(ispecsMin,
- Map.fromList
- [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMinISpec),
- (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMinISpec),
- (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMinISpec),
- (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMinISpec),
- (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMinISpec),
- (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMinISpec)]),
- (ispecsMax,
- Map.fromList
- [(ConstantUtils.ispecMemSize, Types.iSpecMemorySize Types.defMaxISpec),
- (ConstantUtils.ispecCpuCount, Types.iSpecCpuCount Types.defMaxISpec),
- (ConstantUtils.ispecDiskCount, Types.iSpecDiskCount Types.defMaxISpec),
- (ConstantUtils.ispecDiskSize, Types.iSpecDiskSize Types.defMaxISpec),
- (ConstantUtils.ispecNicCount, Types.iSpecNicCount Types.defMaxISpec),
- (ConstantUtils.ispecSpindleUse, Types.iSpecSpindleUse Types.defMaxISpec)])]
-
-ipolicyDefaults :: Map String PyValueEx
-ipolicyDefaults =
- Map.fromList
- [ (ispecsMinmax, PyValueEx [ispecsMinmaxDefaults])
- , (ispecsStd, PyValueEx (Map.fromList
- [ (ispecMemSize, 128)
- , (ispecCpuCount, 1)
- , (ispecDiskCount, 1)
- , (ispecDiskSize, 1024)
- , (ispecNicCount, 1)
- , (ispecSpindleUse, 1)
- ] :: Map String Int))
- , (ipolicyDts, PyValueEx (ConstantUtils.toList diskTemplates))
- , (ipolicyVcpuRatio, PyValueEx (4.0 :: Double))
- , (ipolicySpindleRatio, PyValueEx (32.0 :: Double))
- ]
-
-masterPoolSizeDefault :: Int
-masterPoolSizeDefault = 10
-
--- * Exclusive storage
-
--- | Error margin used to compare physical disks
-partMargin :: Double
-partMargin = 0.01
-
--- | Space reserved when creating instance disks
-partReserved :: Double
-partReserved = 0.02
-
--- * Confd
-
-confdProtocolVersion :: Int
-confdProtocolVersion = ConstantUtils.confdProtocolVersion
-
--- Confd request type
-
-confdReqPing :: Int
-confdReqPing = Types.confdRequestTypeToRaw ReqPing
-
-confdReqNodeRoleByname :: Int
-confdReqNodeRoleByname = Types.confdRequestTypeToRaw ReqNodeRoleByName
-
-confdReqNodePipByInstanceIp :: Int
-confdReqNodePipByInstanceIp = Types.confdRequestTypeToRaw ReqNodePipByInstPip
-
-confdReqClusterMaster :: Int
-confdReqClusterMaster = Types.confdRequestTypeToRaw ReqClusterMaster
-
-confdReqNodePipList :: Int
-confdReqNodePipList = Types.confdRequestTypeToRaw ReqNodePipList
-
-confdReqMcPipList :: Int
-confdReqMcPipList = Types.confdRequestTypeToRaw ReqMcPipList
-
-confdReqInstancesIpsList :: Int
-confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList
-
-confdReqNodeDrbd :: Int
-confdReqNodeDrbd = Types.confdRequestTypeToRaw ReqNodeDrbd
-
-confdReqNodeInstances :: Int
-confdReqNodeInstances = Types.confdRequestTypeToRaw ReqNodeInstances
-
-confdReqs :: FrozenSet Int
-confdReqs =
- ConstantUtils.mkSet .
- map Types.confdRequestTypeToRaw $
- [minBound..] \\ [ReqNodeInstances]
-
--- * Confd request type
-
-confdReqfieldName :: Int
-confdReqfieldName = Types.confdReqFieldToRaw ReqFieldName
-
-confdReqfieldIp :: Int
-confdReqfieldIp = Types.confdReqFieldToRaw ReqFieldIp
-
-confdReqfieldMnodePip :: Int
-confdReqfieldMnodePip = Types.confdReqFieldToRaw ReqFieldMNodePip
-
--- * Confd repl status
-
-confdReplStatusOk :: Int
-confdReplStatusOk = Types.confdReplyStatusToRaw ReplyStatusOk
-
-confdReplStatusError :: Int
-confdReplStatusError = Types.confdReplyStatusToRaw ReplyStatusError
-
-confdReplStatusNotimplemented :: Int
-confdReplStatusNotimplemented = Types.confdReplyStatusToRaw ReplyStatusNotImpl
-
-confdReplStatuses :: FrozenSet Int
-confdReplStatuses =
- ConstantUtils.mkSet $ map Types.confdReplyStatusToRaw [minBound..]
-
--- * Confd node role
-
-confdNodeRoleMaster :: Int
-confdNodeRoleMaster = Types.confdNodeRoleToRaw NodeRoleMaster
-
-confdNodeRoleCandidate :: Int
-confdNodeRoleCandidate = Types.confdNodeRoleToRaw NodeRoleCandidate
-
-confdNodeRoleOffline :: Int
-confdNodeRoleOffline = Types.confdNodeRoleToRaw NodeRoleOffline
-
-confdNodeRoleDrained :: Int
-confdNodeRoleDrained = Types.confdNodeRoleToRaw NodeRoleDrained
-
-confdNodeRoleRegular :: Int
-confdNodeRoleRegular = Types.confdNodeRoleToRaw NodeRoleRegular
-
--- * A few common errors for confd
-
-confdErrorUnknownEntry :: Int
-confdErrorUnknownEntry = Types.confdErrorTypeToRaw ConfdErrorUnknownEntry
-
-confdErrorInternal :: Int
-confdErrorInternal = Types.confdErrorTypeToRaw ConfdErrorInternal
-
-confdErrorArgument :: Int
-confdErrorArgument = Types.confdErrorTypeToRaw ConfdErrorArgument
-
--- * Confd request query fields
-
-confdReqqLink :: String
-confdReqqLink = ConstantUtils.confdReqqLink
-
-confdReqqIp :: String
-confdReqqIp = ConstantUtils.confdReqqIp
-
-confdReqqIplist :: String
-confdReqqIplist = ConstantUtils.confdReqqIplist
-
-confdReqqFields :: String
-confdReqqFields = ConstantUtils.confdReqqFields
-
--- | Each request is "salted" by the current timestamp.
---
--- This constant decides how many seconds of skew to accept.
---
--- TODO: make this a default and allow the value to be more
--- configurable
-confdMaxClockSkew :: Int
-confdMaxClockSkew = 2 * nodeMaxClockSkew
-
--- | 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. Using a
--- prime number to ensure we get less chance of 'same wakeup' with
--- other processes.
-confdConfigReloadTimeout :: Int
-confdConfigReloadTimeout = 17
-
--- | If we receive more than one update in this amount of
--- microseconds, we move to polling every RATELIMIT seconds, rather
--- than relying on inotify, to be able to serve more requests.
-confdConfigReloadRatelimit :: Int
-confdConfigReloadRatelimit = 250000
-
--- | 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.
-confdMagicFourcc :: String
-confdMagicFourcc = "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.
-confdDefaultReqCoverage :: Int
-confdDefaultReqCoverage = 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.
-confdClientExpireTimeout :: Int
-confdClientExpireTimeout = 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
-maxUdpDataSize :: Int
-maxUdpDataSize = 61440
-
--- * User-id pool minimum/maximum acceptable user-ids
-
-uidpoolUidMin :: Int
-uidpoolUidMin = 0
-
--- | Assuming 32 bit user-ids
-uidpoolUidMax :: Integer
-uidpoolUidMax = 2 ^ 32 - 1
-
--- | Name or path of the pgrep command
-pgrep :: String
-pgrep = "pgrep"
-
--- | Name of the node group that gets created at cluster init or
--- upgrade
-initialNodeGroupName :: String
-initialNodeGroupName = "default"
-
--- * Possible values for NodeGroup.alloc_policy
-
-allocPolicyLastResort :: String
-allocPolicyLastResort = Types.allocPolicyToRaw AllocLastResort
-
-allocPolicyPreferred :: String
-allocPolicyPreferred = Types.allocPolicyToRaw AllocPreferred
-
-allocPolicyUnallocable :: String
-allocPolicyUnallocable = Types.allocPolicyToRaw AllocUnallocable
-
-validAllocPolicies :: [String]
-validAllocPolicies = map Types.allocPolicyToRaw [minBound..]
-
--- | Temporary external/shared storage parameters
-blockdevDriverManual :: String
-blockdevDriverManual = Types.blockDriverToRaw BlockDrvManual
-
--- | 'qemu-img' path, required for 'ovfconverter'
-qemuimgPath :: String
-qemuimgPath = AutoConf.qemuimgPath
-
--- | Whether htools was enabled at compilation time
---
--- FIXME: this should be moved next to the other enable constants,
--- such as, 'enableConfd', and renamed to 'enableHtools'.
-htools :: Bool
-htools = AutoConf.htools
-
--- | The hail iallocator
-iallocHail :: String
-iallocHail = "hail"
-
--- * Fake opcodes for functions that have hooks attached to them via
--- backend.RunLocalHooks
-
-fakeOpMasterTurndown :: String
-fakeOpMasterTurndown = "OP_CLUSTER_IP_TURNDOWN"
-
-fakeOpMasterTurnup :: String
-fakeOpMasterTurnup = "OP_CLUSTER_IP_TURNUP"
-
--- * SSH key types
-
-sshkDsa :: String
-sshkDsa = "dsa"
-
-sshkRsa :: String
-sshkRsa = "rsa"
-
-sshkAll :: FrozenSet String
-sshkAll = ConstantUtils.mkSet [sshkRsa, sshkDsa]
-
--- * SSH authorized key types
-
-sshakDss :: String
-sshakDss = "ssh-dss"
-
-sshakRsa :: String
-sshakRsa = "ssh-rsa"
-
-sshakAll :: FrozenSet String
-sshakAll = ConstantUtils.mkSet [sshakDss, sshakRsa]
-
--- * SSH setup
-
-sshsClusterName :: String
-sshsClusterName = "cluster_name"
-
-sshsSshHostKey :: String
-sshsSshHostKey = "ssh_host_key"
-
-sshsSshRootKey :: String
-sshsSshRootKey = "ssh_root_key"
-
-sshsNodeDaemonCertificate :: String
-sshsNodeDaemonCertificate = "node_daemon_certificate"
-
--- * Key files for SSH daemon
-
-sshHostDsaPriv :: String
-sshHostDsaPriv = sshConfigDir ++ "/ssh_host_dsa_key"
-
-sshHostDsaPub :: String
-sshHostDsaPub = sshHostDsaPriv ++ ".pub"
-
-sshHostRsaPriv :: String
-sshHostRsaPriv = sshConfigDir ++ "/ssh_host_rsa_key"
-
-sshHostRsaPub :: String
-sshHostRsaPub = sshHostRsaPriv ++ ".pub"
-
-sshDaemonKeyfiles :: Map String (String, String)
-sshDaemonKeyfiles =
- Map.fromList [ (sshkRsa, (sshHostRsaPriv, sshHostRsaPub))
- , (sshkDsa, (sshHostDsaPriv, sshHostDsaPub))
- ]
-
--- * Node daemon setup
-
-ndsClusterName :: String
-ndsClusterName = "cluster_name"
-
-ndsNodeDaemonCertificate :: String
-ndsNodeDaemonCertificate = "node_daemon_certificate"
-
-ndsSsconf :: String
-ndsSsconf = "ssconf"
-
-ndsStartNodeDaemon :: String
-ndsStartNodeDaemon = "start_node_daemon"
-
--- * The source reasons for the execution of an OpCode
-
-opcodeReasonSrcClient :: String
-opcodeReasonSrcClient = "gnt:client"
-
-opcodeReasonSrcNoded :: String
-opcodeReasonSrcNoded = "gnt:daemon:noded"
-
-opcodeReasonSrcOpcode :: String
-opcodeReasonSrcOpcode = "gnt:opcode"
-
-opcodeReasonSrcRlib2 :: String
-opcodeReasonSrcRlib2 = "gnt:library:rlib2"
-
-opcodeReasonSrcUser :: String
-opcodeReasonSrcUser = "gnt:user"
-
-opcodeReasonSources :: FrozenSet String
-opcodeReasonSources =
- ConstantUtils.mkSet [opcodeReasonSrcClient,
- opcodeReasonSrcNoded,
- opcodeReasonSrcOpcode,
- opcodeReasonSrcRlib2,
- opcodeReasonSrcUser]
-
--- | Path generating random UUID
-randomUuidFile :: String
-randomUuidFile = ConstantUtils.randomUuidFile
-
--- * Auto-repair tag prefixes
-
-autoRepairTagPrefix :: String
-autoRepairTagPrefix = "ganeti:watcher:autorepair:"
-
-autoRepairTagEnabled :: String
-autoRepairTagEnabled = autoRepairTagPrefix
-
-autoRepairTagPending :: String
-autoRepairTagPending = autoRepairTagPrefix ++ "pending:"
-
-autoRepairTagResult :: String
-autoRepairTagResult = autoRepairTagPrefix ++ "result:"
-
-autoRepairTagSuspended :: String
-autoRepairTagSuspended = autoRepairTagPrefix ++ "suspend:"
-
--- * Auto-repair levels
-
-autoRepairFailover :: String
-autoRepairFailover = Types.autoRepairTypeToRaw ArFailover
-
-autoRepairFixStorage :: String
-autoRepairFixStorage = Types.autoRepairTypeToRaw ArFixStorage
-
-autoRepairMigrate :: String
-autoRepairMigrate = Types.autoRepairTypeToRaw ArMigrate
-
-autoRepairReinstall :: String
-autoRepairReinstall = Types.autoRepairTypeToRaw ArReinstall
-
-autoRepairAllTypes :: FrozenSet String
-autoRepairAllTypes =
- ConstantUtils.mkSet [autoRepairFailover,
- autoRepairFixStorage,
- autoRepairMigrate,
- autoRepairReinstall]
-
--- * Auto-repair results
-
-autoRepairEnoperm :: String
-autoRepairEnoperm = Types.autoRepairResultToRaw ArEnoperm
-
-autoRepairFailure :: String
-autoRepairFailure = Types.autoRepairResultToRaw ArFailure
-
-autoRepairSuccess :: String
-autoRepairSuccess = Types.autoRepairResultToRaw ArSuccess
-
-autoRepairAllResults :: FrozenSet String
-autoRepairAllResults =
- ConstantUtils.mkSet [autoRepairEnoperm, autoRepairFailure, autoRepairSuccess]
-
--- | The version identifier for builtin data collectors
-builtinDataCollectorVersion :: String
-builtinDataCollectorVersion = "B"
-
--- | The reason trail opcode parameter name
-opcodeReason :: String
-opcodeReason = "reason"
-
-diskstatsFile :: String
-diskstatsFile = "/proc/diskstats"
-
--- * CPU load collector
-
-statFile :: String
-statFile = "/proc/stat"
-
-cpuavgloadBufferSize :: Int
-cpuavgloadBufferSize = 150
-
-cpuavgloadWindowSize :: Int
-cpuavgloadWindowSize = 600
-
--- * Monitoring daemon
-
--- | Mond's variable for periodical data collection
-mondTimeInterval :: Int
-mondTimeInterval = 5
-
--- | Mond's latest API version
-mondLatestApiVersion :: Int
-mondLatestApiVersion = 1
-
--- * Disk access modes
-
-diskUserspace :: String
-diskUserspace = Types.diskAccessModeToRaw DiskUserspace
-
-diskKernelspace :: String
-diskKernelspace = Types.diskAccessModeToRaw DiskKernelspace
-
-diskValidAccessModes :: FrozenSet String
-diskValidAccessModes =
- ConstantUtils.mkSet $ map Types.diskAccessModeToRaw [minBound..]
-
--- | Timeout for queue draining in upgrades
-upgradeQueueDrainTimeout :: Int
-upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
-
--- | Intervall at which the queue is polled during upgrades
-upgradeQueuePollInterval :: Int
-upgradeQueuePollInterval = 10
-
--- * Hotplug Actions
-
-hotplugActionAdd :: String
-hotplugActionAdd = Types.hotplugActionToRaw HAAdd
-
-hotplugActionRemove :: String
-hotplugActionRemove = Types.hotplugActionToRaw HARemove
-
-hotplugActionModify :: String
-hotplugActionModify = Types.hotplugActionToRaw HAMod
-
-hotplugAllActions :: FrozenSet String
-hotplugAllActions =
- ConstantUtils.mkSet $ map Types.hotplugActionToRaw [minBound..]
-
--- * Hotplug Device Targets
-
-hotplugTargetNic :: String
-hotplugTargetNic = Types.hotplugTargetToRaw HTNic
-
-hotplugTargetDisk :: String
-hotplugTargetDisk = Types.hotplugTargetToRaw HTDisk
-
-hotplugAllTargets :: FrozenSet String
-hotplugAllTargets =
- ConstantUtils.mkSet $ map Types.hotplugTargetToRaw [minBound..]
-
--- | Timeout for disk removal (seconds)
-diskRemoveRetryTimeout :: Int
-diskRemoveRetryTimeout = 30
-
--- | Interval between disk removal retries (seconds)
-diskRemoveRetryInterval :: Int
-diskRemoveRetryInterval = 3
diff --git a/src/Ganeti/Objects.hs b/src/Ganeti/Objects.hs
index 575dd726bb406b2a1113ac5a3616ac7bc027c5fa..f94cb8d8eef0319a92bbd3b32d12b1d71e91af4b 100644
--- a/src/Ganeti/Objects.hs
+++ b/src/Ganeti/Objects.hs
@@ -96,6 +96,7 @@ import Data.Word
import Text.JSON (showJSON, readJSON, JSON, JSValue(..), fromJSString)
import qualified Text.JSON as J
+import qualified AutoConf
import qualified Ganeti.Constants as C
import qualified Ganeti.ConstantUtils as ConstantUtils
import Ganeti.JSON
@@ -245,7 +246,7 @@ instance TimeStampObject Network where
$(buildParam "Nic" "nicp"
[ simpleField "mode" [t| NICMode |]
, simpleField "link" [t| String |]
- , simpleField "vlan" [t| Maybe String |]
+ , simpleField "vlan" [t| String |]
])
$(buildObject "PartialNic" "nic" $
@@ -616,8 +617,8 @@ instance TagsObject NodeGroup where
-- | IP family type
$(declareIADT "IpFamily"
- [ ("IpFamilyV4", 'C.ip4Family)
- , ("IpFamilyV6", 'C.ip6Family)
+ [ ("IpFamilyV4", 'AutoConf.pyAfInet4)
+ , ("IpFamilyV6", 'AutoConf.pyAfInet6)
])
$(makeJSONInstance ''IpFamily)
diff --git a/src/Ganeti/PyConstants.hs.in b/src/Ganeti/PyConstants.hs.in
deleted file mode 100644
index 92082f6c07b90c549c822bf3f40354e75709067c..0000000000000000000000000000000000000000
--- a/src/Ganeti/PyConstants.hs.in
+++ /dev/null
@@ -1,30 +0,0 @@
-{-| Ganeti constants.
-
-These are duplicated from the Python code. Note that this file is
-autogenerated using @autotools/convert_constants@ script with a header
-from @PyConstants.hs.in@.
-
--}
-
-{-
-
-Copyright (C) 2013 Google Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.
-
--}
-
-module Ganeti.PyConstants where
diff --git a/src/Ganeti/Query/Server.hs b/src/Ganeti/Query/Server.hs
index 2a137d9c0ef1c14f5907440927d41fc4c6b5246b..ab9f434184320ae68be035f03a6fbff6c59f3403 100644
--- a/src/Ganeti/Query/Server.hs
+++ b/src/Ganeti/Query/Server.hs
@@ -62,6 +62,7 @@ import Ganeti.Query.Query
import Ganeti.Query.Filter (makeSimpleFilter)
import Ganeti.Types
import Ganeti.Utils (lockFile, exitIfBad)
+import qualified Ganeti.Version as Version
-- | Helper for classic queries.
handleClassicQuery :: ConfigData -- ^ Cluster config
@@ -106,7 +107,7 @@ handleCall _ cdata QueryClusterInfo =
Set.toList . ConstantUtils.unFrozenSet $
C.osApiVersions)
, ("export_version", showJSON C.exportVersion)
- , ("vcs_version", showJSON C.vcsVersion)
+ , ("vcs_version", showJSON Version.version)
, ("architecture", showJSON arch_tuple)
, ("name", showJSON $ clusterClusterName cluster)
, ("master", showJSON (case master of
diff --git a/src/Ganeti/Ssconf.hs b/src/Ganeti/Ssconf.hs
index dd3a52c556de1de393d8ccd4a74bbaac80113f13..ca4f8245cc80ec71a0bcae00b22925001471b04b 100644
--- a/src/Ganeti/Ssconf.hs
+++ b/src/Ganeti/Ssconf.hs
@@ -36,8 +36,6 @@ module Ganeti.Ssconf
, sSFilePrefix
) where
-import Ganeti.THH
-
import Control.Exception
import Control.Monad (liftM)
import Data.Maybe (fromMaybe)
@@ -45,9 +43,11 @@ import qualified Network.Socket as Socket
import System.FilePath ((</>))
import System.IO.Error (isDoesNotExistError)
+import qualified AutoConf
+import Ganeti.BasicTypes
import qualified Ganeti.Constants as C
import qualified Ganeti.Path as Path
-import Ganeti.BasicTypes
+import Ganeti.THH
import Ganeti.Utils
-- | Maximum ssconf file size we support.
@@ -119,14 +119,16 @@ readSSConfFile optpath def key = do
-- | Parses a string containing an IP family
parseIPFamily :: Int -> Result Socket.Family
-parseIPFamily fam | fam == C.ip4Family = Ok Socket.AF_INET
- | fam == C.ip6Family = Ok Socket.AF_INET6
+parseIPFamily fam | fam == AutoConf.pyAfInet4 = Ok Socket.AF_INET
+ | fam == AutoConf.pyAfInet6 = Ok Socket.AF_INET6
| otherwise = Bad $ "Unknown af_family value: " ++ show fam
-- | Read the primary IP family.
getPrimaryIPFamily :: Maybe FilePath -> IO (Result Socket.Family)
getPrimaryIPFamily optpath = do
- result <- readSSConfFile optpath (Just (show C.ip4Family)) SSPrimaryIpFamily
+ result <- readSSConfFile optpath
+ (Just (show AutoConf.pyAfInet4))
+ SSPrimaryIpFamily
return (liftM rStripSpace result >>=
tryRead "Parsing af_family" >>= parseIPFamily)
diff --git a/src/Ganeti/Types.hs b/src/Ganeti/Types.hs
index 1a762b6aefa7a48bc0e0d4572a74098fe335ac55..94b190a959410e73308bdd246d324e720654d577 100644
--- a/src/Ganeti/Types.hs
+++ b/src/Ganeti/Types.hs
@@ -546,7 +546,7 @@ addParamsToStorageUnit _ (SURaw StorageRados key) = SURados key
-- This is part of the 'IAllocator' interface and it is used, for
-- example, in 'Ganeti.HTools.Loader.RqType'. However, it must reside
-- in this module, and not in 'Ganeti.HTools.Types', because it is
--- also used by 'Ganeti.HsConstants'.
+-- also used by 'Ganeti.Constants'.
$(THH.declareLADT ''String "EvacMode"
[ ("ChangePrimary", "primary-only")
, ("ChangeSecondary", "secondary-only")
diff --git a/src/hs2py-constants.hs b/src/hs2py-constants.hs
deleted file mode 100644
index 9eea9970098dd2ad4e15cc750c93de198aba9ff9..0000000000000000000000000000000000000000
--- a/src/hs2py-constants.hs
+++ /dev/null
@@ -1,31 +0,0 @@
-{-| hs2py-constants
-
-This program outputs the all the converted Haskell to Python
-constants.
-
--}
-
-{-
-
-Copyright (C) 2013 Google Inc.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.
-
--}
-import Ganeti.Hs2Py.ListConstants
-
-main :: IO ()
-main = putConstants
diff --git a/src/hs2py.hs b/src/hs2py.hs
index c0c4d7410b75c06190e7220a490259ff2fd9f2c8..0743fdae19c5ff1032be0b1b5fdb48e77fef55d7 100644
--- a/src/hs2py.hs
+++ b/src/hs2py.hs
@@ -24,6 +24,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-}
import Ganeti.Hs2Py.GenOpCodes
+import Ganeti.Hs2Py.ListConstants
+
+import System.Environment (getArgs)
+import System.Exit (exitFailure)
+import System.IO (hPutStrLn, stderr)
main :: IO ()
-main = putStrLn showPyClasses
+main = do
+ args <- getArgs
+ case args of
+ ["--opcodes"] -> putStrLn showPyClasses
+ ["--constants"] -> putConstants
+ _ -> do
+ hPutStrLn stderr "Usage: hs2py --opcodes | --constants"
+ exitFailure
diff --git a/test/py/cmdlib/instance_unittest.py b/test/py/cmdlib/instance_unittest.py
index 062d2f13af51e564f2807d1c1b3a18f77b1d6a46..9d4153b8b3428e8ddb3e66986c6a4b7e2191526f 100644
--- a/test/py/cmdlib/instance_unittest.py
+++ b/test/py/cmdlib/instance_unittest.py
@@ -180,15 +180,6 @@ class TestLUInstanceCreate(CmdlibTestCase):
self.ExecOpCodeExpectOpPrereqError(
op, "If network is given, no mode or link is allowed to be passed")
- def testVlanWithWrongMode(self):
- op = self.CopyOpCode(self.diskless_op,
- nics=[{
- constants.INIC_VLAN: ":1",
- constants.INIC_MODE: constants.NIC_MODE_BRIDGED
- }])
- self.ExecOpCodeExpectOpPrereqError(
- op, "VLAN is given, but network mode is not openvswitch")
-
def testAutoIpNoNameCheck(self):
op = self.CopyOpCode(self.diskless_op,
nics=[{
diff --git a/test/py/cmdlib/node_unittest.py b/test/py/cmdlib/node_unittest.py
index a3a6384107468e66584c18c0ae0fbc914c475346..dc8e124cccd189a2a78446ef20c386d2e01a1db1 100644
--- a/test/py/cmdlib/node_unittest.py
+++ b/test/py/cmdlib/node_unittest.py
@@ -35,6 +35,7 @@ from testsupport import *
import testutils
+
# pylint: disable=W0613
def _TcpPingFailSecondary(cfg, mock_fct, target, port, timeout=None,
live_port_needed=None, source=None):
@@ -42,6 +43,7 @@ def _TcpPingFailSecondary(cfg, mock_fct, target, port, timeout=None,
# and False if not.
return "192.0.2." in target
+
class TestLUNodeAdd(CmdlibTestCase):
def setUp(self):
super(TestLUNodeAdd, self).setUp()
@@ -80,17 +82,6 @@ class TestLUNodeAdd(CmdlibTestCase):
self.rpc.call_node_verify.return_value = \
defaultdict(lambda: node_verify_result, {})
- def testOvsParamsButNotEnabled(self):
- ndparams = {
- constants.ND_OVS: False,
- constants.ND_OVS_NAME: "testswitch",
- }
-
- op = self.CopyOpCode(self.op_add,
- ndparams=ndparams)
-
- self.ExecOpCodeExpectOpPrereqError(op, "OpenvSwitch is not enabled")
-
def testOvsNoLink(self):
ndparams = {
constants.ND_OVS: True,
diff --git a/test/py/ganeti.storage.filestorage_unittest.py b/test/py/ganeti.storage.filestorage_unittest.py
index 1d2fb9ec8c55e588aa665308ad5c9c7a333dafdd..43b8de3993af4cc4af3500019c053d69aa44fb37 100755
--- a/test/py/ganeti.storage.filestorage_unittest.py
+++ b/test/py/ganeti.storage.filestorage_unittest.py
@@ -19,7 +19,7 @@
# 02110-1301, USA.
-"""Script for unittesting the ganeti.storage.file module"""
+"""Script for unittesting the ganeti.storage.filestorage module"""
import os
import shutil
diff --git a/test/py/ganeti.utils_unittest.py b/test/py/ganeti.utils_unittest.py
index 2fc0ee50577fe29beaf86ea38b2a215a79709a96..f57b713ba46552ea991cc523cf6f435d74f19303 100755
--- a/test/py/ganeti.utils_unittest.py
+++ b/test/py/ganeti.utils_unittest.py
@@ -192,8 +192,7 @@ class TestForceDictType(unittest.TestCase):
self.assertEqual(self._fdt({"b": "True"}), {"b": True})
self.assertEqual(self._fdt({"d": "4"}), {"d": 4})
self.assertEqual(self._fdt({"d": "4M"}), {"d": 4})
- self.assertEqual(self._fdt({"e": constants.VALUE_HS_NOTHING, }), {"e":
- constants.VALUE_HS_NOTHING, })
+ self.assertEqual(self._fdt({"e": None, }), {"e": None, })
self.assertEqual(self._fdt({"e": "Hello World", }), {"e": "Hello World", })
self.assertEqual(self._fdt({"e": False, }), {"e": "", })
self.assertEqual(self._fdt({"b": "hello", }, ["hello"]), {"b": "hello"})
diff --git a/tools/move-instance b/tools/move-instance
index 589e06d147f11e2933755cf402304fed8c9cad0a..c628715121754f3622773fcea99daba93b6756b7 100755
--- a/tools/move-instance
+++ b/tools/move-instance
@@ -531,7 +531,7 @@ class MoveDestExecutor(object):
constants.INIC_MAC: mac,
constants.INIC_MODE: mode,
constants.INIC_LINK: link,
- constants.INIC_NAME: vlan,
+ constants.INIC_VLAN: vlan,
constants.INIC_NETWORK: network,
constants.INIC_NAME: nic_name
} for nic_name, _, ip, mac, mode, link, vlan, network, _