mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-04 22:41:12 +02:00
Fix issue when running multiple project containing IOU nodes on the same server. Ref #1239.
This commit is contained in:
1 parent
1045364adc
commit
e5c76750b1
5 files changed
+38
-70
No files matched your search
@@ -24,13 +24,14 @@ log = logging.getLogger(__name__)
|
||||
def get_next_application_id(nodes):
|
||||
"""
|
||||
Calculates free application_id from given nodes
|
||||
|
||||
:param nodes:
|
||||
:raises IOUError when exceeds number
|
||||
:return: integer first free id
|
||||
"""
|
||||
used = set([n.properties.get('application_id') for n in nodes if n.node_type == 'iou'])
|
||||
used = set([n.application_id for n in nodes])
|
||||
pool = set(range(1, 512))
|
||||
try:
|
||||
return (pool - used).pop()
|
||||
except KeyError:
|
||||
raise IOUError("Cannot create a new IOU VM (limit of 512 VMs reached)")
|
||||
raise IOUError("Cannot create a new IOU VM (limit of 512 VMs on one host reached)")
|
||||
Reference in new issue
Block a user