[Libguestfs] [PATCH] inspector: Fix virt-inspector on *BSD guests (RHBZ#1144138).
Pino Toscano
ptoscano at redhat.com
Thu Oct 5 16:55:53 UTC 2017
On Thursday, 5 October 2017 17:36:09 CEST Richard W.M. Jones wrote:
> ---
> inspector/inspector.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/inspector/inspector.c b/inspector/inspector.c
> index 3583c61df..30d279987 100644
> --- a/inspector/inspector.c
> +++ b/inspector/inspector.c
> @@ -347,6 +347,7 @@ output_root (xmlTextWriterPtr xo, char *root)
> char buf[32];
> char *canonical_root;
> size_t size;
> + int is_bsd;
>
> XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "operatingsystem"));
>
> @@ -362,6 +363,10 @@ output_root (xmlTextWriterPtr xo, char *root)
> if (STRNEQ (str, "unknown"))
> XMLERROR (-1,
> xmlTextWriterWriteElement (xo, BAD_CAST "name", BAD_CAST str));
> + is_bsd =
> + STREQ (str, "freebsd") ||
> + STREQ (str, "netbsd") ||
> + STREQ (str, "openbsd");
> free (str);
>
> str = guestfs_inspect_get_arch (g, root);
> @@ -451,8 +456,13 @@ output_root (xmlTextWriterPtr xo, char *root)
>
> /* We need to mount everything up in order to read out the list of
> * applications and the icon, ie. everything below this point.
> + *
> + * XXX As a workaround for BSD guests, because the Linux kernel
> + * driver cannot just mount a UFS filesystem, we must disable this
> + * for all *BSD operating systems. We cannot read the apps or icon
> + * from *BSD anyway.
> */
This is not true, libguestfs can actually read those properties. The
proof of that is running virt-inspector with --no-applications, and
--no-icon shows the proper details (such as product name, mount points,
host name, etc) of the guest.
The trick here is what check_for_filesystem_on in daemon/inspect_fs.ml
does, by trying few mount options for ufs filesystems: usually one of
those attempts succeeds, so we extract the information from that
partition. Later on in virt-inspector, though, these extra mount
options are not retained, so it fails.
The two possible options I had in mind were:
a) duplicate the same mount logic also in virt-inspector, which is ugly, duplicates code, etc
b) save these extra mount options, exposing them via a new inspect_*
API: IMHO it is ugly as well, since it would "make official" the
extra mount attempts hack tried in inspect_fs.ml
but both are ugly, in one way or another, so I did not implement either
of them.
Anyway, IMHO this patch is not the correct approach.
--
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20171005/6fc68881/attachment.sig>
More information about the Libguestfs
mailing list