mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-17 22:08:35 +00:00
Round-robin nodes across all available compute resources. Fixes #1165.
This commit is contained in:
parent
c22229101f
commit
90e3a8d612
@ -23,6 +23,7 @@ import shutil
|
|||||||
import asyncio
|
import asyncio
|
||||||
import zipfile
|
import zipfile
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
import itertools
|
||||||
|
|
||||||
from .topology import load_topology
|
from .topology import load_topology
|
||||||
|
|
||||||
@ -116,8 +117,10 @@ def import_project(controller, project_id, stream, location=None, name=None, kee
|
|||||||
if node["node_type"] in ("docker", "qemu", "iou", "nat"):
|
if node["node_type"] in ("docker", "qemu", "iou", "nat"):
|
||||||
node["compute_id"] = "vm"
|
node["compute_id"] = "vm"
|
||||||
else:
|
else:
|
||||||
|
# Round-robin through available compute resources.
|
||||||
|
compute_nodes = itertools.cycle(controller.computes)
|
||||||
for node in topology["topology"]["nodes"]:
|
for node in topology["topology"]["nodes"]:
|
||||||
node["compute_id"] = "local"
|
node["compute_id"] = next(compute_nodes)
|
||||||
|
|
||||||
compute_created = set()
|
compute_created = set()
|
||||||
for node in topology["topology"]["nodes"]:
|
for node in topology["topology"]["nodes"]:
|
||||||
|
Loading…
Reference in New Issue
Block a user