mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 07:23:47 +02:00
Fixes Dynamips console/aux ports restoration when loading a project.
This commit is contained in:
parent
62afef06af
commit
58d92f1584
@ -58,7 +58,9 @@ class DynamipsVMHandler:
|
||||
request.match_info["project_id"],
|
||||
request.json.get("vm_id"),
|
||||
request.json.get("dynamips_id"),
|
||||
request.json.pop("platform"))
|
||||
request.json.pop("platform"),
|
||||
console=request.json.get("console"),
|
||||
aux=request.json.get("aux"))
|
||||
|
||||
yield from dynamips_manager.update_vm_settings(vm, request.json)
|
||||
yield from dynamips_manager.ghost_ios_support(vm)
|
||||
|
@ -314,7 +314,7 @@ class Dynamips(BaseManager):
|
||||
|
||||
hypervisor = Hypervisor(self._dynamips_path, working_dir, "127.0.0.1", port)
|
||||
|
||||
log.info("Ceating new hypervisor {}:{} with working directory {}".format(hypervisor.host, hypervisor.port, working_dir))
|
||||
log.info("Creating new hypervisor {}:{} with working directory {}".format(hypervisor.host, hypervisor.port, working_dir))
|
||||
yield from hypervisor.start()
|
||||
|
||||
yield from self._wait_for_hypervisor("127.0.0.1", port)
|
||||
|
@ -39,13 +39,15 @@ class C1700(Router):
|
||||
:param project: Project instance
|
||||
:param manager: Parent VM Manager
|
||||
:param dynamips_id: ID to use with Dynamips
|
||||
:param console: console port
|
||||
:param aux: auxiliary console port
|
||||
:param chassis: chassis for this router:
|
||||
1720, 1721, 1750, 1751 or 1760 (default = 1720).
|
||||
1710 is not supported.
|
||||
"""
|
||||
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id, chassis="1720"):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c1700")
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id, console=None, aux=None, chassis="1720"):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, console, aux, platform="c1700")
|
||||
|
||||
# Set default values for this platform (must be the same as Dynamips)
|
||||
self._ram = 64
|
||||
|
@ -41,6 +41,8 @@ class C2600(Router):
|
||||
:param project: Project instance
|
||||
:param manager: Parent VM Manager
|
||||
:param dynamips_id: ID to use with Dynamips
|
||||
:param console: console port
|
||||
:param aux: auxiliary console port
|
||||
:param chassis: chassis for this router:
|
||||
2610, 2611, 2620, 2621, 2610XM, 2611XM
|
||||
2620XM, 2621XM, 2650XM or 2651XM (default = 2610).
|
||||
@ -59,8 +61,8 @@ class C2600(Router):
|
||||
"2650XM": C2600_MB_1FE,
|
||||
"2651XM": C2600_MB_2FE}
|
||||
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id, chassis="2610"):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c2600")
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id, console=None, aux=None, chassis="2610"):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, console, aux, platform="c2600")
|
||||
|
||||
# Set default values for this platform (must be the same as Dynamips)
|
||||
self._ram = 64
|
||||
|
@ -38,10 +38,12 @@ class C2691(Router):
|
||||
:param project: Project instance
|
||||
:param manager: Parent VM Manager
|
||||
:param dynamips_id: ID to use with Dynamips
|
||||
:param console: console port
|
||||
:param aux: auxiliary console port
|
||||
"""
|
||||
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c2691")
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id, console=None, aux=None):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, console, aux, platform="c2691")
|
||||
|
||||
# Set default values for this platform (must be the same as Dynamips)
|
||||
self._ram = 128
|
||||
|
@ -38,12 +38,14 @@ class C3600(Router):
|
||||
:param project: Project instance
|
||||
:param manager: Parent VM Manager
|
||||
:param dynamips_id: ID to use with Dynamips
|
||||
:param console: console port
|
||||
:param aux: auxiliary console port
|
||||
:param chassis: chassis for this router:
|
||||
3620, 3640 or 3660 (default = 3640).
|
||||
"""
|
||||
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id, chassis="3640"):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c3600")
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id, console=None, aux=None, chassis="3640"):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, console, aux, platform="c3600")
|
||||
|
||||
# Set default values for this platform (must be the same as Dynamips)
|
||||
self._ram = 128
|
||||
|
@ -38,10 +38,12 @@ class C3725(Router):
|
||||
:param project: Project instance
|
||||
:param manager: Parent VM Manager
|
||||
:param dynamips_id: ID to use with Dynamips
|
||||
:param console: console port
|
||||
:param aux: auxiliary console port
|
||||
"""
|
||||
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c3725")
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id, console=None, aux=None):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, console, aux, platform="c3725")
|
||||
|
||||
# Set default values for this platform (must be the same as Dynamips)
|
||||
self._ram = 128
|
||||
|
@ -38,10 +38,12 @@ class C3745(Router):
|
||||
:param project: Project instance
|
||||
:param manager: Parent VM Manager
|
||||
:param dynamips_id: ID to use with Dynamips
|
||||
:param console: console port
|
||||
:param aux: auxiliary console port
|
||||
"""
|
||||
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c3745")
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id, console=None, aux=None):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, console, aux, platform="c3745")
|
||||
|
||||
# Set default values for this platform (must be the same as Dynamips)
|
||||
self._ram = 128
|
||||
|
@ -41,11 +41,13 @@ class C7200(Router):
|
||||
:param project: Project instance
|
||||
:param manager: Parent VM Manager
|
||||
:param dynamips_id: ID to use with Dynamips
|
||||
:param console: console port
|
||||
:param aux: auxiliary console port
|
||||
:param npe: Default NPE
|
||||
"""
|
||||
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id, npe="npe-400"):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, platform="c7200")
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id, console=None, aux=None, npe="npe-400"):
|
||||
Router.__init__(self, name, vm_id, project, manager, dynamips_id, console, aux, platform="c7200")
|
||||
|
||||
# Set default values for this platform (must be the same as Dynamips)
|
||||
self._ram = 256
|
||||
|
@ -48,6 +48,8 @@ class Router(BaseVM):
|
||||
:param project: Project instance
|
||||
:param manager: Parent VM Manager
|
||||
:param dynamips_id: ID to use with Dynamips
|
||||
:param console: console port
|
||||
:param aux: auxiliary console port
|
||||
:param platform: Platform of this router
|
||||
"""
|
||||
|
||||
@ -57,9 +59,9 @@ class Router(BaseVM):
|
||||
2: "running",
|
||||
3: "suspended"}
|
||||
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id=None, platform="c7200", hypervisor=None, ghost_flag=False):
|
||||
def __init__(self, name, vm_id, project, manager, dynamips_id=None, console=None, aux=None, platform="c7200", hypervisor=None, ghost_flag=False):
|
||||
|
||||
super().__init__(name, vm_id, project, manager)
|
||||
super().__init__(name, vm_id, project, manager, console=console)
|
||||
|
||||
self._hypervisor = hypervisor
|
||||
self._dynamips_id = dynamips_id
|
||||
@ -86,7 +88,7 @@ class Router(BaseVM):
|
||||
self._disk0 = 0 # Megabytes
|
||||
self._disk1 = 0 # Megabytes
|
||||
self._confreg = "0x2102"
|
||||
self._aux = None
|
||||
self._aux = aux
|
||||
self._mac_addr = ""
|
||||
self._system_id = "FTX0945W0MY" # processor board ID in IOS
|
||||
self._slots = []
|
||||
@ -200,7 +202,9 @@ class Router(BaseVM):
|
||||
id=self._id))
|
||||
|
||||
yield from self._hypervisor.send('vm set_con_tcp_port "{name}" {console}'.format(name=self._name, console=self._console))
|
||||
yield from self._hypervisor.send('vm set_aux_tcp_port "{name}" {aux}'.format(name=self._name, aux=self._aux))
|
||||
|
||||
if self._aux is not None:
|
||||
yield from self._hypervisor.send('vm set_aux_tcp_port "{name}" {aux}'.format(name=self._name, aux=self._aux))
|
||||
|
||||
# get the default base MAC address
|
||||
mac_addr = yield from self._hypervisor.send('{platform} get_mac_addr "{name}"'.format(platform=self._platform,
|
||||
|
Loading…
Reference in New Issue
Block a user