mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-17 06:48:18 +00:00
Allocate random names for Dynamips NIOs.
This commit is contained in:
@ -20,6 +20,7 @@ Interface for UNIX NIOs (Unix based OSes only).
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import uuid
|
||||
from .nio import NIO
|
||||
|
||||
import logging
|
||||
@ -36,26 +37,14 @@ class NIOUNIX(NIO):
|
||||
:param remote_file: remote UNIX socket filename
|
||||
"""
|
||||
|
||||
_instance_count = 0
|
||||
|
||||
def __init__(self, hypervisor, local_file, remote_file):
|
||||
|
||||
# create an unique ID and name
|
||||
nio_id = NIOUNIX._instance_count
|
||||
NIOUNIX._instance_count += 1
|
||||
name = 'nio_unix' + str(nio_id)
|
||||
# create an unique name
|
||||
name = 'unix-{}'.format(uuid.uuid4())
|
||||
self._local_file = local_file
|
||||
self._remote_file = remote_file
|
||||
super().__init__(name, hypervisor)
|
||||
|
||||
@classmethod
|
||||
def reset(cls):
|
||||
"""
|
||||
Reset the instance count.
|
||||
"""
|
||||
|
||||
cls._instance_count = 0
|
||||
|
||||
@asyncio.coroutine
|
||||
def create(self):
|
||||
|
||||
|
Reference in New Issue
Block a user