mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
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 <uuid> and <sysinfo>). The SMBIOS entry takes the clone's UUID. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
parent
3fd9148b67
commit
b4e5567e4a
2 changed files with 9 additions and 0 deletions
|
|
@ -2374,6 +2374,9 @@ class wvmInstance(wvmConnect):
|
||||||
if uuid_el is None:
|
if uuid_el is None:
|
||||||
uuid_el = etree.SubElement(tree, "uuid")
|
uuid_el = etree.SubElement(tree, "uuid")
|
||||||
uuid_el.text = 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(
|
self._set_options(
|
||||||
tree,
|
tree,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,12 @@ class DefineCloneTestCase(unittest.TestCase):
|
||||||
self.assertEqual(tree.find("devices/interface/mac").get("address"), "52:54:00:00:00:02")
|
self.assertEqual(tree.find("devices/interface/mac").get("address"), "52:54:00:00:00:02")
|
||||||
p.vol.storagePoolLookupByVolume.return_value.createXMLFrom.assert_not_called()
|
p.vol.storagePoolLookupByVolume.return_value.createXMLFrom.assert_not_called()
|
||||||
|
|
||||||
|
def test_the_smbios_uuid_is_the_clone_s(self):
|
||||||
|
sysinfo = "<sysinfo type='smbios'><system><entry name='uuid'>u</entry></system></sysinfo>"
|
||||||
|
p = proxy(domain().replace("<devices>", sysinfo + "<devices>"))
|
||||||
|
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):
|
def test_the_clone_s_tpm_is_new(self):
|
||||||
state = "<tpm model='tpm-crb'><backend type='emulator' version='2.0'><source type='dir' path='/srv/tpm/src'/></backend></tpm>"
|
state = "<tpm model='tpm-crb'><backend type='emulator' version='2.0'><source type='dir' path='/srv/tpm/src'/></backend></tpm>"
|
||||||
p = proxy(domain(extra=state))
|
p = proxy(domain(extra=state))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue