[Libguestfs] [PATCH 1/2] inspection: Handle MD devices in fstab

Richard W.M. Jones rjones at redhat.com
Tue Nov 29 08:58:44 UTC 2011


On Fri, Nov 25, 2011 at 05:32:42PM +0000, Matthew Booth wrote:
>  static int
>  check_fstab (guestfs_h *g, struct inspect_fs *fs)
>  {
> +  /* Generate a map of MD device paths listed in /etc/mdadm.conf to MD device
> +   * paths in the guestfs appliance */
> +  Hash_table *md_map;
> +  if (map_md_devices (g, &md_map) == -1) return -1;

I'm pretty sure this is still wrong ...

If /etc/mdadm.conf doesn't exist(?) or isn't parsable, map_md_devices
returns -1.  It doesn't set error(), which could be bad, since it
returns -1 from check_fstab which requires you to set error().

What it _should_ do is not to call error(), and allow md_map to be
NULL, not returning from check_fstab, but continuing.  Then the other
functions have to be changed to deal with md_map being NULL.

Try creating some guests with /etc/mdadm.conf being
bogus/empty/missing and make sure that inspection can properly handle
them without an error.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora




More information about the Libguestfs mailing list