1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 11:46:49 +00:00

fix(instances): find known VMs by UUID, not by name

Instance.proxy looked the domain up by its stored name. After a rename
or a name swap outside WebVirtCloud, an operation on one VM changed
another; after a VM was replaced under the same name, operations hit
the new VM.

wvmInstance takes the UUID and uses lookupByUUIDString, with no
fallback to the name: a missing UUID fails instead of picking another
domain. Every caller that has an Instance passes it: proxy, console,
quota, post-migration autostart and the VDI URL. Migration uses the
domain the proxy already resolved. getvvfile and the gstfsd requests
use the host's current name of that UUID.

Live tests cover a name swap and a VM replaced under the same name;
both fail on the previous code.
This commit is contained in:
catborise 2026-10-03 14:56:56 +03:00
parent ffb2ce6bfa
commit 3e427a41b8
9 changed files with 52 additions and 14 deletions

View file

@ -126,7 +126,7 @@ class wvmInstances(wvmConnect):
if undefine:
flags |= VIR_MIGRATE_UNDEFINE_SOURCE
dom = conn.get_instance(name)
dom = conn.instance
dom_arch = conn.get_arch()
dom_emulator = conn.get_dom_emulator()
@ -177,10 +177,12 @@ class wvmInstances(wvmConnect):
class wvmInstance(wvmConnect):
def __init__(self, host, login, passwd, conn, vname):
def __init__(self, host, login, passwd, conn, vname, uuid=None):
wvmConnect.__init__(self, host, login, passwd, conn)
self._ip_cache = None
self.instance = self.get_instance(vname)
# A known VM is found by UUID: a name can be renamed or swapped
# outside WebVirtCloud. No fallback to the name.
self.instance = self.wvm.lookupByUUIDString(uuid) if uuid else self.get_instance(vname)
def osinfo(self):
info_results = qemuAgentCommand(