Revision 77b657a3
b/lib/cmdlib.py | ||
---|---|---|
69 | 69 |
REQ_WSSTORE = False |
70 | 70 |
REQ_BGL = True |
71 | 71 |
|
72 |
def __init__(self, processor, op, cfg, sstore):
|
|
72 |
def __init__(self, processor, op, context, sstore):
|
|
73 | 73 |
"""Constructor for LogicalUnit. |
74 | 74 |
|
75 | 75 |
This needs to be overriden in derived classes in order to check op |
... | ... | |
78 | 78 |
""" |
79 | 79 |
self.proc = processor |
80 | 80 |
self.op = op |
81 |
self.cfg = cfg |
|
81 |
self.cfg = context.cfg
|
|
82 | 82 |
self.sstore = sstore |
83 |
self.context = context |
|
83 | 84 |
self.__ssh = None |
84 | 85 |
|
85 | 86 |
for attr_name in self._OP_REQP: |
b/lib/mcpu.py | ||
---|---|---|
129 | 129 |
shared=not lu_class.REQ_BGL) |
130 | 130 |
try: |
131 | 131 |
self.exclusive_BGL = lu_class.REQ_BGL |
132 |
lu = lu_class(self, op, self.context.cfg, sstore)
|
|
132 |
lu = lu_class(self, op, self.context, sstore) |
|
133 | 133 |
lu.CheckPrereq() |
134 | 134 |
hm = HooksMaster(rpc.call_hooks_runner, self, lu) |
135 | 135 |
h_results = hm.RunPhase(constants.HOOKS_PHASE_PRE) |
... | ... | |
177 | 177 |
sstore = ssconf.SimpleStore() |
178 | 178 |
|
179 | 179 |
#do_hooks = lu_class.HPATH is not None |
180 |
lu = lu_class(self, op, self.context.cfg, sstore)
|
|
180 |
lu = lu_class(self, op, self.context, sstore) |
|
181 | 181 |
lu.CheckPrereq() |
182 | 182 |
#if do_hooks: |
183 | 183 |
# hm = HooksMaster(rpc.call_hooks_runner, self, lu) |
b/test/ganeti.hooks_unittest.py | ||
---|---|---|
36 | 36 |
from ganeti import cmdlib |
37 | 37 |
from ganeti.constants import HKR_SUCCESS, HKR_FAIL, HKR_SKIP |
38 | 38 |
|
39 |
from mocks import FakeConfig, FakeSStore, FakeProc |
|
39 |
from mocks import FakeConfig, FakeSStore, FakeProc, FakeContext
|
|
40 | 40 |
|
41 | 41 |
class FakeLU(cmdlib.LogicalUnit): |
42 | 42 |
HPATH = "test" |
... | ... | |
226 | 226 |
for node_name in node_list]) |
227 | 227 |
|
228 | 228 |
def setUp(self): |
229 |
self.cfg = FakeConfig() |
|
230 | 229 |
self.sstore = FakeSStore() |
231 | 230 |
self.op = opcodes.OpCode() |
232 |
self.lu = FakeLU(None, self.op, self.cfg, self.sstore) |
|
231 |
self.context = FakeContext() |
|
232 |
self.lu = FakeLU(None, self.op, self.context, self.sstore) |
|
233 | 233 |
|
234 | 234 |
def testTotalFalse(self): |
235 | 235 |
"""Test complete rpc failure""" |
Also available in: Unified diff