mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Do not start nodes when deleting a project
Project.delete() calls open() to rebuild the internal data structures needed for cleanup. open() schedules start_all() when the project has auto_start enabled, so deleting an auto-start project actually launched every node process, allocating ports and consuming resources, only for close() to kill them moments later. open() now takes an auto_start argument (default True, so normal opens are unchanged) and delete() passes auto_start=False. Fixes #2784
This commit is contained in:
1 parent
6742d09a70
commit
00ac2c19bd
2 files changed
+19
-3
No files matched your search
@@ -917,7 +917,7 @@ class Project:
|
||||
|
||||
if self._status != "opened":
|
||||
try:
|
||||
await self.open()
|
||||
await self.open(auto_start=False)
|
||||
except aiohttp.web.HTTPConflict as e:
|
||||
# ignore missing images or other conflicts when deleting a project
|
||||
log.warning(f"Conflict while deleting project: {e}")
|
||||
@@ -998,9 +998,12 @@ class Project:
|
||||
return os.path.join(self.path, self._filename)
|
||||
|
||||
@locking
|
||||
async def open(self):
|
||||
async def open(self, auto_start=True):
|
||||
"""
|
||||
Load topology elements
|
||||
|
||||
:param auto_start: whether the nodes may be started when the project
|
||||
has auto start enabled
|
||||
"""
|
||||
|
||||
if self._closing:
|
||||
@@ -1114,7 +1117,7 @@ class Project:
|
||||
self._loading = False
|
||||
self.emit_controller_notification("project.opened", self.__json__())
|
||||
# Should we start the nodes when project is open
|
||||
if self._auto_start:
|
||||
if self._auto_start and auto_start:
|
||||
# Start all in the background without waiting for completion
|
||||
# we ignore errors because we want to let the user open
|
||||
# their project and fix it
|
||||
|
||||
Reference in new issue
Block a user