Commit a4417db4 authored by Thomas Thrainer's avatar Thomas Thrainer

Merge branch 'stable-2.10' into master

Merge branch 'stable-2.10' into master

* stable-2.10
  Don't allow optional node parameters
  Move OVS node parameters to the right place
  Make NIC VLAN queryable
  Pass VLAN parameter correctly in moves
  Use constant instead of raw string
  Merge 'hs2py-constants' into 'hs2py'
  Add flag '--opcodes' to 'hs2py'
  Sort design docs alphabetically
  Missing design docs from distribution
  When loading configuration fails, include the reason
  Fixing rapi documentation wrt to storage types
  Move Haskell constants to proper module
  Tear down Py2Hs constant infrastructure
  Hs2Py constants: additional module jstore
  Hs2Py constants: additional module errors
  Hs2Py constants: additional module qlang
  Hs2Py constants: additional module luxi
  Remove module 'ganeti.constants' from 'convert-constants'
  Fix reference to vcs version in query server
  Eliminate unused constants
  Use configure constants instead of generated
  Hs2Py constants: add 'UUID_REGEX'
  Add 'AF_INET*' constants to Haskell's 'AutoConf'
  Python autotool to print socket constants

* stable-2.9
  Bump revision for 2.9.1
  Update NEWS and schedule release for 2.9.1
  Fix retrieval of xen command in class method
  Fix docstring for ganeti.storage.filestorage_unittest.py
  Undo revision bump
  Postpone release of 2.9.1
  Revision bump for 2.9.1
  Update NEWS for 2.9.1 release
  Readd nodes as online
  When verifying BRBD version, ignore missing values

* stable-2.8
  Version bump for 2.8.2
  Update NEWS file for 2.8.2 release
  DRBD: ensure peers are UpToDate for dual-primary

Conflicts:
	Makefile.am: Add design docs from both sides (sorted); Remove
                 rules for hs2py-constants
	lib/hypervisor/hv_xen.py: Merge parameter list of
                              GetInstanceConsole
	lib/luxi.py: Use generated constant for REQ_PICKUP_JOB
	src/Ganeti/ConfigReader.hs: trivial
	src/Ganeti/HsConstants.hs: Manually add UserDown and ndSshPort
                               related constants to Constants.hs
	src/Ganeti/Query/Server.hs: trivial
Signed-off-by: default avatarThomas Thrainer <thomasth@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parents 0808e9d5 adef95a2
......@@ -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
......@@ -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)
......
......@@ -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
-------------
......
This diff is collapsed.
#!/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()
......@@ -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:
......
......@@ -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
......
......@@ -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])
......
......@@ -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,
......
......@@ -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()):
......
......@@ -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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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
......@@ -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