From 341e2e2e3a5547fe2ad3e083230ef9127584eff3 Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 6 Sep 2018 07:02:32 +0200 Subject: [PATCH] Check if serial pipe can be opened for VMware and VirtualBox VMs. --- gns3server/compute/virtualbox/virtualbox_vm.py | 7 ++++++- gns3server/compute/vmware/vmware_vm.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gns3server/compute/virtualbox/virtualbox_vm.py b/gns3server/compute/virtualbox/virtualbox_vm.py index caefb0c9..a3611458 100644 --- a/gns3server/compute/virtualbox/virtualbox_vm.py +++ b/gns3server/compute/virtualbox/virtualbox_vm.py @@ -938,7 +938,12 @@ class VirtualBoxVM(BaseNode): """ Starts remote console support for this VM. """ - self._remote_pipe = yield from asyncio_open_serial(self._get_pipe_name()) + + pipe_name = self._get_pipe_name() + try: + self._remote_pipe = yield from asyncio_open_serial(pipe_name) + except OSError as e: + raise VirtualBoxError("Could not open serial pipe '{}': {}".format(pipe_name, e)) server = AsyncioTelnetServer(reader=self._remote_pipe, writer=self._remote_pipe, binary=True, diff --git a/gns3server/compute/vmware/vmware_vm.py b/gns3server/compute/vmware/vmware_vm.py index 15fac4f5..64a26e50 100644 --- a/gns3server/compute/vmware/vmware_vm.py +++ b/gns3server/compute/vmware/vmware_vm.py @@ -845,7 +845,12 @@ class VMwareVM(BaseNode): """ Starts remote console support for this VM. """ - self._remote_pipe = yield from asyncio_open_serial(self._get_pipe_name()) + + pipe_name = self._get_pipe_name() + try: + self._remote_pipe = yield from asyncio_open_serial(self._get_pipe_name()) + except OSError as e: + raise VMwareError("Could not open serial pipe '{}': {}".format(pipe_name, e)) server = AsyncioTelnetServer(reader=self._remote_pipe, writer=self._remote_pipe, binary=True,