From fd65b1e704d82ccec66506abb6429ae2f14b3cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sat, 24 Oct 2026 04:27:11 -0300 Subject: [PATCH] fix(kvm): swap the UUID for pc-q35-2.1 and pc-i440fx-utopic pc-q35-2.1 and the Ubuntu pc-i440fx-utopic store the UUID bytes unencoded behind an SMBIOS 2.8 entry point, as pc-i440fx-2.1 does, so their guest reports the domain UUID with the first three fields swapped. guest_uuid kept the UUID unchanged for them, so mkvm and clonevm gave the guest a UUID that differed from vpd.uuid, and rinv and rscan reported the domain UUID. guest_uuid now swaps the UUID for both machine types. Only QEMU 2.1 to 2.6 provide pc-q35-2.1. pc-i440fx-utopic is the default machine type of Ubuntu 14.10, and the QEMU of Ubuntu 16.04 keeps it with the 2.1 settings. The QEMU of Ubuntu 15.04 and 15.10 defines it with current settings, so a guest there reports the UUID unchanged. pc-q35-2.0 uses SMBIOS 2.4 tables and keeps the UUID unchanged. (cherry picked from commit ba9dfbfed7ea24b0f5344c0c906ce10db4829996) (cherry picked from commit fe83337ce0919b53d3841419e8f462c787a94a6b) (cherry picked from commit 26b6ca5806b658b4454aa467addf52184a3d5d94) Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- perl-xCAT/xCAT/KVMUtils.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/KVMUtils.pm b/perl-xCAT/xCAT/KVMUtils.pm index f4b78fec8d..fa02e3e92b 100644 --- a/perl-xCAT/xCAT/KVMUtils.pm +++ b/perl-xCAT/xCAT/KVMUtils.pm @@ -761,11 +761,11 @@ sub reconfigure_domain { vpd.uuid holds the UUID that the guest reports. QEMU stores the domain UUID as SMBIOS 2.6 specifies, so the guest reports it - unchanged. Machine type pc-i440fx-2.1 and its RHEL counterpart pc-i440fx-rhel7.1.0 - are the exception: they store the UUID bytes in text order behind an SMBIOS 2.8 entry - point, so the guest reports the first three fields swapped. Older machine types store - the same bytes in SMBIOS 2.4 tables, which the guest reads unswapped. The swap is its - own inverse, so one sub converts both ways. + unchanged. Machine types pc-i440fx-2.1, pc-q35-2.1, the RHEL pc-i440fx-rhel7.1.0 and + the Ubuntu pc-i440fx-utopic are the exception: they store the UUID bytes in text order + behind an SMBIOS 2.8 entry point, so the guest reports the first three fields swapped. + Older machine types store the same bytes in SMBIOS 2.4 tables, which the guest reads + unswapped. The swap is its own inverse, so one sub converts both ways. Arguments: $uuid - a domain UUID or a guest UUID, or undef $machine - the machine type of the domain, or undef for the libvirt default @@ -777,7 +777,8 @@ sub reconfigure_domain { #------------------------------------------------------- sub guest_uuid { my ($uuid, $machine) = @_; - return $uuid unless defined($uuid) and defined($machine) and $machine =~ /\Apc-i440fx-(?:2\.1|rhel7\.1\.0)\z/; + return $uuid + unless defined($uuid) and defined($machine) and $machine =~ /\A(?:pc-(?:i440fx|q35)-2\.1|pc-i440fx-(?:rhel7\.1\.0|utopic))\z/; $uuid =~ s/^(..)(..)(..)(..)-(..)(..)-(..)(..)/$4$3$2$1-$6$5-$8$7/; return $uuid; }