At Fri, 23 Jan 2015 15:49:43 +0900,
Teruaki Ishizaki wrote:
> 
> Now, selectable block_size_shift feature don't support to use
> HyperVolume simultaneously.
> 
> But, users can create a new VDI with both options, -y and -z,
> with dog command.
> 
> This patch changes that users can't specify both those options
> to create a new VDI.
> 
> Signed-off-by: Teruaki Ishizaki <ishizaki.teru...@lab.ntt.co.jp>
> ---
>  dog/vdi.c |   16 ++++++++++++++--
>  1 files changed, 14 insertions(+), 2 deletions(-)

Applied, thanks.
Hitoshi

> 
> diff --git a/dog/vdi.c b/dog/vdi.c
> index dee4b92..67e2f0b 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -470,7 +470,10 @@ static int vdi_create(int argc, char **argv)
>  
>       if (vdi_cmd_data.block_size_shift) {
>               object_size = (UINT32_C(1) << vdi_cmd_data.block_size_shift);
> -             old_max_total_size = object_size * OLD_MAX_DATA_OBJS;
> +     } else if (vdi_cmd_data.store_policy == 1) {
> +             /* Force to use default block_size_shift for hyper volume */
> +             vdi_cmd_data.block_size_shift = SD_DEFAULT_BLOCK_SIZE_SHIFT;
> +             object_size = (UINT32_C(1) << vdi_cmd_data.block_size_shift);
>       } else {
>               struct sd_req hdr;
>               struct sd_rsp *rsp = (struct sd_rsp *)&hdr;
> @@ -496,9 +499,10 @@ static int vdi_create(int argc, char **argv)
>                       goto out;
>               }
>               object_size = (UINT32_C(1) << cinfo.block_size_shift);
> -             old_max_total_size = object_size * OLD_MAX_DATA_OBJS;
>       }
>  
> +     old_max_total_size = object_size * OLD_MAX_DATA_OBJS;
> +
>       if (size > old_max_total_size && 0 == vdi_cmd_data.store_policy) {
>               sd_err("VDI size is larger than %s bytes, please use '-y' to "
>                      "create a hyper volume with size up to %s bytes"
> @@ -3331,6 +3335,10 @@ static int vdi_parser(int ch, const char *opt)
>               break;
>       case 'y':
>               vdi_cmd_data.store_policy = 1;
> +             if (vdi_cmd_data.block_size_shift) {
> +                     sd_info("Don't specify both -y and -z options, please");
> +                     exit(EXIT_FAILURE);
> +             }
>               break;
>       case 'o':
>               vdi_cmd_data.oid = strtoull(opt, &p, 16);
> @@ -3353,6 +3361,10 @@ static int vdi_parser(int ch, const char *opt)
>                              " Please set shift bit larger than 20");
>                       exit(EXIT_FAILURE);
>               }
> +             if (vdi_cmd_data.store_policy == 1) {
> +                     sd_info("Don't specify both -y and -z options, please");
> +                     exit(EXIT_FAILURE);
> +             }
>               vdi_cmd_data.block_size_shift = block_size_shift;
>               break;
>       case 'D':
> -- 
> 1.7.1
> 
> -- 
> sheepdog mailing list
> sheepdog@lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog
-- 
sheepdog mailing list
sheepdog@lists.wpkg.org
https://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to