Commit dc3d8108 authored by Petr Pudlak's avatar Petr Pudlak

Merge branch 'stable-2.11' into stable-2.12

* stable-2.10
  ganeti.daemon: fix daemon mode with GnuTLS >= 3.3
  Fix DRBD version check for non VM capable nodes
  Fix invalid message from gnt-os
  Renaming NV_VMNODES to NV_NONVMNODES
  Node names in NV_VMNODES

* stable-2.9
  Ganeti.Daemon: always install SIGHUP handler

Conflicts:
	lib/config.py: Replace 2.11 annotations with 2.12 annotations
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parents c57cdced 59acce38
......@@ -995,7 +995,7 @@ def VerifyNode(what, cluster_name, all_hvparams, node_groups, groups_cfg):
result = {}
my_name = netutils.Hostname.GetSysName()
port = netutils.GetDaemonPort(constants.NODED)
vm_capable = my_name not in what.get(constants.NV_VMNODES, [])
vm_capable = my_name not in what.get(constants.NV_NONVMNODES, [])
_VerifyHypervisors(what, vm_capable, result, all_hvparams)
_VerifyHvparams(what, vm_capable, result)
......
......@@ -90,7 +90,7 @@ def ShowOSInfo(opts, args):
names=[])
result = SubmitOpCode(op, opts=opts)
if not result:
if result is None:
ToStderr("Can't get the OS list")
return 1
......@@ -175,7 +175,7 @@ def DiagnoseOS(opts, args):
"blacklisted"], names=[])
result = SubmitOpCode(op, opts=opts)
if not result:
if result is None:
ToStderr("Can't get the OS list")
return 1
......
......@@ -2261,8 +2261,9 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
for node_uuid, ndata in node_verify_infos.items():
nresult = ndata.payload
if nresult:
version = nresult.get(constants.NV_DRBDVERSION, "Missing DRBD version")
node_versions[node_uuid] = version
version = nresult.get(constants.NV_DRBDVERSION, None)
if version:
node_versions[node_uuid] = version
if len(set(node_versions.values())) > 1:
for node_uuid, version in sorted(node_versions.items()):
......@@ -3362,7 +3363,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
constants.NV_TIME: None,
constants.NV_MASTERIP: (self.cfg.GetMasterNodeName(), master_ip),
constants.NV_OSLIST: None,
constants.NV_VMNODES: self.cfg.GetNonVmCapableNodeList(),
constants.NV_NONVMNODES: self.cfg.GetNonVmCapableNodeNameList(),
constants.NV_USERSCRIPTS: user_scripts,
constants.NV_CLIENT_CERT: None,
}
......
......@@ -2405,13 +2405,22 @@ class ConfigWriter(object):
@_ConfigSync(shared=1)
def GetNonVmCapableNodeList(self):
"""Return the list of nodes which are not vm capable.
"""Return the list of nodes' uuids which are not vm capable.
"""
all_nodes = [self._UnlockedGetNodeInfo(node)
for node in self._UnlockedGetNodeList()]
return [node.uuid for node in all_nodes if not node.vm_capable]
@_ConfigSync(shared=1)
def GetNonVmCapableNodeNameList(self):
"""Return the list of nodes' names which are not vm capable.
"""
all_nodes = [self._UnlockedGetNodeInfo(node)
for node in self._UnlockedGetNodeList()]
return [node.name for node in all_nodes if not node.vm_capable]
@_ConfigSync(shared=1)
def GetMultiNodeInfo(self, node_uuids):
"""Get the configuration of multiple nodes.
......
......@@ -819,7 +819,23 @@ def GenericMain(daemon_name, optionparser,
sys.stderr.write(constants.DEBUG_MODE_CONFIDENTIALITY_WARNING % daemon_name)
if options.fork:
utils.CloseFDs()
# Newer GnuTLS versions (>= 3.3.0) use a library constructor for
# initialization and open /dev/urandom on library load time, way before we
# fork(). Closing /dev/urandom causes subsequent ganeti.http.client
# requests to fail and the process to receive a SIGABRT. As we cannot
# reliably detect GnuTLS's socket, we work our way around this by keeping
# all fds referring to /dev/urandom open.
noclose_fds = []
for fd in os.listdir("/proc/self/fd"):
try:
if os.readlink(os.path.join("/proc/self/fd", fd)) == "/dev/urandom":
noclose_fds.append(int(fd))
except EnvironmentError:
# The fd might have disappeared (although it shouldn't as we're running
# single-threaded).
continue
utils.CloseFDs(noclose_fds=noclose_fds)
(wpipe, stdio_reopen_fn) = utils.Daemonize(logfile=log_filename)
else:
(wpipe, stdio_reopen_fn) = (None, None)
......
......@@ -3160,8 +3160,8 @@ nvVersion = "version"
nvVglist :: String
nvVglist = "vglist"
nvVmnodes :: String
nvVmnodes = "vmnodes"
nvNonvmnodes :: String
nvNonvmnodes = "nonvmnodes"
-- * Instance status
......
......@@ -405,7 +405,6 @@ daemonize logfile action = do
setupDaemonEnv "/" (unionFileModes groupModes otherModes)
setupDaemonFDs (Just logfile) `Control.Exception.catch`
handlePrepErr False wpipe'
_ <- installHandler lostConnection (Catch (handleSigHup logfile)) Nothing
-- second fork, launches the actual child code; standard
-- double-fork technique
_ <- forkProcess (action wpipe')
......@@ -461,6 +460,7 @@ genericMain daemon options check_fn prep_fn exec_fn = do
let processFn = if optDaemonize opts
then daemonize log_file
else \action -> action Nothing
_ <- installHandler lostConnection (Catch (handleSigHup log_file)) Nothing
processFn $ innerMain daemon opts syslog check_result' prep_fn exec_fn
-- | Full prepare function.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment