From 7bc0570735b214a671581beaf49c548efccf37ed Mon Sep 17 00:00:00 2001 From: grossmj Date: Sat, 21 May 2016 19:13:36 -0600 Subject: [PATCH] Allow an IOS router to stop even the Dynamips hypervisor command fail to be sent. Ref #488. --- gns3server/modules/dynamips/nodes/router.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gns3server/modules/dynamips/nodes/router.py b/gns3server/modules/dynamips/nodes/router.py index b3196ac9..4af427ff 100644 --- a/gns3server/modules/dynamips/nodes/router.py +++ b/gns3server/modules/dynamips/nodes/router.py @@ -270,7 +270,10 @@ class Router(BaseVM): status = yield from self.get_status() if status != "inactive": - yield from self._hypervisor.send('vm stop "{name}"'.format(name=self._name)) + try: + yield from self._hypervisor.send('vm stop "{name}"'.format(name=self._name)) + except DynamipsError as e: + log.warn("Could not stop {}: {}".format(self._name, e)) self.status = "stopped" log.info('Router "{name}" [{id}] has been stopped'.format(name=self._name, id=self._id)) yield from self.save_configs() @@ -335,8 +338,8 @@ class Router(BaseVM): try: yield from self.stop() yield from self._hypervisor.send('vm delete "{}"'.format(self._name)) - except DynamipsError: - pass + except DynamipsError as e: + log.warn("Could not stop and delete {}: {}".format(self._name, e)) yield from self.hypervisor.stop() if self._auto_delete_disks: