[sheepdog] [PATCH] sheep, dog: detect a cluster is formatted or not with cinfo.ctime

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Fri Jan 9 10:07:19 CET 2015


At Fri, 09 Jan 2015 18:00:36 +0900,
Saeki Masaki wrote:
> 
> On 2015/01/09 17:18, Hitoshi Mitake wrote:
> > The commit 289b7f4bcdd changed a behavior of SD_OP_CLUSTER_INFO. The
> > changed op returns SD_RES_WAIT_FOR_FORMAT if the cluster is not
> > formatted yet. But this behavior conflicts with ongoing fixed vnode
> > feature. This patch resolves the conflict by changing a way of
> > detecting cluster format in dog command.
> > 
> > Cc: Masaki Saeki <saeki.masaki at po.ntts.co.jp>
> > Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> > ---
> >   dog/vdi.c   | 4 ++--
> >   sheep/ops.c | 3 ---
> >   2 files changed, 2 insertions(+), 5 deletions(-)
> 
> Thank you Mitake-san.
> 
> fixed vnode feature worked well,
> and shown correct message when create VDI before cluster format
> by this patch.
> 
> regards,
> 
> Reviewed-by: Masaki Saeki <saeki.masaki at po.ntts.co.jp>

Thanks for your review. Applied this patch.

Thanks,
Hitoshi

> 
> > 
> > diff --git a/dog/vdi.c b/dog/vdi.c
> > index effed17..6b6465a 100644
> > --- a/dog/vdi.c
> > +++ b/dog/vdi.c
> > @@ -479,9 +479,9 @@ static int vdi_create(int argc, char **argv)
> >   			goto out;
> >   		}
> >   
> > -		if (rsp->result == SD_RES_WAIT_FOR_FORMAT) {
> > +		if (!cinfo.ctime) {
> >   			sd_err("Failed to create VDI %s: %s", vdiname,
> > -			       sd_strerror(rsp->result));
> > +			       sd_strerror(SD_RES_WAIT_FOR_FORMAT));
> >   			return EXIT_FAILURE;
> >   		}
> >   
> > diff --git a/sheep/ops.c b/sheep/ops.c
> > index b0aee58..5d71dde 100644
> > --- a/sheep/ops.c
> > +++ b/sheep/ops.c
> > @@ -1125,9 +1125,6 @@ static int local_oids_exist(const struct sd_req *req, struct sd_rsp *rsp,
> >   static int local_cluster_info(const struct sd_req *req, struct sd_rsp *rsp,
> >   			      void *data, const struct sd_node *sender)
> >   {
> > -	if (sys->cinfo.ctime == 0)
> > -		return SD_RES_WAIT_FOR_FORMAT;
> > -
> >   	memcpy(data, &sys->cinfo, sizeof(sys->cinfo));
> >   	rsp->data_length = sizeof(sys->cinfo);
> >   	return SD_RES_SUCCESS;
> > 
> 
> 



More information about the sheepdog mailing list