mirror of
https://github.com/GNS3/gns3-server
synced 2025-02-26 07:02:12 +00:00
Fix virtualbox links
This commit is contained in:
parent
66d5d34877
commit
4a05a4f7c5
@ -26,7 +26,6 @@ import json
|
|||||||
import uuid
|
import uuid
|
||||||
import shlex
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
import socket
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import tempfile
|
import tempfile
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
@ -285,8 +284,8 @@ class VirtualBoxVM(BaseNode):
|
|||||||
nio = self._ethernet_adapters[adapter_number].get_nio(0)
|
nio = self._ethernet_adapters[adapter_number].get_nio(0)
|
||||||
if nio:
|
if nio:
|
||||||
yield from self.add_ubridge_udp_connection("VBOX-{}-{}".format(self._id, adapter_number),
|
yield from self.add_ubridge_udp_connection("VBOX-{}-{}".format(self._id, adapter_number),
|
||||||
self._local_udp_tunnels[adapter_number][1],
|
self._local_udp_tunnels[adapter_number][1],
|
||||||
nio)
|
nio)
|
||||||
|
|
||||||
yield from self._start_console()
|
yield from self._start_console()
|
||||||
|
|
||||||
@ -968,14 +967,15 @@ class VirtualBoxVM(BaseNode):
|
|||||||
raise VirtualBoxError("Adapter {adapter_number} doesn't exist on VirtualBox VM '{name}'".format(name=self.name,
|
raise VirtualBoxError("Adapter {adapter_number} doesn't exist on VirtualBox VM '{name}'".format(name=self.name,
|
||||||
adapter_number=adapter_number))
|
adapter_number=adapter_number))
|
||||||
|
|
||||||
try:
|
if self.is_running():
|
||||||
yield from self.add_ubridge_udp_connection("VBOX-{}-{}".format(self._id, adapter_number),
|
try:
|
||||||
self._local_udp_tunnels[adapter_number][1],
|
yield from self.add_ubridge_udp_connection("VBOX-{}-{}".format(self._id, adapter_number),
|
||||||
nio)
|
self._local_udp_tunnels[adapter_number][1],
|
||||||
except KeyError:
|
nio)
|
||||||
raise VirtualBoxError("Adapter {adapter_number} doesn't exist on VirtualBox VM '{name}'".format(name=self.name,
|
except KeyError:
|
||||||
adapter_number=adapter_number))
|
raise VirtualBoxError("Adapter {adapter_number} doesn't exist on VirtualBox VM '{name}'".format(name=self.name,
|
||||||
yield from self._control_vm("setlinkstate{} on".format(adapter_number + 1))
|
adapter_number=adapter_number))
|
||||||
|
yield from self._control_vm("setlinkstate{} on".format(adapter_number + 1))
|
||||||
|
|
||||||
adapter.add_nio(0, nio)
|
adapter.add_nio(0, nio)
|
||||||
log.info("VirtualBox VM '{name}' [{id}]: {nio} added to adapter {adapter_number}".format(name=self.name,
|
log.info("VirtualBox VM '{name}' [{id}]: {nio} added to adapter {adapter_number}".format(name=self.name,
|
||||||
@ -999,7 +999,8 @@ class VirtualBoxVM(BaseNode):
|
|||||||
raise VirtualBoxError("Adapter {adapter_number} doesn't exist on VirtualBox VM '{name}'".format(name=self.name,
|
raise VirtualBoxError("Adapter {adapter_number} doesn't exist on VirtualBox VM '{name}'".format(name=self.name,
|
||||||
adapter_number=adapter_number))
|
adapter_number=adapter_number))
|
||||||
|
|
||||||
yield from self._ubridge_send("bridge delete {name}".format(name="VBOX-{}-{}".format(self._id, adapter_number)))
|
if self.is_running():
|
||||||
|
yield from self._ubridge_send("bridge delete {name}".format(name="VBOX-{}-{}".format(self._id, adapter_number)))
|
||||||
vm_state = yield from self._get_vm_state()
|
vm_state = yield from self._get_vm_state()
|
||||||
if vm_state == "running":
|
if vm_state == "running":
|
||||||
yield from self._control_vm("setlinkstate{} off".format(adapter_number + 1))
|
yield from self._control_vm("setlinkstate{} off".format(adapter_number + 1))
|
||||||
@ -1015,6 +1016,12 @@ class VirtualBoxVM(BaseNode):
|
|||||||
adapter_number=adapter_number))
|
adapter_number=adapter_number))
|
||||||
return nio
|
return nio
|
||||||
|
|
||||||
|
def is_running(self):
|
||||||
|
"""
|
||||||
|
:returns: True if the vm is not stopped
|
||||||
|
"""
|
||||||
|
return self.ubridge is not None
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def start_capture(self, adapter_number, output_file):
|
def start_capture(self, adapter_number, output_file):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user