Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
843baa34
authored
Aug 01, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common: use humanize_exception for aborted activities
parent
bb695789
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
circle/storage/models.py
+9
-5
circle/vm/models/instance.py
+6
-3
No files found.
circle/storage/models.py
View file @
843baa34
...
...
@@ -33,7 +33,9 @@ from sizefield.models import FileSizeField
from
.tasks
import
local_tasks
,
storage_tasks
from
celery.exceptions
import
TimeoutError
from
common.models
import
WorkerNotFound
,
HumanReadableException
from
common.models
import
(
WorkerNotFound
,
HumanReadableException
,
humanize_exception
)
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -404,10 +406,11 @@ class Disk(TimeStampedModel):
try
:
result
=
remote
.
get
(
timeout
=
5
)
break
except
TimeoutError
:
except
TimeoutError
as
e
:
if
task
is
not
None
and
task
.
is_aborted
():
AbortableAsyncResult
(
remote
.
id
)
.
abort
()
raise
Exception
(
"Download aborted by user."
)
raise
humanize_exception
(
ugettext_noop
(
"Operation aborted by user."
),
e
)
disk
.
size
=
result
[
'size'
]
disk
.
type
=
result
[
'type'
]
disk
.
is_ready
=
True
...
...
@@ -477,11 +480,12 @@ class Disk(TimeStampedModel):
try
:
remote
.
get
(
timeout
=
5
)
break
except
TimeoutError
:
except
TimeoutError
as
e
:
if
task
is
not
None
and
task
.
is_aborted
():
AbortableAsyncResult
(
remote
.
id
)
.
abort
()
disk
.
destroy
()
raise
Exception
(
"Save as aborted by use."
)
raise
humanize_exception
(
ugettext_noop
(
"Operation aborted by user."
),
e
)
disk
.
is_ready
=
True
disk
.
save
()
return
disk
circle/vm/models/instance.py
View file @
843baa34
...
...
@@ -41,7 +41,9 @@ from model_utils.models import TimeStampedModel, StatusModel
from
taggit.managers
import
TaggableManager
from
acl.models
import
AclBase
from
common.models
import
create_readable
,
HumanReadableException
from
common.models
import
(
create_readable
,
HumanReadableException
,
humanize_exception
)
from
common.operations
import
OperatedMixin
from
..tasks
import
vm_tasks
,
agent_tasks
from
.activity
import
(
ActivityInProgressError
,
instance_activity
,
...
...
@@ -877,10 +879,11 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
while
True
:
try
:
return
remote
.
get
(
timeout
=
step
)
except
TimeoutError
:
except
TimeoutError
as
e
:
if
task
is
not
None
and
task
.
is_aborted
():
AbortableAsyncResult
(
remote
.
id
)
.
abort
()
raise
Exception
(
"Shutdown aborted by user."
)
raise
humanize_exception
(
ugettext_noop
(
"Operation aborted by user."
),
e
)
def
suspend_vm
(
self
,
timeout
=
230
):
queue_name
=
self
.
get_remote_queue_name
(
'vm'
,
'slow'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment