From db46bcb5356e1c654a4b5b8ecca1ae657d46b9cf Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 11 Jun 2025 11:38:23 +0100 Subject: [PATCH] lib/inspect-osinfo.c: Generate new osinfo shortname for SLES >= 15 libosinfo changes the naming scheme it uses for SUSE starting with major version 15. Previously it used names like "sles12" (or "sles12sp1"), "sled12" for Server and Desktop variants. In 15+ it uses "sle15" as there are no variants any longer (instead the installer asks you what variant you want to install). We're only interested in the Server variant. Change the name that we return to "sle15" or "sle15sp1". See: https://gitlab.com/libosinfo/osinfo-db/-/commit/b0fa386699ce634abb6dd4b56aa0e83d979353fc Fixes: https://issues.redhat.com/browse/RHEL-95791 Thanks: Ming Xie, Victor Toso Related: https://issues.redhat.com/browse/RHEL-95540 --- docs/guestfs-release-notes-1.56.pod | 7 +++++++ lib/inspect-osinfo.c | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/guestfs-release-notes-1.56.pod b/docs/guestfs-release-notes-1.56.pod index 68c6aec57..6336b385b 100644 --- a/docs/guestfs-release-notes-1.56.pod +++ b/docs/guestfs-release-notes-1.56.pod @@ -23,6 +23,9 @@ Inspecting guests that have duplicated root mountpoints now works. Inspection of SUSE Linux guests using btrfs snapshots now ignore snapshots that mirror content in the root filesystem. +Inspection of SUSE Linux >= 15 now returns the correct osinfo short +name (eg. C<"sle15">) (thanks Ming Xie). + =head2 API New C and C APIs which allow you to capture @@ -155,6 +158,10 @@ Lost error when opening wrong format of image readonly [rhel-10.1] RFE: Investigate & do something useful with btrfsvol:...snapshots in SUSE Linux guests +=item L + +libguestfs generates the wrong osinfo for SLES 15 guests [rhel-9.6] + =item L 1.54.0: gdisk/test-expand-gpt.pl fails diff --git a/lib/inspect-osinfo.c b/lib/inspect-osinfo.c index f792d771a..1fc2f59ab 100644 --- a/lib/inspect-osinfo.c +++ b/lib/inspect-osinfo.c @@ -62,10 +62,11 @@ guestfs_impl_inspect_get_osinfo (guestfs_h *g, const char *root) else if (STREQ (distro, "fedora") || STREQ (distro, "mageia")) return safe_asprintf (g, "%s%d", distro, major); else if (STREQ (distro, "sles")) { + const char *base = major >= 15 ? "sle" : "sles"; if (minor == 0) - return safe_asprintf (g, "%s%d", distro, major); + return safe_asprintf (g, "%s%d", base, major); else - return safe_asprintf (g, "%s%dsp%d", distro, major, minor); + return safe_asprintf (g, "%s%dsp%d", base, major, minor); } else if (STREQ (distro, "ubuntu")) return safe_asprintf (g, "%s%d.%02d", distro, major, minor);