Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-node
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-node
Commits
53696d3c
Commit
53696d3c
authored
10 years ago
by
Antoine Millet
Browse files
Options
Downloads
Patches
Plain Diff
Added memremaining tag
parent
012be518
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cloudcontrol/node/hypervisor/__init__.py
+1
-1
1 addition, 1 deletion
cloudcontrol/node/hypervisor/__init__.py
cloudcontrol/node/hypervisor/tags.py
+9
-0
9 additions, 0 deletions
cloudcontrol/node/hypervisor/tags.py
with
10 additions
and
1 deletion
cloudcontrol/node/hypervisor/__init__.py
+
1
−
1
View file @
53696d3c
...
...
@@ -125,7 +125,7 @@ class Handler(HostHandler):
# we must refresh those tags only when domains tags are registered to
# have the calculated values
for
tag
in
(
'
cpualloc
'
,
'
cpurunning
'
,
'
memalloc
'
,
'
memrunning
'
):
for
tag
in
(
'
cpualloc
'
,
'
cpurunning
'
,
'
memalloc
'
,
'
memrunning
'
,
'
memremaining
'
):
self
.
tag_db
[
'
__main__
'
][
tag
].
update_value
()
# register libvirt handlers
...
...
This diff is collapsed.
Click to expand it.
cloudcontrol/node/hypervisor/tags.py
+
9
−
0
View file @
53696d3c
...
...
@@ -20,6 +20,7 @@ from functools import wraps
import
libvirt
from
cloudcontrol.node.utils
import
and_
from
cloudcontrol.common.client.tags
import
ttl
,
refresh
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -175,3 +176,11 @@ def memalloc(handl):
"""
Memory used by all VMs on the hypervisor.
"""
return
sum
(
int
(
vm
.
tag_db
[
'
__main__
'
][
'
mem
'
].
value
)
for
vm
in
handl
.
hypervisor
.
domains
.
itervalues
()
if
vm
.
tag_db
[
'
__main__
'
][
'
mem
'
].
value
)
@_check_virt_connected
def
memremaining
(
handl
):
"""
Allocatable memory remaining on the hypervisor.
"""
mem
=
int
(
handl
.
tag_db
[
'
__main__
'
][
'
mem
'
].
value
)
memalloc
=
int
(
handl
.
tag_db
[
'
__main__
'
][
'
memalloc
'
].
value
)
return
mem
-
memalloc
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment