[Libguestfs] [PATCH 07/11] v2v: add support for SUSE VMDP drivers
Pino Toscano
ptoscano at redhat.com
Fri May 13 14:17:59 UTC 2016
On Thursday 12 May 2016 15:29:15 Cédric Bosdonnat wrote:
> diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml
> index 7e9f735..a878a3e 100644
> --- a/v2v/windows_virtio.ml
> +++ b/v2v/windows_virtio.ml
> @@ -66,11 +66,19 @@ let rec install_drivers g inspect systemroot root current_cs rcaps =
> else (
> (* Can we install the block driver? *)
> let block : guestcaps_block_type =
> - let has_viostor = g#exists (driverdir // "viostor.inf") in
> + let filenames = ["virtio_blk"; "vrtioblk"; "viostor"] in
> + let driver_name = try (
> + List.find (
> + fun driver_file ->
> + let source = driverdir // (driver_file ^ ".sys") in
> + g#exists source
> + ) filenames
> + ) with Not_found -> "" in
> + let has_viostor = not (driver_name = "") in
Instead of using an empty string for driver_name, use an OCaml option:
let driver_name =
try (
Some (
List.find (
...
)
)
) with Not_found -> None in
let has_viostor = is_some driver_name in
It is slightly longer, but IMHO clearer to read.
--
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160513/8a49b783/attachment.sig>
More information about the Libguestfs
mailing list