Revision 36c381d7
b/lib/mcpu.py | ||
---|---|---|
101 | 101 |
self._feedback_fn = feedback |
102 | 102 |
self.exclusive_BGL = False |
103 | 103 |
|
104 |
def _ExecLU(self, lu): |
|
105 |
"""Logical Unit execution sequence. |
|
106 |
|
|
107 |
""" |
|
108 |
write_count = self.context.cfg.write_count |
|
109 |
lu.CheckPrereq() |
|
110 |
hm = HooksMaster(rpc.call_hooks_runner, self, lu) |
|
111 |
h_results = hm.RunPhase(constants.HOOKS_PHASE_PRE) |
|
112 |
lu.HooksCallBack(constants.HOOKS_PHASE_PRE, h_results, |
|
113 |
self._feedback_fn, None) |
|
114 |
try: |
|
115 |
result = lu.Exec(self._feedback_fn) |
|
116 |
h_results = hm.RunPhase(constants.HOOKS_PHASE_POST) |
|
117 |
result = lu.HooksCallBack(constants.HOOKS_PHASE_POST, h_results, |
|
118 |
self._feedback_fn, result) |
|
119 |
finally: |
|
120 |
# FIXME: This needs locks if not lu_class.REQ_BGL |
|
121 |
if write_count != self.context.cfg.write_count: |
|
122 |
hm.RunConfigUpdate() |
|
123 |
|
|
124 |
return result |
|
125 |
|
|
104 | 126 |
def ExecOpCode(self, op): |
105 | 127 |
"""Execute an opcode. |
106 | 128 |
|
... | ... | |
121 | 143 |
else: |
122 | 144 |
sstore = ssconf.SimpleStore() |
123 | 145 |
|
124 |
write_count = self.context.cfg.write_count |
|
125 |
|
|
126 | 146 |
# Acquire the Big Ganeti Lock exclusively if this LU requires it, and in a |
127 | 147 |
# shared fashion otherwise (to prevent concurrent run with an exclusive LU. |
128 | 148 |
self.context.glm.acquire(locking.LEVEL_CLUSTER, [locking.BGL], |
... | ... | |
130 | 150 |
try: |
131 | 151 |
self.exclusive_BGL = lu_class.REQ_BGL |
132 | 152 |
lu = lu_class(self, op, self.context, sstore) |
133 |
lu.CheckPrereq() |
|
134 |
hm = HooksMaster(rpc.call_hooks_runner, self, lu) |
|
135 |
h_results = hm.RunPhase(constants.HOOKS_PHASE_PRE) |
|
136 |
lu.HooksCallBack(constants.HOOKS_PHASE_PRE, h_results, |
|
137 |
self._feedback_fn, None) |
|
138 |
try: |
|
139 |
result = lu.Exec(self._feedback_fn) |
|
140 |
h_results = hm.RunPhase(constants.HOOKS_PHASE_POST) |
|
141 |
result = lu.HooksCallBack(constants.HOOKS_PHASE_POST, h_results, |
|
142 |
self._feedback_fn, result) |
|
143 |
finally: |
|
144 |
# FIXME: This needs locks if not lu_class.REQ_BGL |
|
145 |
if write_count != self.context.cfg.write_count: |
|
146 |
hm.RunConfigUpdate() |
|
153 |
result = self._ExecLU(lu) |
|
147 | 154 |
finally: |
148 | 155 |
self.context.glm.release(locking.LEVEL_CLUSTER) |
149 | 156 |
self.exclusive_BGL = False |
Also available in: Unified diff