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
aaa3e50b
authored
Sep 08, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-272' into 'master'
Make some errors human readable
parents
c766e690
7cd242ed
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
11 deletions
+33
-11
circle/common/models.py
+1
-1
circle/manager/scheduler.py
+21
-10
circle/vm/operations.py
+11
-0
No files found.
circle/common/models.py
View file @
aaa3e50b
...
@@ -488,7 +488,7 @@ class HumanReadableException(HumanReadableObject, Exception):
...
@@ -488,7 +488,7 @@ class HumanReadableException(HumanReadableObject, Exception):
"Level should be the name of an attribute of django."
"Level should be the name of an attribute of django."
"contrib.messages (and it should be callable with "
"contrib.messages (and it should be callable with "
"(request, message)). Like 'error', 'warning'."
)
"(request, message)). Like 'error', 'warning'."
)
el
se
:
el
if
not
hasattr
(
self
,
"level"
)
:
self
.
level
=
"error"
self
.
level
=
"error"
def
send_message
(
self
,
request
,
level
=
None
):
def
send_message
(
self
,
request
,
level
=
None
):
...
...
circle/manager/scheduler.py
View file @
aaa3e50b
...
@@ -18,26 +18,37 @@
...
@@ -18,26 +18,37 @@
from
logging
import
getLogger
from
logging
import
getLogger
from
django.db.models
import
Sum
from
django.db.models
import
Sum
from
django.utils.translation
import
ugettext_noop
from
common.models
import
HumanReadableException
logger
=
getLogger
(
__name__
)
logger
=
getLogger
(
__name__
)
class
NotEnoughMemoryException
(
Exception
):
class
SchedulerError
(
HumanReadableException
):
admin_message
=
None
def
__init__
(
self
,
message
=
None
):
def
__init__
(
self
,
params
=
None
,
level
=
None
,
**
kwargs
):
if
message
is
None
:
kwargs
.
update
(
params
or
{})
message
=
"No node has enough memory to accomodate the guest."
super
(
SchedulerError
,
self
)
.
__init__
(
level
,
self
.
message
,
self
.
admin_message
or
self
.
message
,
kwargs
)
Exception
.
__init__
(
self
,
message
)
class
NotEnoughMemoryException
(
SchedulerError
):
message
=
ugettext_noop
(
"The resources required for launching the virtual machine are not "
"available currently. Please try again later."
)
class
TraitsUnsatisfiableException
(
Exception
):
admin_message
=
ugettext_noop
(
"The required free memory for launching the virtual machine is not "
"available on any usable node currently. Please try again later."
)
def
__init__
(
self
,
message
=
None
):
if
message
is
None
:
message
=
"No node can satisfy all required traits of the guest."
Exception
.
__init__
(
self
,
message
)
class
TraitsUnsatisfiableException
(
SchedulerError
):
message
=
ugettext_noop
(
"No node can satisfy the required traits of the "
"new vitual machine currently."
)
def
select_node
(
instance
,
nodes
):
def
select_node
(
instance
,
nodes
):
...
...
circle/vm/operations.py
View file @
aaa3e50b
...
@@ -620,6 +620,17 @@ class ShutdownOperation(InstanceOperation):
...
@@ -620,6 +620,17 @@ class ShutdownOperation(InstanceOperation):
self
.
instance
.
yield_node
()
self
.
instance
.
yield_node
()
self
.
instance
.
yield_vnc_port
()
self
.
instance
.
yield_vnc_port
()
def
on_abort
(
self
,
activity
,
error
):
if
isinstance
(
error
,
TimeLimitExceeded
):
activity
.
result
=
humanize_exception
(
ugettext_noop
(
"The virtual machine did not switch off in the provided time "
"limit. Most of the time this is caused by incorrect ACPI "
"settings. You can also try to power off the machine from the "
"operating system manually."
),
error
)
activity
.
resultant_state
=
None
else
:
super
(
ShutdownOperation
,
self
)
.
on_abort
(
activity
,
error
)
register_operation
(
ShutdownOperation
)
register_operation
(
ShutdownOperation
)
...
...
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