From 1e3463f1efb5de1fb6878eb15d50444664bb23f3 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 14 Aug 2009 17:49:10 +0200 Subject: [PATCH] =?UTF-8?q?Implement=20=E2=80=9Cgnt-node=20repair-volume?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- man/gnt-node.sgml | 35 +++++++++++++++++++++++++++++++++++ scripts/gnt-node | 24 ++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/man/gnt-node.sgml b/man/gnt-node.sgml index 5180cd79b..840d31ef2 100644 --- a/man/gnt-node.sgml +++ b/man/gnt-node.sgml @@ -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> diff --git a/scripts/gnt-node b/scripts/gnt-node index 1908c40a3..6b0302c30 100755 --- a/scripts/gnt-node +++ b/scripts/gnt-node @@ -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], -- GitLab