mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-17 23:08:18 +00:00
Allocate random names for Dynamips NIOs.
This commit is contained in:
@ -20,6 +20,7 @@ Interface for Linux Ethernet NIOs (Linux only).
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import uuid
|
||||
from .nio import NIO
|
||||
|
||||
import logging
|
||||
@ -35,25 +36,12 @@ class NIOLinuxEthernet(NIO):
|
||||
:param ethernet_device: Ethernet device name (e.g. eth0)
|
||||
"""
|
||||
|
||||
_instance_count = 0
|
||||
|
||||
def __init__(self, hypervisor, ethernet_device):
|
||||
|
||||
# create an unique ID and name
|
||||
nio_id = NIOLinuxEthernet._instance_count
|
||||
NIOLinuxEthernet._instance_count += 1
|
||||
name = 'nio_linux_eth' + str(nio_id)
|
||||
# create an unique name
|
||||
name = 'linux_ethernet-{}'.format(uuid.uuid4())
|
||||
self._ethernet_device = ethernet_device
|
||||
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