Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package salt for openSUSE:Factory checked in at 2026-06-09 14:16:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/salt (Old) and /work/SRC/openSUSE:Factory/.salt.new.2375 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "salt" Tue Jun 9 14:16:35 2026 rev:197 rq:1357950 version:3006.0 Changes: -------- --- /work/SRC/openSUSE:Factory/salt/salt.changes 2026-05-30 22:55:02.648660988 +0200 +++ /work/SRC/openSUSE:Factory/.salt.new.2375/salt.changes 2026-06-09 14:20:55.850154327 +0200 @@ -1,0 +2,8 @@ +Fri May 29 14:35:44 UTC 2026 - Yeray Gutiérrez Cedrés <[email protected]> + +- Calculate UUID grain for Xen PV guests (bsc#1255418) + +- Added: + * calculate-uuid-grain-for-xen-pv-guests-759.patch + +------------------------------------------------------------------- New: ---- calculate-uuid-grain-for-xen-pv-guests-759.patch ----------(New B)---------- New:- Added: * calculate-uuid-grain-for-xen-pv-guests-759.patch ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ salt.spec ++++++ --- /var/tmp/diff_new_pack.VgrRzQ/_old 2026-06-09 14:21:09.270706038 +0200 +++ /var/tmp/diff_new_pack.VgrRzQ/_new 2026-06-09 14:21:09.282706532 +0200 @@ -642,7 +642,9 @@ Patch204: use-non-vendored-tornado-with-python-3.11.patch # PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/69141 Patch205: add-show_changes-to-file.append-and-file.prepend-sta.patch - +# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/69036 +# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/759 +Patch206: calculate-uuid-grain-for-xen-pv-guests-759.patch ### IMPORTANT: The line below is used as a snippet marker. Do not touch it. ### SALT PATCHES LIST END @@ -714,6 +716,7 @@ BuildRequires: zsh %endif +BuildRequires: python-rpm-macros %define python_subpackage_only 1 %python_subpackages @@ -735,7 +738,6 @@ Summary: python3 library for salt Group: System/Management Requires: %{name} = %{version}-%{release} -BuildRequires: python-rpm-macros %if 0%{?rhel} == 8 BuildRequires: platform-python %else ++++++ _lastrevision ++++++ --- /var/tmp/diff_new_pack.VgrRzQ/_old 2026-06-09 14:21:09.458713767 +0200 +++ /var/tmp/diff_new_pack.VgrRzQ/_new 2026-06-09 14:21:09.462713932 +0200 @@ -1,3 +1,3 @@ -904bbe5685d4ce25be3465962ba31add2bfae0d9 +919b73448b6411e51c7a4babda3ff9abf174c1c1 (No newline at EOF) ++++++ calculate-uuid-grain-for-xen-pv-guests-759.patch ++++++ >From f2389dfbd6d0717e426b793f26001221a093c512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yeray=20Guti=C3=A9rrez=20Cedr=C3=A9s?= <[email protected]> Date: Fri, 29 May 2026 13:53:27 +0100 Subject: [PATCH] Calculate UUID grain for Xen PV guests (#759) * Calculate UUID grain for Xen PV guests. * Fix the case when either `dmidecode` or `smbios` is available but `/sys/class/dmi/id` is missing. * Refine Xen PV UUID detection: The unit test `test__hw_data_linux_empty` was failing because of existing mocks for fopen in rb mode. Switching to rb does no harm because of the use of `to_unicode` of the `/sys/hypervisor/uuid` file contents. --------- Co-authored-by: vzhestkov <[email protected]> --- changelog/69036.added.md | 1 + salt/grains/core.py | 30 ++++++++++++++++++++++---- tests/pytests/unit/grains/test_core.py | 20 +++++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 changelog/69036.added.md diff --git a/changelog/69036.added.md b/changelog/69036.added.md new file mode 100644 index 00000000000..aca967b55c7 --- /dev/null +++ b/changelog/69036.added.md @@ -0,0 +1 @@ +Added UUID detection for Xen paravirtualized guests diff --git a/salt/grains/core.py b/salt/grains/core.py index 582b37de940..7b61db10ee7 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -3149,6 +3149,23 @@ def _hw_data(osdata): return {} grains = {} + + # For Xen para-virtualized guests read UUID from /sys/hypervisor/uuid + if osdata["kernel"] == "Linux" and os.path.exists("/sys/hypervisor/uuid"): + try: + with salt.utils.files.fopen("/sys/hypervisor/uuid", "rb") as ifile: + hypervisor_uuid = salt.utils.stringutils.to_unicode( + ifile.read().strip(), errors="replace" + ) + if hypervisor_uuid: + grains["uuid"] = hypervisor_uuid.lower() + log.debug( + "Read UUID from /sys/hypervisor/uuid for para-virtualized guest: %s", + grains["uuid"], + ) + except OSError as err: + log.debug("Unable to read /sys/hypervisor/uuid: %s", err) + if osdata["kernel"] == "Linux" and os.path.exists("/sys/class/dmi/id"): # On many Linux distributions basic firmware information is available via sysfs # requires CONFIG_DMIID to be enabled in the Linux kernel configuration @@ -3163,6 +3180,9 @@ def _hw_data(osdata): "serialnumber": "product_serial", } for key, fw_file in sysfs_firmware_info.items(): + # Skip UUID if already read from /sys/hypervisor/uuid (Xen PV guests) + if key == "uuid" and "uuid" in grains: + continue contents_file = os.path.join("/sys/class/dmi/id", fw_file) if os.path.exists(contents_file): try: @@ -3193,18 +3213,20 @@ def _hw_data(osdata): ): # On SmartOS (possibly SunOS also) smbios only works in the global zone # smbios is also not compatible with linux's smbios (smbios -s = print summarized) + uuid = __salt__["smbios.get"]("system-uuid") + if uuid is not None: + uuid = uuid.lower() + else: + uuid = grains.get("uuid") grains = { "biosversion": __salt__["smbios.get"]("bios-version"), "biosvendor": __salt__["smbios.get"]("bios-vendor"), "productname": __salt__["smbios.get"]("system-product-name"), "manufacturer": __salt__["smbios.get"]("system-manufacturer"), "biosreleasedate": __salt__["smbios.get"]("bios-release-date"), - "uuid": __salt__["smbios.get"]("system-uuid"), + "uuid": uuid, } grains = {key: val for key, val in grains.items() if val is not None} - uuid = __salt__["smbios.get"]("system-uuid") - if uuid is not None: - grains["uuid"] = uuid.lower() for serial in ( "system-serial-number", "chassis-serial-number", diff --git a/tests/pytests/unit/grains/test_core.py b/tests/pytests/unit/grains/test_core.py index 135c40bc2b7..faaf0b93c62 100644 --- a/tests/pytests/unit/grains/test_core.py +++ b/tests/pytests/unit/grains/test_core.py @@ -3146,6 +3146,26 @@ def test__hw_data_linux_unicode_error(): assert core._hw_data({"kernel": "Linux"}) == {} [email protected]_unless_on_linux +def test__hw_data_xen_pv_uuid(): + hypervisor_uuid = b"12345678-1234-1234-1234-123456789ABC" + expected_uuid = "12345678-1234-1234-1234-123456789abc" + + def _exists_side_effect(path): + if path == "/sys/hypervisor/uuid": + return True + return False + + with patch("os.path.exists", side_effect=_exists_side_effect), patch( + "salt.utils.platform.is_proxy", return_value=False + ), patch("salt.utils.path.which_bin", return_value=None), patch( + "salt.utils.files.fopen", + mock_open(read_data=hypervisor_uuid), + ): + result = core._hw_data({"kernel": "Linux"}) + assert result.get("uuid") == expected_uuid + + @pytest.mark.skip_unless_on_windows def test_kernelparams_return_windows(): """ -- 2.54.0
