Revision c68174b6 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
5190 | 5190 |
if not hasattr(self.op, "iallocator"): |
5191 | 5191 |
self.op.iallocator = None |
5192 | 5192 |
|
5193 |
_DiskReplacer.CheckArguments(self.op.mode, self.op.remote_node,
|
|
5194 |
self.op.iallocator) |
|
5193 |
TLReplaceDisks.CheckArguments(self.op.mode, self.op.remote_node,
|
|
5194 |
self.op.iallocator)
|
|
5195 | 5195 |
|
5196 | 5196 |
def ExpandNames(self): |
5197 | 5197 |
self._ExpandAndLockInstance() |
... | ... | |
5218 | 5218 |
self.needed_locks[locking.LEVEL_NODE] = [] |
5219 | 5219 |
self.recalculate_locks[locking.LEVEL_NODE] = constants.LOCKS_REPLACE |
5220 | 5220 |
|
5221 |
self.replacer = _DiskReplacer(self, self.op.instance_name, self.op.mode, |
|
5222 |
self.op.iallocator, self.op.remote_node, |
|
5223 |
self.op.disks) |
|
5221 |
self.replacer = TLReplaceDisks(self, self.op.instance_name, self.op.mode, |
|
5222 |
self.op.iallocator, self.op.remote_node, |
|
5223 |
self.op.disks) |
|
5224 |
|
|
5225 |
self.tasklets.append(self.replacer) |
|
5224 | 5226 |
|
5225 | 5227 |
def DeclareLocks(self, level): |
5226 | 5228 |
# If we're not already locking all nodes in the set we have to declare the |
... | ... | |
5250 | 5252 |
nl.append(self.op.remote_node) |
5251 | 5253 |
return env, nl, nl |
5252 | 5254 |
|
5253 |
def CheckPrereq(self): |
|
5254 |
"""Check prerequisites. |
|
5255 |
|
|
5256 |
This checks that the instance is in the cluster. |
|
5257 |
|
|
5258 |
""" |
|
5259 |
self.replacer.CheckPrereq() |
|
5260 |
|
|
5261 |
def Exec(self, feedback_fn): |
|
5262 |
"""Execute disk replacement. |
|
5263 |
|
|
5264 |
This dispatches the disk replacement to the appropriate handler. |
|
5265 |
|
|
5266 |
""" |
|
5267 |
self.replacer.Exec() |
|
5268 | 5255 |
|
5269 |
|
|
5270 |
class _DiskReplacer: |
|
5256 |
class TLReplaceDisks(Tasklet): |
|
5271 | 5257 |
"""Replaces disks for an instance. |
5272 | 5258 |
|
5273 | 5259 |
Note: Locking is not within the scope of this class. |
... | ... | |
5300 | 5286 |
|
5301 | 5287 |
@staticmethod |
5302 | 5288 |
def CheckArguments(mode, remote_node, iallocator): |
5289 |
"""Helper function for users of this class. |
|
5290 |
|
|
5291 |
""" |
|
5303 | 5292 |
# check for valid parameter combination |
5304 | 5293 |
cnt = [remote_node, iallocator].count(None) |
5305 | 5294 |
if mode == constants.REPLACE_DISK_CHG: |
... | ... | |
5428 | 5417 |
|
5429 | 5418 |
self.node_secondary_ip = node_2nd_ip |
5430 | 5419 |
|
5431 |
def Exec(self): |
|
5420 |
def Exec(self, feedback_fn):
|
|
5432 | 5421 |
"""Execute disk replacement. |
5433 | 5422 |
|
5434 | 5423 |
This dispatches the disk replacement to the appropriate handler. |
Also available in: Unified diff