2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-08 12:40:45 +00:00

fix(genesis): isolate s390x guest identity

This commit is contained in:
Vinícius Ferrão
2026-09-06 03:34:19 -03:00
parent 18b36f02ba
commit 6c3293afc5
2 changed files with 20 additions and 6 deletions
@@ -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));
}
}
@@ -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