From ee00f39eea1c97c5fcb9948b30586c9c106356d7 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Wed, 21 Feb 2018 17:37:30 +0100 Subject: [PATCH] inspector: show the per-OS osinfo guess (RHBZ#1544842) Output also the osinfo guess for each OS in the generated XML output; adapt the RNG schema, and the test data to it. (cherry picked from commit 2f8ec91fc1f3e81c8fb81d45849bc7462ee13642) --- inspector/expected-coreos.img.xml | 1 + inspector/expected-debian.img.xml | 1 + inspector/expected-fedora.img.xml | 1 + inspector/expected-ubuntu.img.xml | 1 + inspector/inspector.c | 7 +++++++ inspector/virt-inspector.rng | 1 + 6 files changed, 12 insertions(+) diff --git a/inspector/expected-coreos.img.xml b/inspector/expected-coreos.img.xml index e4a5d1134..0cdfba6e6 100644 --- a/inspector/expected-coreos.img.xml +++ b/inspector/expected-coreos.img.xml @@ -8,6 +8,7 @@ 899 13 coreos.invalid + coreos899.13 / /usr diff --git a/inspector/expected-debian.img.xml b/inspector/expected-debian.img.xml index 37ecfa049..6583dc262 100644 --- a/inspector/expected-debian.img.xml +++ b/inspector/expected-debian.img.xml @@ -11,6 +11,7 @@ deb apt debian.invalid + debian5 / /usr diff --git a/inspector/expected-fedora.img.xml b/inspector/expected-fedora.img.xml index 8d40e8cb7..df6060a73 100644 --- a/inspector/expected-fedora.img.xml +++ b/inspector/expected-fedora.img.xml @@ -11,6 +11,7 @@ rpm yum fedora.invalid + fedora14 / /boot diff --git a/inspector/expected-ubuntu.img.xml b/inspector/expected-ubuntu.img.xml index c19c14cd5..4ebcd76d6 100644 --- a/inspector/expected-ubuntu.img.xml +++ b/inspector/expected-ubuntu.img.xml @@ -11,6 +11,7 @@ deb apt ubuntu.invalid + ubuntu10.10 / /boot diff --git a/inspector/inspector.c b/inspector/inspector.c index d608b1b63..5075a8f04 100644 --- a/inspector/inspector.c +++ b/inspector/inspector.c @@ -443,6 +443,13 @@ output_root (xmlTextWriterPtr xo, char *root) BAD_CAST str)); free (str); + str = guestfs_inspect_get_osinfo (g, root); + if (!str) exit (EXIT_FAILURE); + if (STRNEQ (str, "unknown")) + XMLERROR (-1, + xmlTextWriterWriteElement (xo, BAD_CAST "osinfo", BAD_CAST str)); + free (str); + output_mountpoints (xo, root); output_filesystems (xo, root); diff --git a/inspector/virt-inspector.rng b/inspector/virt-inspector.rng index 314785202..1e3a58af8 100644 --- a/inspector/virt-inspector.rng +++ b/inspector/virt-inspector.rng @@ -38,6 +38,7 @@ + -- 2.20.1