mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Fixes packet capture when spaces are in the capture file path.
This commit is contained in:
parent
7ff218a5fc
commit
ae0feb8c9c
@ -1579,7 +1579,7 @@ class Router(object):
|
|||||||
raise DynamipsError("Could not create captures directory {}".format(e))
|
raise DynamipsError("Could not create captures directory {}".format(e))
|
||||||
|
|
||||||
nio.bind_filter("both", "capture")
|
nio.bind_filter("both", "capture")
|
||||||
nio.setup_filter("both", "{} {}".format(data_link_type, output_file))
|
nio.setup_filter("both", '{} "{}"'.format(data_link_type, output_file))
|
||||||
|
|
||||||
log.info("router {name} [id={id}]: starting packet capture on port {slot_id}/{port_id}".format(name=self._name,
|
log.info("router {name} [id={id}]: starting packet capture on port {slot_id}/{port_id}".format(name=self._name,
|
||||||
id=self._id,
|
id=self._id,
|
||||||
|
@ -277,7 +277,6 @@ class VirtualBox(IModule):
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
if not self._vboxwrapper and not self._vboxmanager:
|
if not self._vboxwrapper and not self._vboxmanager:
|
||||||
print("START SERVICE")
|
|
||||||
self._start_vbox_service()
|
self._start_vbox_service()
|
||||||
|
|
||||||
vbox_instance = VirtualBoxVM(self._vboxwrapper,
|
vbox_instance = VirtualBoxVM(self._vboxwrapper,
|
||||||
|
@ -517,29 +517,31 @@ class VirtualBoxVM(object):
|
|||||||
self._serial_pipe.close()
|
self._serial_pipe.close()
|
||||||
self._serial_pipe = None
|
self._serial_pipe = None
|
||||||
|
|
||||||
try:
|
if self._machine.state >= self._vboxmanager.constants.MachineState_FirstOnline and \
|
||||||
if sys.platform.startswith('win') and "VBOX_INSTALL_PATH" in os.environ:
|
self._machine.state <= self._vboxmanager.constants.MachineState_LastOnline:
|
||||||
# work around VirtualBox bug #9239
|
try:
|
||||||
vboxmanage_path = os.path.join(os.environ["VBOX_INSTALL_PATH"], "VBoxManage.exe")
|
if sys.platform.startswith('win') and "VBOX_INSTALL_PATH" in os.environ:
|
||||||
command = '"{}" controlvm "{}" poweroff'.format(vboxmanage_path, self._vmname)
|
# work around VirtualBox bug #9239
|
||||||
subprocess.call(command, timeout=3)
|
vboxmanage_path = os.path.join(os.environ["VBOX_INSTALL_PATH"], "VBoxManage.exe")
|
||||||
else:
|
command = '"{}" controlvm "{}" poweroff'.format(vboxmanage_path, self._vmname)
|
||||||
progress = self._session.console.powerDown()
|
subprocess.call(command, timeout=3)
|
||||||
# wait for VM to actually go down
|
else:
|
||||||
progress.waitForCompletion(3000)
|
progress = self._session.console.powerDown()
|
||||||
log.info("VM is stopping with {}% completed".format(self.vmname, progress.percent))
|
# wait for VM to actually go down
|
||||||
|
progress.waitForCompletion(3000)
|
||||||
|
log.info("VM is stopping with {}% completed".format(self.vmname, progress.percent))
|
||||||
|
|
||||||
self._lock_machine()
|
self._lock_machine()
|
||||||
for adapter_id in range(0, len(self._ethernet_adapters)):
|
for adapter_id in range(0, len(self._ethernet_adapters)):
|
||||||
self._disable_adapter(adapter_id, disable=True)
|
self._disable_adapter(adapter_id, disable=True)
|
||||||
self._session.machine.saveSettings()
|
self._session.machine.saveSettings()
|
||||||
self._unlock_machine()
|
self._unlock_machine()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Do not crash "vboxwrapper", if stopping VM fails.
|
# Do not crash "vboxwrapper", if stopping VM fails.
|
||||||
# But return True anyway, so VM state in GNS3 can become "stopped"
|
# But return True anyway, so VM state in GNS3 can become "stopped"
|
||||||
# This can happen, if user manually kills VBox VM.
|
# This can happen, if user manually kills VBox VM.
|
||||||
log.warn("could not stop VM for {}: {}".format(self._vmname, e))
|
log.warn("could not stop VM for {}: {}".format(self._vmname, e))
|
||||||
return
|
return
|
||||||
|
|
||||||
def suspend(self):
|
def suspend(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user