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

Liu Yuan namei.unix at gmail.com
Tue Jan 21 14:25:00 CET 2014


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.

Thanks
Yuan



More information about the sheepdog mailing list