Commit 87b3cb26 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Keep only one global RPC runner in Ganeti context

Instead of having one RPC runner per mcpu processor this will keep only
one instance as part of the masterd-wide Ganeti context. Upcoming
patches will change the RPC runner to report pending requests to the
lock manager.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent daa4dcc1
......@@ -35,7 +35,6 @@ import time
from ganeti import opcodes
from ganeti import constants
from ganeti import errors
from ganeti import rpc
from ganeti import cmdlib
from ganeti import locking
from ganeti import utils
......@@ -188,7 +187,7 @@ class Processor(object):
self.context = context
self._ec_id = ec_id
self._cbs = None
self.rpc = rpc.RpcRunner(context.cfg)
self.rpc = context.rpc
self.hmclass = HooksMaster
def _AcquireLocks(self, level, names, shared, timeout, priority):
......@@ -414,17 +414,17 @@ def _EncodeImportExportIO(ieio, ieioargs):
class RpcRunner(object):
"""RPC runner class"""
"""RPC runner class.
def __init__(self, cfg):
"""Initialized the rpc runner.
def __init__(self, context):
"""Initialized the RPC runner.
@type cfg: C{config.ConfigWriter}
@param cfg: the configuration object that will be used to get data
about the cluster
@type context: C{masterd.GanetiContext}
@param context: Ganeti context
self._cfg = cfg
self._cfg = context.cfg
self.port = netutils.GetDaemonPort(constants.NODED)
def _InstDict(self, instance, hvp=None, bep=None, osp=None):
......@@ -399,6 +399,9 @@ class GanetiContext(object):
# Job queue
self.jobqueue = jqueue.JobQueue(self)
# RPC runner
self.rpc = rpc.RpcRunner(self)
# setting this also locks the class against attribute modifications
self.__class__._instance = 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