diff --git a/man/gnt-node.sgml b/man/gnt-node.sgml index 5180cd79b459f605abc7556289e7e44996962dd9..840d31ef27bb56d24d0ad1a5163be1741a6336c4 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 1908c40a3a9e4e8870a40f5ce389927cc407cba6..6b0302c3057303d8632c7dbd06cb4e059ad3dd7e 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],