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
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
Hide 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):
...
@@ -50,9 +50,7 @@ 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.
"""
"""
total
=
node
.
ram_size
unused
=
node
.
ram_size
*
(
1
-
node
.
ram_usage
)
used
=
512
# TODO replace mock value with data from monitor
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
...
@@ -66,7 +64,7 @@ def free_cpu_time(node):
...
@@ -66,7 +64,7 @@ def free_cpu_time(node):
Higher values indicate more idle time.
Higher values indicate more idle time.
"""
"""
activity
=
0
activity
=
node
.
cpu_usage
inactivity
=
1
-
activity
inactivity
=
1
-
activity
cores
=
node
.
num_cores
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):
...
@@ -163,11 +163,13 @@ class Node(TimeStampedModel):
collected
[
metric
]
=
cache
collected
[
metric
]
=
cache
return
collected
return
collected
@property
def
cpu_usage
(
self
):
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
):
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
):
def
update_vm_states
(
self
):
domains
=
{}
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