Support controller reloading for templates, appliances and projects. Ref #1743

This commit is contained in:
grossmj committed 2020-04-30 15:30:50 +09:30
1 parent 7b61724213
commit 02c0fa26e1
8 files changed
+44 -12

No files matched your search

+9 -3
View File
@@ -80,7 +80,7 @@ class Controller:
if name == "gns3vm":
name = "Main server"
computes = await self._load_controller_settings()
computes = self._load_controller_settings()
try:
self._local_server = await self.add_compute(compute_id="local",
name=name,
@@ -118,7 +118,7 @@ class Controller:
async def stop(self):
log.info("Controller is Stopping")
log.info("Controller is stopping")
for project in self._projects.values():
await project.close()
for compute in self._computes.values():
@@ -132,6 +132,12 @@ class Controller:
self._computes = {}
self._projects = {}
async def reload(self):
log.info("Controller is reloading")
self._load_controller_settings()
await self.load_projects()
def check_can_write_config(self):
"""
Check if the controller configuration can be written on disk
@@ -182,7 +188,7 @@ class Controller:
except OSError as e:
log.error("Cannot write controller configuration file '{}': {}".format(self._config_file, e))
async def _load_controller_settings(self):
def _load_controller_settings(self):
"""
Reload the controller configuration from disk
"""