[sheepdog] [PATCH] sheep, dog: check cluster is formatted or not during vdi creation

Teruaki Ishizaki ishizaki.teruaki at lab.ntt.co.jp
Wed Dec 17 04:32:08 CET 2014


(2014/12/17 10:48), Hitoshi Mitake wrote:
> Current dog prints an odd error message in a case of vdi creation
> before cluster formatting like below:
> $ dog/dog vdi create test 16M
> VDI size is larger than 1.0 MB bytes, please use '-y' to create a hyper volume with size up to 16 PB bytes or use '-z' to create larger object size volume
> 
> This patch revives previous behavior.
> 
> Cc: Teruaki Ishizaki <ishizaki.teruaki at lab.ntt.co.jp>
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
>   dog/vdi.c   | 7 +++++++
>   sheep/ops.c | 3 +++
>   2 files changed, 10 insertions(+)

I've tested and it looks good to me.
Reviewed-by: Teruaki Ishizaki <ishizaki.teruaki at lab.ntt.co.jp>

Best Regards,
Teruaki

> 
> diff --git a/dog/vdi.c b/dog/vdi.c
> index 22d6c83..effed17 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -478,6 +478,13 @@ static int vdi_create(int argc, char **argv)
>   			ret = EXIT_FAILURE;
>   			goto out;
>   		}
> +
> +		if (rsp->result == SD_RES_WAIT_FOR_FORMAT) {
> +			sd_err("Failed to create VDI %s: %s", vdiname,
> +			       sd_strerror(rsp->result));
> +			return EXIT_FAILURE;
> +		}
> +
>   		if (rsp->result != SD_RES_SUCCESS) {
>   			sd_err("%s", sd_strerror(rsp->result));
>   			ret = EXIT_FAILURE;
> diff --git a/sheep/ops.c b/sheep/ops.c
> index 448fd8e..3fb34aa 100644
> --- a/sheep/ops.c
> +++ b/sheep/ops.c
> @@ -1125,6 +1125,9 @@ 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;
> 


-- 
NTT ソフトウェアイノベーションセンタ
分散処理基盤技術P(I分P)
石崎 晃朗
Tel: 0422-59-3488 Fax: 0422-59-2965
Email: ishizaki.teruaki at lab.ntt.co.jp



More information about the sheepdog mailing list