[sheepdog] [PATCH] dog/node: confirm before md plug

Hitoshi Mitake mitake.hitoshi at gmail.com
Wed Jul 16 16:06:50 CEST 2014


At Tue, 15 Jul 2014 15:04:19 +0800,
Ruoyu wrote:
> 
> Once a directory is plugged into the node, all data in it will be removed.
> Therefore, it is better to print a warning message to user first for fear that
> he or she specifies a wrong path.
> 
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
>  dog/node.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/dog/node.c b/dog/node.c
> index 83ff541..95ef4a4 100644
> --- a/dog/node.c
> +++ b/dog/node.c
> @@ -468,8 +468,16 @@ static int do_plug_unplug(char *disks, bool plug)
>  	return EXIT_SUCCESS;
>  }
>  
> +#define MD_PLUG_PRINT				\
> +	"    __\n"				\
> +	"   ()'`;\n"				\
> +	"   /\\|`\n"				\
> +	"  /  |   Caution! The directories to be plugged will be purged.\n" \
> +	"(/_)_|_  Are you sure you want to continue? [yes/no]: "
> +
>  static int md_plug(int argc, char **argv)
>  {
> +	confirm(MD_PLUG_PRINT);

This feature looks good to me but you need to use -f option for avoid
confirmation. It is useful when admins plug disks via scripts.

Thanks,
Hitosih

>  	return do_plug_unplug(argv[optind], true);
>  }
>  
> -- 
> 1.8.3.2
> 
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list