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
2e2d6e5c
Commit
2e2d6e5c
authored
12 years ago
by
Anael Beutot
Browse files
Options
Downloads
Patches
Plain Diff
Storage tag on hypervisor.
parent
e87831a4
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
ccnode/hypervisor/__init__.py
+13
-1
13 additions, 1 deletion
ccnode/hypervisor/__init__.py
ccnode/hypervisor/tags.py
+2
-3
2 additions, 3 deletions
ccnode/hypervisor/tags.py
with
15 additions
and
4 deletions
ccnode/hypervisor/__init__.py
+
13
−
1
View file @
2e2d6e5c
...
...
@@ -6,7 +6,7 @@ from itertools import chain, imap
import
libvirt
from
ccnode.host
import
Handler
as
HostHandler
from
ccnode.tags
import
tag_inspector
,
get_tags
from
ccnode.tags
import
Tag
,
tag_inspector
,
get_tags
from
ccnode.hypervisor
import
tags
from
ccnode.hypervisor
import
lib
as
_libvirt
from
ccnode.hypervisor.lib
import
EVENTS
,
EventLoop
...
...
@@ -37,6 +37,16 @@ class Handler(HostHandler):
self
.
hypervisor
=
weakref
.
proxy
(
hypervisor
)
# register hypervisor storage tags
for
name
,
storage
in
self
.
hypervisor
.
storage
.
storages
.
iteritems
():
for
t
in
(
Tag
(
'
sto%s_size
'
%
name
,
lambda
:
storage
.
capacity
,
5
),
Tag
(
'
sto%s_free
'
%
name
,
lambda
:
storage
.
available
,
5
),
Tag
(
'
sto%s_used
'
%
name
,
lambda
:
storage
.
capacity
-
storage
.
available
,
5
),
):
self
.
tags
[
t
.
name
]
=
t
# register domains
proxy
=
kwargs
.
pop
(
'
proxy
'
)
for
dom
in
hypervisor
.
domains
.
itervalues
():
...
...
@@ -214,6 +224,8 @@ class Storage(object):
self
.
uuid
=
lv_storage
.
UUID
()
self
.
name
=
lv_storage
.
name
()
self
.
capacity
,
self
.
allocation
,
self
.
available
=
lv_storage
.
info
()[
1
:]
self
.
volumes
=
map
(
partial
(
Volume
,
storage
=
self
),
(
lv_storage
.
storageVolLookupByName
(
n
)
for
n
in
...
...
This diff is collapsed.
Click to expand it.
ccnode/hypervisor/tags.py
+
2
−
3
View file @
2e2d6e5c
...
...
@@ -55,12 +55,11 @@ def rjobs():
# storage pools
def
sto
():
def
sto
(
handl
):
"""
Storage pool names.
"""
return
u
'
'
.
join
(
handl
.
hypervisor
.
storage
.
storages
.
iterkeys
())
# dynamic sto
# Vm related tags
def
nvm
(
handl
):
"""
Number of VMS in the current hypervisor.
"""
...
...
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