1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

Fix virtualbox links

This commit is contained in:
Julien Duponchelle 2017-07-12 10:32:02 +02:00
parent 66d5d34877
commit 4a05a4f7c5
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -26,7 +26,6 @@ import json
import uuid
import shlex
import shutil
import socket
import asyncio
import tempfile
import xml.etree.ElementTree as ET
@ -968,6 +967,7 @@ class VirtualBoxVM(BaseNode):
raise VirtualBoxError("Adapter {adapter_number} doesn't exist on VirtualBox VM '{name}'".format(name=self.name,
adapter_number=adapter_number))
if self.is_running():
try:
yield from self.add_ubridge_udp_connection("VBOX-{}-{}".format(self._id, adapter_number),
self._local_udp_tunnels[adapter_number][1],
@ -999,6 +999,7 @@ class VirtualBoxVM(BaseNode):
raise VirtualBoxError("Adapter {adapter_number} doesn't exist on VirtualBox VM '{name}'".format(name=self.name,
adapter_number=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()
if vm_state == "running":
@ -1015,6 +1016,12 @@ class VirtualBoxVM(BaseNode):
adapter_number=adapter_number))
return nio
def is_running(self):
"""
:returns: True if the vm is not stopped
"""
return self.ubridge is not None
@asyncio.coroutine
def start_capture(self, adapter_number, output_file):
"""