Revision 9a395a76 lib/mcpu.py
b/lib/mcpu.py | ||
---|---|---|
114 | 114 |
self.sstore = ssconf.SimpleStore() |
115 | 115 |
lu = lu_class(self, op, self.cfg, self.sstore) |
116 | 116 |
lu.CheckPrereq() |
117 |
do_hooks = lu_class.HPATH is not None |
|
118 |
if do_hooks: |
|
119 |
hm = HooksMaster(rpc.call_hooks_runner, lu) |
|
120 |
hm.RunPhase(constants.HOOKS_PHASE_PRE) |
|
117 |
hm = HooksMaster(rpc.call_hooks_runner, lu) |
|
118 |
hm.RunPhase(constants.HOOKS_PHASE_PRE) |
|
121 | 119 |
result = lu.Exec(feedback_fn) |
122 |
if do_hooks: |
|
123 |
hm.RunPhase(constants.HOOKS_PHASE_POST) |
|
120 |
hm.RunPhase(constants.HOOKS_PHASE_POST) |
|
124 | 121 |
return result |
125 | 122 |
|
126 | 123 |
def ChainOpCode(self, op, feedback_fn): |
... | ... | |
193 | 190 |
"GANETI_OBJECT_TYPE": self.lu.HTYPE, |
194 | 191 |
} |
195 | 192 |
|
196 |
lu_env, lu_nodes_pre, lu_nodes_post = self.lu.BuildHooksEnv() |
|
197 |
if lu_env: |
|
198 |
for key in lu_env: |
|
199 |
env["GANETI_" + key] = lu_env[key] |
|
193 |
if self.lu.HPATH is not None: |
|
194 |
lu_env, lu_nodes_pre, lu_nodes_post = self.lu.BuildHooksEnv() |
|
195 |
if lu_env: |
|
196 |
for key in lu_env: |
|
197 |
env["GANETI_" + key] = lu_env[key] |
|
198 |
else: |
|
199 |
lu_nodes_pre = lu_nodes_post = [] |
|
200 | 200 |
|
201 | 201 |
if self.lu.sstore is not None: |
202 | 202 |
env["GANETI_CLUSTER"] = self.lu.sstore.GetClusterName() |
... | ... | |
215 | 215 |
|
216 | 216 |
""" |
217 | 217 |
if not self.node_list[phase]: |
218 |
# empty node list, we should not attempt to run this |
|
219 |
# as most probably we're in the cluster init phase and the rpc client
|
|
220 |
# part can't even attempt to run
|
|
218 |
# empty node list, we should not attempt to run this as either
|
|
219 |
# we're in the cluster init phase and the rpc client part can't
|
|
220 |
# even attempt to run, or this LU doesn't do hooks at all
|
|
221 | 221 |
return |
222 | 222 |
self.env["GANETI_HOOKS_PHASE"] = str(phase) |
223 | 223 |
results = self.callfn(self.node_list[phase], self.hpath, phase, self.env) |
Also available in: Unified diff