From 0ba180ad1daad482a014868537c6fa9b8b1c97f1 Mon Sep 17 00:00:00 2001 From: YueGuobin Date: Tue, 2 Jun 2026 13:04:44 +0800 Subject: [PATCH] Fix unnecessary Docker container recreation when renaming a project When renaming a project that has running Docker containers, the containers were unnecessarily stopped, removed, and recreated, even though the project name change doesn't affect container configuration. Root cause: - Client sends complete project object including variables: [] during rename - Controller unconditionally notified all computes about the update - Docker nodes rebuild containers on any project update notification Solution: - Only notify compute nodes when variables field has actual content - Treat None and [] as semantically equivalent (no variables) - Empty variables don't affect running containers, so no need to update Impact: - Project rename operations no longer trigger ~7 second container rebuilds - Only actual variable changes trigger container recreation - Fixes issue #2760 --- gns3server/controller/project.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gns3server/controller/project.py b/gns3server/controller/project.py index 9452c21b5..f6697dfaa 100644 --- a/gns3server/controller/project.py +++ b/gns3server/controller/project.py @@ -197,9 +197,11 @@ class Project: self.emit_controller_notification("project.updated", self.asdict()) self.dump() - # update on computes - for compute in list(self._project_created_on_compute): - await compute.put(f"/projects/{self._id}", {"variables": self.variables}) + # Only notify computes if variables actually changed and have content + # None and empty list are semantically equivalent (no variables) and don't affect running nodes + if "variables" in kwargs and kwargs["variables"]: + for compute in list(self._project_created_on_compute): + await compute.put(f"/projects/{self._id}", {"variables": self.variables}) def reset(self): """