From 90e3a8d61209a2e795248fddc97bd8d9227d2419 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sun, 3 Sep 2017 22:51:51 +0700 Subject: [PATCH] Round-robin nodes across all available compute resources. Fixes #1165. --- gns3server/controller/import_project.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gns3server/controller/import_project.py b/gns3server/controller/import_project.py index d3cb6f00..33329614 100644 --- a/gns3server/controller/import_project.py +++ b/gns3server/controller/import_project.py @@ -23,6 +23,7 @@ import shutil import asyncio import zipfile import aiohttp +import itertools 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"): node["compute_id"] = "vm" else: + # Round-robin through available compute resources. + compute_nodes = itertools.cycle(controller.computes) for node in topology["topology"]["nodes"]: - node["compute_id"] = "local" + node["compute_id"] = next(compute_nodes) compute_created = set() for node in topology["topology"]["nodes"]: