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
30c3b225
authored
Sep 05, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-scheduler' into 'master'
Fix Scheduler
parents
ac5f3142
0bb3f328
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
circle/manager/scheduler.py
+13
-5
No files found.
circle/manager/scheduler.py
View file @
30c3b225
...
@@ -77,19 +77,27 @@ def has_enough_ram(ram_size, node):
...
@@ -77,19 +77,27 @@ def has_enough_ram(ram_size, node):
"""True, if the node has enough memory to accomodate a guest requiring
"""True, if the node has enough memory to accomodate a guest requiring
ram_size mebibytes of memory; otherwise, false.
ram_size mebibytes of memory; otherwise, false.
"""
"""
ram_size
=
ram_size
*
1024
*
1024
try
:
try
:
total
=
node
.
ram_size
total
=
node
.
ram_size
used
=
(
node
.
ram_usage
/
100
)
*
total
used
=
node
.
byte_ram_usage
unused
=
total
-
used
unused
=
total
-
used
overcommit
=
node
.
ram_size_with_overcommit
overcommit
=
node
.
ram_size_with_overcommit
reserved
=
node
.
instance_set
.
aggregate
(
r
=
Sum
(
'ram_size'
))[
'r'
]
or
0
reserved
=
(
node
.
instance_set
.
aggregate
(
r
=
Sum
(
'ram_size'
))[
'r'
]
or
0
)
*
1024
*
1024
free
=
overcommit
-
reserved
free
=
overcommit
-
reserved
return
ram_size
<
unused
and
ram_size
<
free
retval
=
ram_size
<
unused
and
ram_size
<
free
logger
.
debug
(
'has_enough_ram(
%
d,
%
s)=
%
s (total=
%
s unused=
%
s'
' overcommit=
%
s free=
%
s free_ok=
%
s overcommit_ok=
%
s)'
,
ram_size
,
node
,
retval
,
total
,
unused
,
overcommit
,
free
,
ram_size
<
unused
,
ram_size
<
free
)
return
retval
except
TypeError
as
e
:
except
TypeError
as
e
:
logger
.
warning
(
'Got incorrect monitoring data for node
%
s.
%
s'
,
logger
.
exception
(
'Got incorrect monitoring data for node
%
s.
%
s'
,
unicode
(
node
),
unicode
(
e
))
unicode
(
node
),
unicode
(
e
))
return
False
return
False
...
...
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