Commit 1e3463f1 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Implement “gnt-node repair-volume”


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 76aef8fc
......@@ -854,6 +854,41 @@ node5.example.com /dev/sdb1 698.6G 1.3G 697.4G
</para>
</refsect2>
<refsect2>
<title>REPAIR-VOLUME</title>
<cmdsynopsis>
<command>repair-volume</command>
<arg><replaceable>node</replaceable></arg>
<arg><replaceable>storage-type</replaceable></arg>
<arg><replaceable>volume-name</replaceable></arg>
</cmdsynopsis>
<para>
Repairs a storage volume on a node. Only LVM volume groups can be
repaired at this time. They have the storage type
<quote>lvm-vg</quote>.
</para>
<para>
On LVM volume groups, <command>repair-volume</command> runs
<quote>vgreduce --removemissing</quote>.
</para>
<caution>
<para>
Running this command can lead to data loss. Use it with care.
</para>
</caution>
<para>
Example:
<screen>
# gnt-node repair-volume node5.example.com lvm-vg xenvg
</screen>
</para>
</refsect2>
<refsect2>
<title>POWERCYCLE</title>
......
......@@ -541,6 +541,26 @@ def ModifyVolume(opts, args):
SubmitOpCode(op)
def RepairVolume(opts, args):
"""Repairs a storage volume on a node.
@param opts: the command line options selected by the user
@type args: list
@param args: should contain 3 items: node name, storage type and volume name
@rtype: int
@return: the desired exit code
"""
(node_name, user_storage_type, volume_name) = args
storage_type = ConvertStorageType(user_storage_type)
op = opcodes.OpRepairNodeStorage(node_name=node_name,
storage_type=storage_type,
name=volume_name)
SubmitOpCode(op)
def SetNodeParams(opts, args):
"""Modifies a node.
......@@ -688,6 +708,10 @@ commands = {
],
"<node_name> <storage_type> <name>",
"Modify storage volume on a node"),
'repair-volume': (RepairVolume, ARGS_FIXED(3),
[DEBUG_OPT],
"<node_name> <storage_type> <name>",
"Repairs a storage volume on a node"),
'list-tags': (ListTags, ARGS_ONE, [DEBUG_OPT],
"<node_name>", "List the tags of the given node"),
'add-tags': (AddTags, ARGS_ATLEAST(1), [DEBUG_OPT, TAG_SRC_OPT],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment