[Libguestfs] [v2v PATCH] output_rhv: restrict block status collection to the old RHV output

Richard W.M. Jones rjones at redhat.com
Tue Dec 21 13:47:00 UTC 2021


On Mon, Dec 20, 2021 at 02:56:40PM +0100, Laszlo Ersek wrote:
> +        if (need_actual_sizes) then

You don't need (and shouldn't use) the parentheses here.

> +          (* Ovirt-engine considers the "ovf:actual_size" attribute mandatory.
> +           * If we don't know the actual size, we must create the attribute
> +           * with empty contents.
> +           *)
> +          List.push_back attrs
> +            ("ovf:actual_size",
> +             match actual_size with
> +              | None -> ""
> +              | Some actual_size -> Int64.to_string (bytes_to_gb actual_size)

FYI I was going to suggest (untested!):

  actual_size |>
    Option.map (bytes_to_gb |> Int64.to_string) |>
    Option.default ""

but actually once I wrote it out like this it's pretty clunky and
obscure.  If the match was less complex it could make sense to
consider this, but I don't think in this case.

Rest of the patch is all good, thanks, so:

Reviewed-by: Richard W.M. Jones <rjones at redhat.com>

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