Skip to content

Commit

Permalink
inspector: Display the new build ID field
Browse files Browse the repository at this point in the history
libguestfs 1.49.8 adds a new API to read the build ID from guests
(especially for Windows).  If the new API is available and if it
returns a string other than "unknown", then print it in virt-inspector
output.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
  • Loading branch information
rwmjones committed Dec 2, 2022
1 parent 1920eb4 commit 4e70394
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inspector/inspector.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,14 @@ output_root (xmlTextWriterPtr xo, char *root)
single_element ("hostname", str);
free (str);

#ifdef GUESTFS_HAVE_INSPECT_GET_BUILD_ID
str = guestfs_inspect_get_build_id (g, root);
if (!str) exit (EXIT_FAILURE);
if (STRNEQ (str, "unknown"))
single_element ("build_id", str);
free (str);
#endif

str = guestfs_inspect_get_osinfo (g, root);
if (!str) exit (EXIT_FAILURE);
if (STRNEQ (str, "unknown"))
Expand Down
1 change: 1 addition & 0 deletions inspector/virt-inspector.rng
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<optional><ref name="ospackageformat"/></optional>
<optional><ref name="ospackagemanagement"/></optional>
<optional><element name="hostname"><text/></element></optional>
<optional><element name="build_id"><text/></element></optional>
<optional><element name="osinfo"><text/></element></optional>

<ref name="mountpoints"/>
Expand Down

0 comments on commit 4e70394

Please sign in to comment.