[sheepdog] [PATCH v1 1/3] sheep: don't allow it to plug new disk for pure gateway
Liu Yuan
namei.unix at gmail.com
Fri Jun 20 07:04:23 CEST 2014
On Fri, Jun 20, 2014 at 01:54:48PM +0900, Hitoshi Mitake wrote:
> At Wed, 18 Jun 2014 16:48:56 +0800,
> Robin Dong wrote:
> >
> > From: Robin Dong <sanbai at taobao.com>
> >
> > A sheep daemon which is lauched as pure gateway can't (and also don't need)
> > to add data path.
> >
> > Signed-off-by: Robin Dong <sanbai at taobao.com>
> > ---
> > sheep/md.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/sheep/md.c b/sheep/md.c
> > index 29f263f..db9fb76 100644
> > --- a/sheep/md.c
> > +++ b/sheep/md.c
> > @@ -802,6 +802,11 @@ static int do_plug_unplug(char *disks, bool plug)
> > path = strtok(disks, ",");
> > do {
> > if (plug) {
> > + /* Not allowed to plug disk for pure gateway */
> > + if (md.nr_disks == 0 || sys->this_node.nr_vnodes == 0) {
> > + ret = SD_RES_NETWORK_ERROR;
>
> If we actually try to plug disk on gateway node, dog prints an error
> message like below:
>
> $ dog node md plug /disk
> Failed to execute request, look for sheep.log for more information
>
> But sheep.log doesn't contain any error messages, because it simply
> returns the above SD_RES_NETWORK_ERROR. I think you should add more
> user friendly error message.
>
> In addition, the error code isn't suitable for this case. Adding a new
> error code like SD_RES_INVALID_OPERATION for describe invalid
> admin operation and return it would be better.
>
Agree and I think we can return SD_RES_INVALID_PARMS.
Thanks
Yuan
More information about the sheepdog
mailing list