Merge pull request #2724 from yueguobin/fix/import-project-skip-offline-computes

fix: Skip offline compute nodes during project import
This commit is contained in:
Jeremy Grossmann 2026-05-09 13:59:53 +08:00 committed by GitHub
commit 32959f1e04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -134,9 +134,16 @@ async def import_project(
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"] = next(compute_nodes)
# Only use computes that are connected to avoid import failures
available_computes = {compute_id: compute for compute_id, compute in controller.computes.items() if compute.connected}
if available_computes:
compute_nodes = itertools.cycle(available_computes)
for node in topology["topology"]["nodes"]:
node["compute_id"] = next(compute_nodes)
else:
# No remote computes are connected, use local only
for node in topology["topology"]["nodes"]:
node["compute_id"] = "local"
compute_created = set()
for node in topology["topology"]["nodes"]: