diff --git a/lib/mcpu.py b/lib/mcpu.py index 89046c60cdf64e575cce43b592969530b790e0ea..4f6fd1b8f149a296e73d5d5884b0975c17fbc2ff 100644 --- a/lib/mcpu.py +++ b/lib/mcpu.py @@ -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): diff --git a/lib/rpc.py b/lib/rpc.py index 60a30ab0e45f2541a10f82f10796f65f019dd040..b717ec01568c2268a95a809d6989a12be08539ee 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -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): diff --git a/lib/server/masterd.py b/lib/server/masterd.py index 27bf561c4bb681cd287110594c0db1a025bfc692..40c5abfb27cc3f5fbcfa970554887e87dcbb288a 100644 --- a/lib/server/masterd.py +++ b/lib/server/masterd.py @@ -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