Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6e78d75a
authored
Feb 16, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
manager: use data from monitor in scheduler
parent
6fe3ab17
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
circle/manager/scheduler.py
+3
-5
circle/vm/models/node.py
+4
-2
No files found.
circle/manager/scheduler.py
View file @
6e78d75a
...
...
@@ -50,9 +50,7 @@ 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.
"""
total
=
node
.
ram_size
used
=
512
# TODO replace mock value with data from monitor
unused
=
total
-
used
unused
=
node
.
ram_size
*
(
1
-
node
.
ram_usage
)
overcommit
=
node
.
ram_size_with_overcommit
reserved
=
node
.
instance_set
.
aggregate
(
r
=
Sum
(
'ram_size'
))[
'r'
]
or
0
...
...
@@ -66,7 +64,7 @@ def free_cpu_time(node):
Higher values indicate more idle time.
"""
activity
=
0
activity
=
node
.
cpu_usage
inactivity
=
1
-
activity
cores
=
node
.
num_cores
return
cores
*
inactivity
# TODO replace mock value with data from monitor
return
cores
*
inactivity
circle/vm/models/node.py
View file @
6e78d75a
...
...
@@ -163,11 +163,13 @@ class Node(TimeStampedModel):
collected
[
metric
]
=
cache
return
collected
@property
def
cpu_usage
(
self
):
return
self
.
get_monitor_info
()[
"cpu.usage"
]
return
float
(
self
.
get_monitor_info
()[
"cpu.usage"
])
/
100
@property
def
ram_usage
(
self
):
return
self
.
get_monitor_info
()[
"memory.usage"
]
return
float
(
self
.
get_monitor_info
()[
"memory.usage"
])
/
100
def
update_vm_states
(
self
):
domains
=
{}
...
...
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