From 31b168aa4253ef1e08bf83abd0675dc58d833f7b Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 25 Jul 2015 17:09:10 -0600 Subject: [PATCH] Catch Permission denied when writing to VMX file while closing VMware VM. Fixes #277. --- gns3server/modules/vmware/vmware_vm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gns3server/modules/vmware/vmware_vm.py b/gns3server/modules/vmware/vmware_vm.py index 99705ac1..4becdc86 100644 --- a/gns3server/modules/vmware/vmware_vm.py +++ b/gns3server/modules/vmware/vmware_vm.py @@ -437,7 +437,10 @@ class VMwareVM(BaseVM): log.debug("enabling remaining adapter {}".format(adapter_number)) self._vmx_pairs["ethernet{}.startconnected".format(adapter_number)] = "TRUE" - self.manager.write_vmx_file(self._vmx_path, self._vmx_pairs) + try: + self.manager.write_vmx_file(self._vmx_path, self._vmx_pairs) + except OSError as e: + raise VMwareError('Could not write VMware VMX file "{}": {}'.format(self._vmx_path, e)) log.info("VMware VM '{name}' [{id}] stopped".format(name=self.name, id=self.id))