}
def _CheckFaultyDisks(self, instance, node_name):
- if _FindFaultyInstanceDisks(self.cfg, self.rpc, instance,
- node_name, True):
- raise errors.OpPrereqError("Instance '%s' has faulty disks on"
- " node '%s'" % (instance.name, node_name),
- errors.ECODE_STATE)
+ """Ensure faulty disks abort the opcode or at least warn."""
+ try:
+ if _FindFaultyInstanceDisks(self.cfg, self.rpc, instance,
+ node_name, True):
+ raise errors.OpPrereqError("Instance '%s' has faulty disks on"
+ " node '%s'" % (instance.name, node_name),
+ errors.ECODE_STATE)
+ except errors.OpPrereqError, err:
+ if self.op.ignore_consistency:
+ self.proc.LogWarning(str(err.args[0]))
+ else:
+ raise
def CheckPrereq(self):
"""Check prerequisites.
# Check whether any instance on this node has faulty disks
for inst in _GetNodeInstances(self.cfg, self.op.node_name):
+ if not inst.admin_up:
+ continue
check_nodes = set(inst.all_nodes)
check_nodes.discard(self.op.node_name)
for inst_node_name in check_nodes:
"node_name",
"storage_type",
"name",
+ "ignore_consistency",
]
<command>modify-storage</command>
<arg><option>--allocatable=yes|no</option></arg>
<sbr>
- <arg><replaceable>node</replaceable></arg>
- <arg><replaceable>storage-type</replaceable></arg>
- <arg><replaceable>volume-name</replaceable></arg>
+ <arg choice="req"><replaceable>node</replaceable></arg>
+ <arg choice="req"><replaceable>storage-type</replaceable></arg>
+ <arg choice="req"><replaceable>volume-name</replaceable></arg>
</cmdsynopsis>
<para>
<cmdsynopsis>
<command>repair-storage</command>
- <arg><replaceable>node</replaceable></arg>
- <arg><replaceable>storage-type</replaceable></arg>
- <arg><replaceable>volume-name</replaceable></arg>
+ <arg>--ignore-consistency</arg>
+ <arg choice="req"><replaceable>node</replaceable></arg>
+ <arg choice="req"><replaceable>storage-type</replaceable></arg>
+ <arg choice="req"><replaceable>volume-name</replaceable></arg>
</cmdsynopsis>
<para>
</caution>
<para>
+ The <option>--ignore-consistency</option> option will ignore
+ any inconsistent disks (on the nodes paired with this
+ one). Use of this option is most likely to lead to data-loss.
+ </para>
+
+ <para>
Example:
<screen>
# gnt-node repair-storage node5.example.com lvm-vg xenvg
op = opcodes.OpRepairNodeStorage(node_name=node_name,
storage_type=storage_type,
- name=volume_name)
+ name=volume_name,
+ ignore_consistency=opts.ignore_consistency)
SubmitOpCode(op)
[ArgNode(min=1, max=1),
ArgChoice(min=1, max=1, choices=_REPAIRABLE_STORAGE_TYPES),
ArgFile(min=1, max=1)],
- [],
+ [IGNORE_CONSIST_OPT],
"<node_name> <storage_type> <name>",
"Repairs a storage volume on a node"),
'list-tags': (