1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(computes): a changed compute does not use or list its old host

A compute saved with another address, login or password, or deleted, left
its connection open in the panel: saved back to the old credentials, the
panel used it again although the host no longer took them. A VM list that
read the host before such a change could then save that listing over the
VMs of the new one.

The old connection is retired when a compute's connection changes or the
compute is deleted, and a listing is saved only when the compute's
connection is still the one it was read with.
This commit is contained in:
catborise 2026-11-12 08:44:34 +03:00
parent 29ec20682b
commit d682c4bc82
5 changed files with 81 additions and 2 deletions

View file

@ -432,6 +432,13 @@ class wvmConnectionManager(object):
return connection
return None
def retire_connection(self, host, login, passwd, conn):
"""The connection with these credentials, of a compute changed or
deleted, is not used again: asked again, it connects anew."""
connection = self._search_connection(str(host), str(login), str(passwd) if passwd is not None else None, conn)
if connection is not None:
connection.retire()
def get_connection(self, host, login, passwd, conn):
"""
returns a connection object (as returned by the libvirt.open* methods) for the given host and credentials