From b4e5567e4aa37146fb0e445260fe3edc06de31b6 Mon Sep 17 00:00:00 2001 From: catborise Date: Sat, 7 Nov 2026 23:45:50 +0300 Subject: [PATCH] fix(instances): a VM with an SMBIOS UUID can be cloned The clone took a new UUID but kept the VM's in its SMBIOS system information, and libvirt refused the definition (UUID mismatch between and ). The SMBIOS entry takes the clone's UUID. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea --- vrtManager/instance.py | 3 +++ vrtManager/tests/test_live_clone.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/vrtManager/instance.py b/vrtManager/instance.py index 51256fa8..7c232c39 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -2374,6 +2374,9 @@ class wvmInstance(wvmConnect): if uuid_el is None: uuid_el = etree.SubElement(tree, "uuid") uuid_el.text = uuid + # libvirt refuses an SMBIOS UUID other than the domain's + for entry in tree.xpath("sysinfo/system/entry[@name='uuid']"): + entry.text = uuid self._set_options( tree, { diff --git a/vrtManager/tests/test_live_clone.py b/vrtManager/tests/test_live_clone.py index 9e84d3d4..c8983441 100644 --- a/vrtManager/tests/test_live_clone.py +++ b/vrtManager/tests/test_live_clone.py @@ -290,6 +290,12 @@ class DefineCloneTestCase(unittest.TestCase): self.assertEqual(tree.find("devices/interface/mac").get("address"), "52:54:00:00:00:02") p.vol.storagePoolLookupByVolume.return_value.createXMLFrom.assert_not_called() + def test_the_smbios_uuid_is_the_clone_s(self): + sysinfo = "u" + p = proxy(domain().replace("", sysinfo + "")) + tree, _disks = p._clone_definition(FORM, UUID) + self.assertEqual(tree.xpath("string(sysinfo/system/entry[@name='uuid'])"), UUID) + def test_the_clone_s_tpm_is_new(self): state = "" p = proxy(domain(extra=state))