Commit fd49ea7e by Guba Sándor Committed by Őry Máté

vm: fix TimeLimitExceeded exception's name

parent 07fb9e65
...@@ -15,7 +15,7 @@ from django.dispatch import Signal ...@@ -15,7 +15,7 @@ from django.dispatch import Signal
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from celery.exceptions import TimeoutError from celery.exceptions import TimeLimitExceeded
from model_utils.models import TimeStampedModel from model_utils.models import TimeStampedModel
from taggit.managers import TaggableManager from taggit.managers import TaggableManager
...@@ -775,7 +775,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -775,7 +775,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
raise self.WrongStateError(self) raise self.WrongStateError(self)
def __on_abort(activity, error): def __on_abort(activity, error):
if isinstance(error, TimeoutError): if isinstance(error, TimeLimitExceeded):
activity.resultant_state = None activity.resultant_state = None
else: else:
activity.resultant_state = 'ERROR' activity.resultant_state = 'ERROR'
...@@ -826,7 +826,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -826,7 +826,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
"""Shutdown virtual machine with ACPI signal. """Shutdown virtual machine with ACPI signal.
""" """
def __on_abort(activity, error): def __on_abort(activity, error):
if isinstance(error, TimeoutError): if isinstance(error, TimeLimitExceeded):
activity.resultant_state = None activity.resultant_state = None
else: else:
activity.resultant_state = 'ERROR' activity.resultant_state = 'ERROR'
...@@ -841,6 +841,9 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel): ...@@ -841,6 +841,9 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
queue_name = self.get_remote_queue_name('vm') queue_name = self.get_remote_queue_name('vm')
vm_tasks.shutdown.apply_async(args=[self.vm_name], vm_tasks.shutdown.apply_async(args=[self.vm_name],
queue=queue_name).get() queue=queue_name).get()
self.node = None
self.vnc_port = None
self.save()
def shutdown_async(self, user=None): def shutdown_async(self, user=None):
"""Execute shutdown asynchronously. """Execute shutdown asynchronously.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment