mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Avoid disconnecting valid VirtualBox VM adapter backends.
This commit is contained in:
parent
19c5fdb1fd
commit
631d7a1e25
@ -24,7 +24,7 @@ try:
|
||||
import raven
|
||||
RAVEN_AVAILABLE = True
|
||||
except ImportError:
|
||||
# raven is not installed with deb package in order to simplify packagin
|
||||
# raven is not installed with deb package in order to simplify packaging
|
||||
RAVEN_AVAILABLE = False
|
||||
|
||||
from .version import __version__
|
||||
|
@ -959,7 +959,7 @@ class IOUVM(BaseVM):
|
||||
initial_config = initial_config.replace("%h", self._name)
|
||||
f.write(initial_config)
|
||||
except OSError as e:
|
||||
raise IOUError("Can't write initial configuration file '{}'".format(script_file))
|
||||
raise IOUError("Can't write initial configuration file '{}': {}".format(script_file, e))
|
||||
|
||||
@property
|
||||
def initial_config_file(self):
|
||||
|
@ -647,7 +647,11 @@ class VirtualBoxVM(BaseVM):
|
||||
attachment = nic_attachments[adapter_number]
|
||||
if attachment == "null":
|
||||
# disconnect the cable if no backend is attached.
|
||||
self._modify_vm("--cableconnected{} off".format(adapter_number + 1))
|
||||
yield from self._modify_vm("--cableconnected{} off".format(adapter_number + 1))
|
||||
if attachment == "none":
|
||||
# set the backend to null to avoid a difference in the number of interfaces in the Guest.
|
||||
yield from self._modify_vm("--nic{} null".format(adapter_number + 1))
|
||||
yield from self._modify_vm("--cableconnected{} off".format(adapter_number + 1))
|
||||
nio = self._ethernet_adapters[adapter_number].get_nio(0)
|
||||
if nio:
|
||||
if not self._use_any_adapter and attachment not in ("none", "null", "generic"):
|
||||
@ -683,10 +687,6 @@ class VirtualBoxVM(BaseVM):
|
||||
if nio.capturing:
|
||||
yield from self._modify_vm("--nictrace{} on".format(adapter_number + 1))
|
||||
yield from self._modify_vm('--nictracefile{} "{}"'.format(adapter_number + 1, nio.pcap_output_file))
|
||||
else:
|
||||
yield from self._modify_vm("--nic{} null".format(adapter_number + 1))
|
||||
yield from self._modify_vm("--cableconnected{} off".format(adapter_number + 1))
|
||||
|
||||
|
||||
for adapter_number in range(self._adapters, self._maximum_adapters):
|
||||
log.debug("disabling remaining adapter {}".format(adapter_number))
|
||||
|
Loading…
Reference in New Issue
Block a user