[Libguestfs] [PATCH 1/2] sparsify: ignore read-only btrfs snapshots (RHBZ#1079625)

Richard W.M. Jones rjones at redhat.com
Mon Feb 2 13:18:54 UTC 2015


On Thu, Jan 29, 2015 at 06:54:30PM +0100, Pino Toscano wrote:
> +  let is_readonly_btrfs_snapshot fs mp =
> +    try
> +      let is_btrfs = List.mem fs btrfs_filesystems in
> +      if is_btrfs then (
> +        try
> +          let vol_info = g#btrfs_subvolume_show mp in
> +          string_find (List.assoc "Flags" vol_info) "readonly" <> -1
> +        with _ -> false

Hmm, catching every exception and ignoring it?  I'm guessing you're
trying to ignore G.Error only here (Not_found could escape but will be
caught by the outer try).

> +      ) else false
> +    with Not_found -> false
> +  in

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list