mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 00:08:11 +00:00
Adapters support for VirtualBox.
This commit is contained in:
parent
2a8823b856
commit
e61e976368
@ -95,6 +95,7 @@ class BaseManager:
|
|||||||
return self._config
|
return self._config
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@asyncio.coroutine
|
||||||
def unload(cls):
|
def unload(cls):
|
||||||
|
|
||||||
# TODO: close explicitly all the VMs here?
|
# TODO: close explicitly all the VMs here?
|
||||||
|
@ -33,7 +33,7 @@ import shutil
|
|||||||
from pkg_resources import parse_version
|
from pkg_resources import parse_version
|
||||||
from .virtualbox_error import VirtualBoxError
|
from .virtualbox_error import VirtualBoxError
|
||||||
from ..adapters.ethernet_adapter import EthernetAdapter
|
from ..adapters.ethernet_adapter import EthernetAdapter
|
||||||
from .telnet_server import TelnetServer
|
from .telnet_server import TelnetServer # port TelnetServer to asyncio
|
||||||
from ..base_vm import BaseVM
|
from ..base_vm import BaseVM
|
||||||
|
|
||||||
if sys.platform.startswith('win'):
|
if sys.platform.startswith('win'):
|
||||||
@ -70,22 +70,18 @@ class VirtualBoxVM(BaseVM):
|
|||||||
self._adapter_start_index = 0
|
self._adapter_start_index = 0
|
||||||
self._adapter_type = "Intel PRO/1000 MT Desktop (82540EM)"
|
self._adapter_type = "Intel PRO/1000 MT Desktop (82540EM)"
|
||||||
|
|
||||||
# TODO: finish adapters support
|
|
||||||
# self.adapters = 2 # creates 2 adapters by default
|
|
||||||
|
|
||||||
def __json__(self):
|
def __json__(self):
|
||||||
|
|
||||||
# TODO: send adapters info
|
|
||||||
# "adapter_start_index": self._adapter_start_index,
|
|
||||||
# "adapter_type": "Intel PRO/1000 MT Desktop (82540EM)",
|
|
||||||
|
|
||||||
return {"name": self.name,
|
return {"name": self.name,
|
||||||
"uuid": self.uuid,
|
"uuid": self.uuid,
|
||||||
"project_uuid": self.project.uuid,
|
"project_uuid": self.project.uuid,
|
||||||
"vmname": self.vmname,
|
"vmname": self.vmname,
|
||||||
"linked_clone": self.linked_clone,
|
"linked_clone": self.linked_clone,
|
||||||
"headless": self.headless,
|
"headless": self.headless,
|
||||||
"enable_remote_console": self.enable_remote_console}
|
"enable_remote_console": self.enable_remote_console,
|
||||||
|
"adapters": self.adapters,
|
||||||
|
"adapter_type": self.adapter_type,
|
||||||
|
"adapter_start_index": self.adapter_start_index}
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def _execute(self, subcommand, args, timeout=60):
|
def _execute(self, subcommand, args, timeout=60):
|
||||||
@ -204,6 +200,9 @@ class VirtualBoxVM(BaseVM):
|
|||||||
else:
|
else:
|
||||||
yield from self._create_linked_clone()
|
yield from self._create_linked_clone()
|
||||||
|
|
||||||
|
# set 2 adapters by default
|
||||||
|
# yield from self.set_adapters(2)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def start(self):
|
def start(self):
|
||||||
"""
|
"""
|
||||||
@ -526,8 +525,8 @@ class VirtualBoxVM(BaseVM):
|
|||||||
|
|
||||||
return len(self._ethernet_adapters)
|
return len(self._ethernet_adapters)
|
||||||
|
|
||||||
@adapters.setter
|
@asyncio.coroutine
|
||||||
def adapters(self, adapters):
|
def set_adapters(self, adapters):
|
||||||
"""
|
"""
|
||||||
Sets the number of Ethernet adapters for this VirtualBox VM instance.
|
Sets the number of Ethernet adapters for this VirtualBox VM instance.
|
||||||
|
|
||||||
@ -535,7 +534,7 @@ class VirtualBoxVM(BaseVM):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# check for the maximum adapters supported by the VM
|
# check for the maximum adapters supported by the VM
|
||||||
self._maximum_adapters = self._get_maximum_supported_adapters()
|
self._maximum_adapters = yield from self._get_maximum_supported_adapters()
|
||||||
if len(self._ethernet_adapters) > self._maximum_adapters:
|
if len(self._ethernet_adapters) > self._maximum_adapters:
|
||||||
raise VirtualBoxError("Number of adapters above the maximum supported of {}".format(self._maximum_adapters))
|
raise VirtualBoxError("Number of adapters above the maximum supported of {}".format(self._maximum_adapters))
|
||||||
|
|
||||||
|
@ -99,6 +99,23 @@ VBOX_OBJECT_SCHEMA = {
|
|||||||
"description": "headless mode",
|
"description": "headless mode",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"adapters": {
|
||||||
|
"description": "number of adapters",
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 36, # maximum given by the ICH9 chipset in VirtualBox
|
||||||
|
},
|
||||||
|
"adapter_start_index": {
|
||||||
|
"description": "adapter index from which to start using adapters",
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
"maximum": 35, # maximum given by the ICH9 chipset in VirtualBox
|
||||||
|
},
|
||||||
|
"adapter_type": {
|
||||||
|
"description": "VirtualBox adapter type",
|
||||||
|
"type": "string",
|
||||||
|
"minLength": 1,
|
||||||
|
},
|
||||||
"console": {
|
"console": {
|
||||||
"description": "console TCP port",
|
"description": "console TCP port",
|
||||||
"minimum": 1,
|
"minimum": 1,
|
||||||
|
Loading…
Reference in New Issue
Block a user