fix(controller): bind and release link members on their live ports

Link.delete cleared the port link through the port object stored at
add_node time; a node update since then rebuilt the port list, so that
object was stale and the live port kept its link — the next link on the
port was refused with "Port is already used". Masked until now by the
older rebuild bug (c2d68a65d): links never survived a rebuild, so the
guard never fired and the stale clear never mattered.
This commit is contained in:
YueGuobin committed 2026-10-06 00:21:10 +08:00
1 parent 1e999d916d
commit 928757542e
3 files changed
+55 -12

No files matched your search

+2 -6
View File
@@ -987,9 +987,7 @@ class Project:
# an image is missing. Keep the link on the controller (so the
# topology is preserved) but defer the NIO creation until the
# missing image is resolved.
for n in link._nodes:
n["node"].add_link(link)
n["port"].link = link
link._bind_members()
link._deferred = True
log.info(
"Project '%s' [%s]: deferring link %s until missing image(s) are resolved",
@@ -1990,9 +1988,7 @@ class Project:
# Finalise every link: wire node/port back-references, mark created,
# notify clients, and apply project-level marker definitions.
for link, _entries in valid:
for n in link._nodes:
n["node"].add_link(link)
n["port"].link = link
link._bind_members()
link._created = True
self.emit_notification("link.created", link.asdict())
log.info("Project '%s' [%s]: created %d links", self._name, self._id, len(valid))