1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Merge branch 'master' into unstable

Conflicts:
	gns3server/modules/virtualbox/__init__.py
	gns3server/version.py
This commit is contained in:
Julien Duponchelle 2015-04-29 14:25:44 +02:00
commit f8f6f5dc5d
5 changed files with 82 additions and 9 deletions

View File

@ -1,5 +1,37 @@
# Change Log
## 1.3.2 28/04/2015
* Cleanup the VirtualBox Media Manager after closing a project.
* Avoid Cygwin warning with VPCS on Windows.
* Close VirtualBox VM linked clone disks after the VM is unregistered.
* TAP interface support for QEMU VMs.
* Return an explicit error when a NIO type is not supported by a VM.
* Do not erase the IOU config
* Explicit utf-8 decoding.
* Check NIO exists when stopping an IOU capture.
* Fixes c7200 NPE setting.
* Fixes VPCS process termination.
* Catch FileNotFoundError exception in os.getcwd()
* Explicit utf-8 encoding where necessary to avoid Unicode errors on Windows (we require/set an utf-8 locale on other systems).
* Fixes #270. Relative paths management with empty ones.
* New crash report key and doesn't send report for developers
* Catch COM errors when connecting to WMI.
* Don't assume the PATH environment variable exists.
* Use UUIDs instead of the VM names for VirtualBox pipe paths.
* Add --log options for daemon support
* Basic upstart script
* Add qemu-kvm to the list of binary
* Fix IOU licence check flag
* Config paths are not used when updating Dynamips or IOU VM settings.
* Fixes initial-configs that were not restored when opening a project containing IOU VMs.
* Prevent parallel execution of VBox commands
* Fix a crash when in some cases you can't access to VBOX state
* Fix crash if VirtualBox doesn't return API version
* Fix a crash in VirtualBox vm creation
* Allocate random names for Dynamips NIOs.
* Explicitly delete Dynamips NIOs and unmap VCs for ATM and Frame-Relay switches.
## 1.3.1 11/04/2015
* Release

View File

@ -115,6 +115,50 @@ class VirtualBox(BaseManager):
return stdout_data.decode("utf-8", errors="ignore").splitlines()
@asyncio.coroutine
def _find_inaccessible_hdd_files(self):
"""
Finds inaccessible disk files (to clean up the VirtualBox media manager)
"""
hdds = []
try:
properties = yield from self.execute("list", ["hdds"])
# If VirtualBox is not available we have no inaccessible hdd
except VirtualBoxError:
return hdds
flag_inaccessible = False
for prop in properties:
try:
name, value = prop.split(':', 1)
except ValueError:
continue
if name.strip() == "State" and value.strip() == "inaccessible":
flag_inaccessible = True
if flag_inaccessible and name.strip() == "Location":
hdds.append(value.strip())
flag_inaccessible = False
return reversed(hdds)
@asyncio.coroutine
def project_closed(self, project):
"""
Called when a project is closed.
:param project: Project instance
"""
yield from super().project_closed(project)
hdd_files_to_close = yield from self._find_inaccessible_hdd_files()
for hdd_file in hdd_files_to_close:
log.info("Closing VirtualBox VM disk file {}".format(os.path.basename(hdd_file)))
try:
yield from self.execute("closemedium", ["disk", hdd_file])
except VirtualBoxError as e:
log.warning("Could not close VirtualBox VM disk file {}: {}".format(os.path.basename(hdd_file), e))
continue
@asyncio.coroutine
def list_images(self):
"""

View File

@ -321,7 +321,6 @@ class VirtualBoxVM(BaseVM):
if self._linked_clone:
hdd_table = []
hdd_files_to_close = []
if os.path.exists(self.working_dir):
hdd_files = yield from self._get_all_hdd_files()
vm_info = yield from self._get_vm_info()
@ -332,7 +331,6 @@ class VirtualBoxVM(BaseVM):
port = match.group(2)
device = match.group(3)
if value in hdd_files:
hdd_files_to_close.append(value)
log.info("VirtualBox VM '{name}' [{id}] detaching HDD {controller} {port} {device}".format(name=self.name,
id=self.id,
controller=controller,
@ -353,12 +351,6 @@ class VirtualBoxVM(BaseVM):
log.info("VirtualBox VM '{name}' [{id}] unregistering".format(name=self.name, id=self.id))
yield from self.manager.execute("unregistervm", [self._name])
for hdd_file in hdd_files_to_close:
log.info("VirtualBox VM '{name}' [{id}] closing disk {disk}".format(name=self.name,
id=self.id,
disk=os.path.basename(hdd_file)))
yield from self.manager.execute("closemedium", ["disk", hdd_file])
if hdd_table:
try:
hdd_info_file = os.path.join(self.working_dir, self._vmname, "hdd_info.json")

View File

@ -161,6 +161,11 @@ class Route(object):
response = Response(request=request, route=route)
response.set_status(408)
response.json({"message": "Client disconnected", "status": 408})
except ConnectionResetError:
log.error("Client connection reset")
response = Response(request=request, route=route)
response.set_status(408)
response.json({"message": "Connection reset", "status": 408})
except Exception as e:
log.error("Uncaught exception detected: {type}".format(type=type(e)), exc_info=1)
response = Response(request=request, route=route)

View File

@ -102,7 +102,7 @@ def test_get_abs_image_path(qemu, tmpdir):
def test_get_relative_image_path(qemu, tmpdir):
os.makedirs(str(tmpdir / "Qemu"))
os.makedirs(str(tmpdir / "QEMU"))
path1 = str(tmpdir / "test1.bin")
open(path1, 'w+').close()