Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
0bb3f328
authored
Sep 04, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
manager: fix has_enough_ram()
parent
ac5f3142
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 @
0bb3f328
...
...
@@ -77,19 +77,27 @@ 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'
,
unicode
(
node
),
unicode
(
e
))
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