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