Skip to content

Commit

Permalink
Change method to allocate AUX console for existing Dynamips nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Sep 22, 2024
1 parent c41c11e commit 74782d4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
1 change: 0 additions & 1 deletion gns3server/compute/base_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ def aux_type(self, aux_type):
:param aux_type: console type (string)
"""

print("SET AUX TYPE", aux_type)
if aux_type != self._aux_type:
# get a new port if the aux type change
if self._aux:
Expand Down
4 changes: 0 additions & 4 deletions gns3server/compute/dynamips/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,6 @@ async def update_vm_settings(self, vm, settings):
if usage is not None and usage != vm.usage:
vm.usage = usage

aux_type = settings.get("aux_type")
if aux_type is not None and aux_type != vm.aux_type:
vm.aux_type = aux_type

# update the configs if needed
await self.set_vm_configs(vm, settings)

Expand Down
22 changes: 21 additions & 1 deletion gns3server/compute/dynamips/nodes/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,27 @@ async def set_aux(self, aux):
"""

self.aux = aux
await self._hypervisor.send('vm set_aux_tcp_port "{name}" {aux}'.format(name=self._name, aux=aux))
await self._hypervisor.send('vm set_aux_tcp_port "{name}" {aux}'.format(name=self._name, aux=self._aux))

async def set_aux_type(self, aux_type):
"""
Sets the aux type.
:param aux_type: auxiliary console type
"""

if self.aux_type != aux_type:
status = await self.get_status()
if status == "running":
raise DynamipsError('"{name}" must be stopped to change the auxiliary console type to {aux_type}'.format(
name=self._name,
aux_type=aux_type)
)

self.aux_type = aux_type

if self._aux and aux_type == "telnet":
await self._hypervisor.send('vm set_aux_tcp_port "{name}" {aux}'.format(name=self._name, aux=self._aux))

async def reset_console(self):
"""
Expand Down

0 comments on commit 74782d4

Please sign in to comment.