[Libguestfs] [PATCH v2 06/13] resize: add function print_summmary

Richard W.M. Jones rjones at redhat.com
Fri Sep 19 13:04:58 UTC 2014


On Fri, Sep 19, 2014 at 03:39:08PM +0800, Hu Tao wrote:
> Signed-off-by: Hu Tao <hutao at cn.fujitsu.com>
> ---
>  resize/resize.ml | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/resize/resize.ml b/resize/resize.ml
> index 8f0fbea..37e4087 100644
> --- a/resize/resize.ml
> +++ b/resize/resize.ml
> @@ -835,29 +835,29 @@ read the man page virt-resize(1).
>      printf "**********\n\n";
>      printf "Summary of changes:\n\n";
>  
> -    List.iter (
> -      fun ({ p_name = name; p_part = { G.part_size = oldsize }} as p) ->
> +    let rec print_summary p =
>          let text =
>            match p.p_operation with
>            | OpCopy ->
> -              sprintf (f_"%s: This partition will be left alone.") name
> +              sprintf (f_"%s: This partition will be left alone.") p.p_name
>            | OpIgnore ->
> -              sprintf (f_"%s: This partition will be created, but the contents will be ignored (ie. not copied to the target).") name
> +              sprintf (f_"%s: This partition will be created, but the contents will be ignored (ie. not copied to the target).") p.p_name
>            | OpDelete ->
> -              sprintf (f_"%s: This partition will be deleted.") name
> +              sprintf (f_"%s: This partition will be deleted.") p.p_name
>            | OpResize newsize ->
>                sprintf (f_"%s: This partition will be resized from %s to %s.")
> -                name (human_size oldsize) (human_size newsize) ^
> +                p.p_name (human_size p.p_part.G.part_size) (human_size newsize) ^
>                if can_expand_content p.p_type then (
>                  sprintf (f_"  The %s on %s will be expanded using the '%s' method.")
>                    (string_of_partition_content_no_size p.p_type)
> -                  name
> +                  p.p_name
>                    (string_of_expand_content_method
>                       (expand_content_method p.p_type))
>                ) else "" in
>  
> -        wrap ~indent:4 (text ^ "\n\n")
> -    ) partitions;
> +        wrap ~indent:4 (text ^ "\n\n") in
> +
> +    List.iter print_summary partitions;
>  
>      List.iter (
>        fun ({ lv_name = name } as lv) ->
> -- 
> 1.9.3

ACK.  I have pushed this one.

Thanks,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list