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

Hitoshi Mitake mitake.hitoshi at gmail.com
Wed Jul 16 16:15:45 CEST 2014


At Wed, 16 Jul 2014 23:06:50 +0900,
Hitoshi Mitake wrote:
> 
> 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.

In addition, could you update tests (057, 063, 064)? They use "md
plug" so -f is required after the confirmation is implemented.

Thanks,
Hitoshi

> 
> 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