[sheepdog] [PATCH] sheep: check zone availability when creating new VDI

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Feb 25 00:42:43 CET 2013


At Sun, 24 Feb 2013 19:17:10 +0900,
Hitoshi Mitake wrote:
> 
> As reported by Valerio Pachera [1], current sheep allows creating vdis
> which have copy numbers larger than provided zones. This patch adds a
> check for protecting the invalid behaviour.
> 
> Could you test this patch, Valerio?

Please put this kinds of things before a scissors line or after the
'---' line so that it doesn't go into the commit log.

> diff --git a/sheep/ops.c b/sheep/ops.c
> index c1940c8..9fd8f28 100644
> --- a/sheep/ops.c
> +++ b/sheep/ops.c
> @@ -112,6 +112,22 @@ static int cluster_new_vdi(struct request *req)
>  	struct vdi_iocb iocb;
>  	int ret;
>  
> +	struct vnode_info *current;
> +	int required_zones;
> +
> +	current = get_vnode_info();
> +	required_zones = sys->flags & SD_FLAG_QUORUM ?
> +		hdr->vdi.copies / 2 + 1 : hdr->vdi.copies;
> +
> +	if (current->nr_zones < required_zones) {
> +		sd_eprintf("too large copy number of newly created VDI: %d, "
> +			"max copy number of current cluster is %d\n",
> +			required_zones, current->nr_zones);
> +		ret = SD_RES_INVALID_PARMS;
> +
> +		goto end;
> +	}
> +

When SD_FLAG_NOHALT is set, sheepdog doesn't stop even if there are
not enough nodes.

Thanks,

Kazutaka



More information about the sheepdog mailing list