Revision 76aef8fc lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
6441 | 6441 |
self._RemoveOldStorage(self.target_node, iv_names) |
6442 | 6442 |
|
6443 | 6443 |
|
6444 |
class LURepairNodeStorage(NoHooksLU): |
|
6445 |
"""Repairs the volume group on a node. |
|
6446 |
|
|
6447 |
""" |
|
6448 |
_OP_REQP = ["node_name"] |
|
6449 |
REQ_BGL = False |
|
6450 |
|
|
6451 |
def CheckArguments(self): |
|
6452 |
node_name = self.cfg.ExpandNodeName(self.op.node_name) |
|
6453 |
if node_name is None: |
|
6454 |
raise errors.OpPrereqError("Invalid node name '%s'" % self.op.node_name) |
|
6455 |
|
|
6456 |
self.op.node_name = node_name |
|
6457 |
|
|
6458 |
def ExpandNames(self): |
|
6459 |
self.needed_locks = { |
|
6460 |
locking.LEVEL_NODE: [self.op.node_name], |
|
6461 |
} |
|
6462 |
|
|
6463 |
def _CheckFaultyDisks(self, instance, node_name): |
|
6464 |
if _FindFaultyInstanceDisks(self.cfg, self.rpc, instance, |
|
6465 |
node_name, True): |
|
6466 |
raise errors.OpPrereqError("Instance '%s' has faulty disks on" |
|
6467 |
" node '%s'" % (inst.name, node_name)) |
|
6468 |
|
|
6469 |
def CheckPrereq(self): |
|
6470 |
"""Check prerequisites. |
|
6471 |
|
|
6472 |
""" |
|
6473 |
storage_type = self.op.storage_type |
|
6474 |
|
|
6475 |
if (constants.SO_FIX_CONSISTENCY not in |
|
6476 |
constants.VALID_STORAGE_OPERATIONS.get(storage_type, [])): |
|
6477 |
raise errors.OpPrereqError("Storage units of type '%s' can not be" |
|
6478 |
" repaired" % storage_type) |
|
6479 |
|
|
6480 |
# Check whether any instance on this node has faulty disks |
|
6481 |
for inst in _GetNodeInstances(self.cfg, self.op.node_name): |
|
6482 |
check_nodes = set(inst.all_nodes) |
|
6483 |
check_nodes.discard(self.op.node_name) |
|
6484 |
for inst_node_name in check_nodes: |
|
6485 |
self._CheckFaultyDisks(inst, inst_node_name) |
|
6486 |
|
|
6487 |
def Exec(self, feedback_fn): |
|
6488 |
feedback_fn("Repairing storage unit '%s' on %s ..." % |
|
6489 |
(self.op.name, self.op.node_name)) |
|
6490 |
|
|
6491 |
st_args = _GetStorageTypeArgs(self.cfg, self.op.storage_type) |
|
6492 |
result = self.rpc.call_storage_execute(self.op.node_name, |
|
6493 |
self.op.storage_type, st_args, |
|
6494 |
self.op.name, |
|
6495 |
constants.SO_FIX_CONSISTENCY) |
|
6496 |
result.Raise("Failed to repair storage unit '%s' on %s" % |
|
6497 |
(self.op.name, self.op.node_name)) |
|
6498 |
|
|
6499 |
|
|
6444 | 6500 |
class LUGrowDisk(LogicalUnit): |
6445 | 6501 |
"""Grow a disk of an instance. |
6446 | 6502 |
|
Also available in: Unified diff