mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Allow computes to be dynamically or manually allocated
This commit is contained in:
1 parent
c290d75eec
commit
21049d73a5
4 files changed
+9
-6
No files matched your search
@@ -495,7 +495,8 @@ class Controller:
|
||||
"""
|
||||
|
||||
if compute_id is None:
|
||||
computes = list(self._computes.values())
|
||||
# get all connected computes
|
||||
computes = [compute for compute in self._computes.values() if compute.connected is True]
|
||||
if len(computes) == 1:
|
||||
# return the only available compute
|
||||
return computes[0]
|
||||
|
||||
@@ -398,7 +398,7 @@ class Compute:
|
||||
raise ControllerNotFoundError(msg)
|
||||
self._capabilities = response.json
|
||||
|
||||
if response.json["version"].split("-")[0] != __version__.split("-")[0]:
|
||||
if response.json["version"].split("+")[0] != __version__.split("+")[0]:
|
||||
if self._name.startswith("GNS3 VM"):
|
||||
msg = (
|
||||
"GNS3 version {} is not the same as the GNS3 VM version {}. Please upgrade the GNS3 VM.".format(
|
||||
|
||||
@@ -524,12 +524,14 @@ class Project:
|
||||
template["x"] = x
|
||||
template["y"] = y
|
||||
node_type = template.pop("template_type")
|
||||
if template.pop("builtin", False) is True:
|
||||
# compute_id is selected by clients for builtin templates
|
||||
|
||||
if compute_id:
|
||||
# use a custom compute_id
|
||||
compute = self.controller.get_compute(compute_id)
|
||||
else:
|
||||
compute = self.controller.get_compute(template.pop("compute_id", compute_id))
|
||||
compute = self.controller.get_compute(template.pop("compute_id"))
|
||||
template_name = template.pop("name")
|
||||
log.info(f'Creating node from template "{template_name}" on compute "{compute.name}" [{compute.id}]')
|
||||
default_name_format = template.pop("default_name_format", "{name}-{0}")
|
||||
if name is None:
|
||||
name = default_name_format.replace("{name}", template_name)
|
||||
|
||||
Reference in new issue
Block a user