Commit b2acdbdc authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Show RPC calls from config in lock monitor

With this patch all RPC calls at runtime of masterd will show up in the
lock monitor. There is a chicken-and-egg issue with initializing the
configuration with a context since the lock manager, containing the
monitor, requires the configuration. This is worked around by setting
the config's context only once the lock monitor is available.

rpc/  Jq9/Job32/N_SET_PARAMjobqueue_update  Jq2/Job27/C_VERIFY_CONFIG
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarGuido Trotter <>
parent 3ccd3243
......@@ -164,8 +164,21 @@ class ConfigWriter:
self._my_hostname = netutils.Hostname.GetSysName()
self._last_cluster_serial = -1
self._cfg_id = None
self._context = None
def _GetRpc(self, address_list):
"""Returns RPC runner for configuration.
return rpc.ConfigRunner(self._context, address_list)
def SetContext(self, context):
"""Sets Ganeti context.
self._context = context
# this method needs to be static, so that we can call it on the class
def IsCluster():
......@@ -1749,7 +1762,7 @@ class ConfigWriter:
# TODO: Use dedicated resolver talking to config writer for name resolution
result = \
rpc.ConfigRunner(addr_list).call_upload_file(node_list, self._cfg_file)
self._GetRpc(addr_list).call_upload_file(node_list, self._cfg_file)
for to_node, to_result in result.items():
msg = to_result.fail_msg
if msg:
......@@ -1808,7 +1821,7 @@ class ConfigWriter:
# Write ssconf files on all nodes (including locally)
if self._last_cluster_serial < self._config_data.cluster.serial_no:
if not self._offline:
result = rpc.ConfigRunner(None).call_write_ssconf_files(
result = self._GetRpc(None).call_write_ssconf_files(
......@@ -723,15 +723,21 @@ class ConfigRunner(_RpcClientBase, _generated_rpc.RpcClientConfig):
"""RPC wrappers for L{config}.
def __init__(self, address_list):
def __init__(self, context, address_list):
"""Initializes this class.
if context:
lock_monitor_cb = context.glm.AddToLockMonitor
lock_monitor_cb = None
if address_list is None:
resolver = _SsconfResolver
# Caller provided an address list
resolver = _StaticResolver(address_list)
_RpcClientBase.__init__(self, resolver, _ENCODERS.get)
_RpcClientBase.__init__(self, resolver, _ENCODERS.get,
......@@ -401,6 +401,8 @@ class GanetiContext(object):
# Job queue
self.jobqueue = jqueue.JobQueue(self)
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