1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 00:16:04 +00:00

fix(vrtManager): a NIC's edit keeps the parameters of its filter

Saving a NIC's settings replaced its filterref even when the filter
stayed the same, so its parameters were lost: clean-traffic with a
fixed IP went back to learning the address at the next start. The same
filter now keeps its element; another filter replaces it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-08 14:38:53 +03:00
parent 8d09e08908
commit e206862856
2 changed files with 21 additions and 2 deletions

View file

@ -2813,9 +2813,11 @@ class wvmInstance(wvmConnect):
iface.remove(old_model)
if model and model != "default": # default: no model, libvirt chooses
etree.SubElement(iface, "model", type=model)
# the same filter keeps its parameters (clean-traffic's IP, for one)
for old_filter in iface.findall("filterref"):
iface.remove(old_filter)
if nwfilter:
if old_filter.get("filter") != nwfilter:
iface.remove(old_filter)
if nwfilter and iface.find("filterref") is None:
etree.SubElement(iface, "filterref", filter=nwfilter)
self._defineXML(etree.tostring(tree).decode())