diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd index 885db2fcbcf3dc43686a3dab90367382f07e0b54..e0420134700e640859bee6d7987e2747cfdb266e 100755 --- a/daemons/ganeti-masterd +++ b/daemons/ganeti-masterd @@ -289,7 +289,7 @@ def PoolWorker(worker_id, incoming_queue, context): print "worker %s processing job %s" % (worker_id, item.data.job_id) #utils.Lock('cmd') try: - proc = mcpu.Processor(feedback=lambda x: None) + proc = mcpu.Processor(context, feedback=lambda x: None) try: JobRunner(proc, item, context) except errors.GenericError, err: diff --git a/lib/mcpu.py b/lib/mcpu.py index fff38e7fb275b634d445dd8f27760b07e025aedd..4e9659d0b31e398e87a8e85f68d2b0cc7b657387 100644 --- a/lib/mcpu.py +++ b/lib/mcpu.py @@ -89,14 +89,14 @@ class Processor(object): opcodes.OpTestAllocator: cmdlib.LUTestAllocator, } - def __init__(self, feedback=None): + def __init__(self, context, feedback=None): """Constructor for Processor Args: - feedback_fn: the feedback function (taking one string) to be run when interesting events are happening """ - self.cfg = None + self.context = context self._feedback_fn = feedback def ExecOpCode(self, op): @@ -119,13 +119,8 @@ class Processor(object): else: sstore = ssconf.SimpleStore() - if self.cfg is None: - self.cfg = config.ConfigWriter() - if self.cfg is not None: - write_count = self.cfg.write_count - else: - write_count = 0 - lu = lu_class(self, op, self.cfg, sstore) + write_count = self.context.cfg.write_count + lu = lu_class(self, op, self.context.cfg, sstore) lu.CheckPrereq() hm = HooksMaster(rpc.call_hooks_runner, self, lu) h_results = hm.RunPhase(constants.HOOKS_PHASE_PRE) @@ -168,10 +163,8 @@ class Processor(object): else: sstore = ssconf.SimpleStore() - if self.cfg is None: - self.cfg = config.ConfigWriter() #do_hooks = lu_class.HPATH is not None - lu = lu_class(self, op, self.cfg, sstore) + lu = lu_class(self, op, self.context.cfg, sstore) lu.CheckPrereq() #if do_hooks: # hm = HooksMaster(rpc.call_hooks_runner, self, lu)