[sheepdog] [PATCH] dog: check correct number of required nodes for newly created VDIs

Hitoshi Mitake mitake.hitoshi at gmail.com
Wed Jan 22 01:30:47 CET 2014


At Tue, 21 Jan 2014 21:25:00 +0800,
Liu Yuan wrote:
> 
> On Tue, Jan 21, 2014 at 09:43:11PM +0900, Hitoshi Mitake wrote:
> > Current dog compares a number of copies of newly created VDIs and a
> > number of nodes. But the number of copies should be compared to a
> > number of zones when the VDIs are replicated disks.
> > 
> > Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> > ---
> >  dog/vdi.c |    7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/dog/vdi.c b/dog/vdi.c
> > index ec2c0b3..18d7f37 100644
> > --- a/dog/vdi.c
> > +++ b/dog/vdi.c
> > @@ -580,6 +580,7 @@ static int vdi_create(int argc, char **argv)
> >  	uint64_t oid;
> >  	uint32_t idx, max_idx, ret, nr_copies = vdi_cmd_data.nr_copies;
> >  	struct sd_inode *inode = NULL;
> > +	int nr_required_nodes;
> >  
> >  	if (!argv[optind]) {
> >  		sd_err("Please specify the VDI size");
> > @@ -602,9 +603,11 @@ static int vdi_create(int argc, char **argv)
> >  		return EXIT_USAGE;
> >  	}
> >  
> > -	if (nr_copies > sd_nodes_nr) {
> > +	nr_required_nodes = 0 < vdi_cmd_data.copy_policy ?
> > +	                    sd_nodes_nr : sd_zones_nr;
> 
> why difference for ec and replication? zone concept is same for ec and
> replication. you need need to check (nr_copies > sd_zones_nr) here, works
> for ec and replication vdi.

Ah sorry for that. It is my silly mistake. I' ll send v2 later.

Thanks,
Hitoshi



More information about the sheepdog mailing list