diff --git a/hosting/static/hosting/js/virtual_machine_detail.js b/hosting/static/hosting/js/virtual_machine_detail.js index e611246b..76c00a91 100644 --- a/hosting/static/hosting/js/virtual_machine_detail.js +++ b/hosting/static/hosting/js/virtual_machine_detail.js @@ -1,6 +1,7 @@ function VMTerminateStatus($container, url) { $.ajax({ url: url, + type: 'GET', dataType: 'json', success: function(data) { VMTerminateSuccess($container, data); diff --git a/hosting/views.py b/hosting/views.py index 8e01bb22..8356d5ad 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -969,11 +969,11 @@ class VirtualMachineView(LoginRequiredMixin, View): kwargs={'pk': opennebula_vm_id}) ) - terminated, err = manager.delete_vm(vm.id) + terminated = manager.delete_vm(vm.id) if not terminated: response['text'] = ugettext( - 'Error terminating VM') + opennebula_vm_id + '\n' + err + 'Error terminating VM') + opennebula_vm_id else: for t in range(15): try: diff --git a/opennebula_api/models.py b/opennebula_api/models.py index 9eb89fdf..d584bf26 100644 --- a/opennebula_api/models.py +++ b/opennebula_api/models.py @@ -324,7 +324,6 @@ class OpenNebulaManager(): def delete_vm(self, vm_id): TERMINATE_ACTION = 'terminate' vm_terminated = False - err = '' try: self.oneadmin_client.call( oca.VirtualMachine.METHODS['action'], @@ -334,19 +333,15 @@ class OpenNebulaManager(): vm_terminated = True except socket.timeout as socket_err: logger.info("Socket timeout error: {0}".format(socket_err)) - err = ("Socket timeout error: {0}".format(socket_err)) except OpenNebulaException as opennebula_err: logger.info( "OpenNebulaException error: {0}".format(opennebula_err)) - err = ("OpenNebulaException error: {0}".format(opennebula_err)) except OSError as os_err: logger.info("OSError : {0}".format(os_err)) - err = ("OSError : {0}".format(os_err)) except ValueError as value_err: logger.info("ValueError : {0}".format(value_err)) - err = ("ValueError : {0}".format(value_err)) - return (vm_terminated, err) + return vm_terminated def _get_template_pool(self): try: