[sheepdog] [PATCH] collie: print VIDs after various vdi operations

Hitoshi Mitake mitake.hitoshi at gmail.com
Tue Jul 2 09:16:50 CEST 2013


At Tue, 2 Jul 2013 15:11:22 +0800,
Liu Yuan wrote:
> 
> On Tue, Jul 02, 2013 at 04:06:50PM +0900, Hitoshi Mitake wrote:
> > At Tue, 2 Jul 2013 11:08:27 +0800,
> > Liu Yuan wrote:
> > > 
> > > On Tue, Jul 02, 2013 at 11:28:05AM +0900, Hitoshi Mitake wrote:
> > > > Priting VIDs after various operations by "collie vdi" is useful both
> > > > for human administrators and software which wraps collie.
> > > > 
> > > > Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> > > > ---
> > > >  collie/vdi.c |   43 ++++++++++++++++++++++++++++++++++++-------
> > > >  1 file changed, 36 insertions(+), 7 deletions(-)
> > > > 
> > > > diff --git a/collie/vdi.c b/collie/vdi.c
> > > > index 987be29..369315d 100644
> > > > --- a/collie/vdi.c
> > > > +++ b/collie/vdi.c
> > > > @@ -609,6 +609,12 @@ static int vdi_create(int argc, char **argv)
> > > >  	}
> > > >  	show_progress(idx * SD_DATA_OBJ_SIZE, inode->vdi_size);
> > > >  	ret = EXIT_SUCCESS;
> > > > +
> > > > +	if (raw_output)
> > > > +		printf("%x\n", vid);
> > > > +	else
> > > > +		printf("VDI ID of newly created VDI: %x\n", vid);
> > > 
> > > No, raw_output is supposed to be parsed by applicatoin. Your patch will simply
> > > break sheepfs.
> > 
> > Does this patch break sheepfs? This patch doesn't change any existing
> > command line options. And it seems that sheepfs only uses "list" of
> > "collie vdi", which is not changed by this patch.
> 
> Ah, yes, won't break sheepfs.
> 
> > 
> > > 
> > > I don't really see the point to printf message for these operations. If no error
> > > returns, it means success.
> > 
> > Sorry, the description is not enough. We want to know the changed VIDs
> > during these operations. This information is used by our internal
> > frontend software for sheepdog management. The frontend has its own
> > management table which contains VIDs and the above outputs are required
> > for updating it.
> 
> collie vdi list name doesn't give you the desired vid? If you really want this
> , I'd suggest add a '-v --verbose' option to these command, in this way won't
> change the old behavior.

Yes, as you say, collie vdi list can also be used for this
purpose. But this way is not efficient. We need O(n) time for
detecting updated VIDs if we compare an existing outer table and the
output of collie vdi list (n is the number of VDIs). So I think the
above vdi operations should print new VIDs.

But adding --verbose option seems to be better. I'll update this
patch.

Thanks,
Hitoshi




More information about the sheepdog mailing list