From 6c3293afc5dcbe12862248d6d53934791b0cdeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sun, 6 Sep 2026 03:34:19 -0300 Subject: [PATCH] fix(genesis): isolate s390x guest identity --- .../files/xcat-genesis-console/src/state.c | 6 +++++- .../files/genesis-discover | 20 ++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/xCAT-genesis-builder/oe/meta-xcat-genesis/recipes-core/xcat-genesis-console/files/xcat-genesis-console/src/state.c b/xCAT-genesis-builder/oe/meta-xcat-genesis/recipes-core/xcat-genesis-console/files/xcat-genesis-console/src/state.c index b6a356eab..b059ab7c4 100644 --- a/xCAT-genesis-builder/oe/meta-xcat-genesis/recipes-core/xcat-genesis-console/files/xcat-genesis-console/src/state.c +++ b/xCAT-genesis-builder/oe/meta-xcat-genesis/recipes-core/xcat-genesis-console/files/xcat-genesis-console/src/state.c @@ -220,11 +220,15 @@ static bool useful_identity(const char *value) { static void set_s390_identity(const char *proc_root, struct console_state *state) { char path[VALUE_SIZE * 2]; + char control_program[VALUE_SIZE] = ""; + bool guest; snprintf(path, sizeof(path), "%s/sysinfo", proc_root); if (!useful_identity(state->uuid)) { + guest = xcat_read_colon_key(path, "VM00 Control Program", control_program, + sizeof(control_program)); xcat_read_colon_key(path, "VM00 UUID", state->uuid, sizeof(state->uuid)); - if (!useful_identity(state->uuid)) + if (!useful_identity(state->uuid) && !guest) xcat_read_colon_key(path, "LPAR UUID", state->uuid, sizeof(state->uuid)); } } diff --git a/xCAT-genesis-builder/oe/meta-xcat-genesis/recipes-xcat/xcat-genesis-discovery/files/genesis-discover b/xCAT-genesis-builder/oe/meta-xcat-genesis/recipes-xcat/xcat-genesis-discovery/files/genesis-discover index 82526fe29..b22f2c8e2 100755 --- a/xCAT-genesis-builder/oe/meta-xcat-genesis/recipes-xcat/xcat-genesis-discovery/files/genesis-discover +++ b/xCAT-genesis-builder/oe/meta-xcat-genesis/recipes-xcat/xcat-genesis-discovery/files/genesis-discover @@ -81,6 +81,14 @@ read_sysinfo_value() { "$proc_root/sysinfo" 2>/dev/null || true } +sysinfo_has_key() { + local name=$1 + + awk -F ':' -v name="$name" \ + '$1 == name {found = 1; exit} END {exit !found}' \ + "$proc_root/sysinfo" 2>/dev/null +} + send_packet() { if [[ -n ${XCAT_DISCOVERY_SEND_COMMAND:-} ]]; then "$XCAT_DISCOVERY_SEND_COMMAND" "$compressed_packet" "$XCATMASTER" "$XCATPORT" @@ -147,12 +155,14 @@ if [[ $architecture == s390x ]]; then product_name=${product_type}${product_model:+-$product_model} machine_type=$product_name serial= - uuid=$(read_sysinfo_value 'VM00 UUID') - [[ -n $uuid ]] || uuid=$(read_sysinfo_value 'LPAR UUID') - platform=$(read_sysinfo_value 'VM00 Control Program') - if [[ -n $platform ]]; then + if sysinfo_has_key 'VM00 Control Program'; then s390_virtual=1 - else + fi + uuid=$(read_sysinfo_value 'VM00 UUID') + [[ -n $uuid || -n $s390_virtual ]] \ + || uuid=$(read_sysinfo_value 'LPAR UUID') + platform=$(read_sysinfo_value 'VM00 Control Program') + if [[ -z $s390_virtual ]]; then platform=LPAR fi elif [[ -z $product_name ]]; then