Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
circle/manager/scheduler.py
+12
-4
No files found.
circle/manager/scheduler.py
View file @
30c3b225
...
...
@@ -77,18 +77,26 @@ def has_enough_ram(ram_size, node):
"""True, if the node has enough memory to accomodate a guest requiring
ram_size mebibytes of memory; otherwise, false.
"""
ram_size
=
ram_size
*
1024
*
1024
try
:
total
=
node
.
ram_size
used
=
(
node
.
ram_usage
/
100
)
*
total
used
=
node
.
byte_ram_usage
unused
=
total
-
used
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
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
:
logger
.
warning
(
'Got incorrect monitoring data for node
%
s.
%
s'
,
logger
.
exception
(
'Got incorrect monitoring data for node
%
s.
%
s'
,
unicode
(
node
),
unicode
(
e
))
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