Revision 1c901d13

b/daemons/ganeti-masterd
289 289
    print "worker %s processing job %s" % (worker_id, item.data.job_id)
290 290
    #utils.Lock('cmd')
291 291
    try:
292
      proc = mcpu.Processor(feedback=lambda x: None)
292
      proc = mcpu.Processor(context, feedback=lambda x: None)
293 293
      try:
294 294
        JobRunner(proc, item, context)
295 295
      except errors.GenericError, err:
b/lib/mcpu.py
89 89
    opcodes.OpTestAllocator: cmdlib.LUTestAllocator,
90 90
    }
91 91

  
92
  def __init__(self, feedback=None):
92
  def __init__(self, context, feedback=None):
93 93
    """Constructor for Processor
94 94

  
95 95
    Args:
96 96
     - feedback_fn: the feedback function (taking one string) to be run when
97 97
                    interesting events are happening
98 98
    """
99
    self.cfg = None
99
    self.context = context
100 100
    self._feedback_fn = feedback
101 101

  
102 102
  def ExecOpCode(self, op):
......
119 119
    else:
120 120
      sstore = ssconf.SimpleStore()
121 121

  
122
    if self.cfg is None:
123
      self.cfg = config.ConfigWriter()
124
    if self.cfg is not None:
125
      write_count = self.cfg.write_count
126
    else:
127
      write_count = 0
128
    lu = lu_class(self, op, self.cfg, sstore)
122
    write_count = self.context.cfg.write_count
123
    lu = lu_class(self, op, self.context.cfg, sstore)
129 124
    lu.CheckPrereq()
130 125
    hm = HooksMaster(rpc.call_hooks_runner, self, lu)
131 126
    h_results = hm.RunPhase(constants.HOOKS_PHASE_PRE)
......
168 163
    else:
169 164
      sstore = ssconf.SimpleStore()
170 165

  
171
    if self.cfg is None:
172
      self.cfg = config.ConfigWriter()
173 166
    #do_hooks = lu_class.HPATH is not None
174
    lu = lu_class(self, op, self.cfg, sstore)
167
    lu = lu_class(self, op, self.context.cfg, sstore)
175 168
    lu.CheckPrereq()
176 169
    #if do_hooks:
177 170
    #  hm = HooksMaster(rpc.call_hooks_runner, self, lu)

Also available in: Unified diff