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
9b68a4e7
Commit
9b68a4e7
authored
12 years ago
by
Anael Beutot
Browse files
Options
Downloads
Patches
Plain Diff
Add storage state tag for hypervisor.
parent
2e2d6e5c
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
+4
-2
4 additions, 2 deletions
ccnode/hypervisor/__init__.py
ccnode/hypervisor/lib.py
+10
-0
10 additions, 0 deletions
ccnode/hypervisor/lib.py
with
14 additions
and
2 deletions
ccnode/hypervisor/__init__.py
+
4
−
2
View file @
9b68a4e7
...
@@ -9,7 +9,7 @@ from ccnode.host import Handler as HostHandler
...
@@ -9,7 +9,7 @@ from ccnode.host import Handler as HostHandler
from
ccnode.tags
import
Tag
,
tag_inspector
,
get_tags
from
ccnode.tags
import
Tag
,
tag_inspector
,
get_tags
from
ccnode.hypervisor
import
tags
from
ccnode.hypervisor
import
tags
from
ccnode.hypervisor
import
lib
as
_libvirt
from
ccnode.hypervisor
import
lib
as
_libvirt
from
ccnode.hypervisor.lib
import
EVENTS
,
EventLoop
from
ccnode.hypervisor.lib
import
EVENTS
,
STORAGE_STATES
,
EventLoop
from
ccnode.hypervisor.domains
import
VirtualMachine
from
ccnode.hypervisor.domains
import
VirtualMachine
...
@@ -40,6 +40,7 @@ class Handler(HostHandler):
...
@@ -40,6 +40,7 @@ class Handler(HostHandler):
# register hypervisor storage tags
# register hypervisor storage tags
for
name
,
storage
in
self
.
hypervisor
.
storage
.
storages
.
iteritems
():
for
name
,
storage
in
self
.
hypervisor
.
storage
.
storages
.
iteritems
():
for
t
in
(
for
t
in
(
Tag
(
'
sto%s_state
'
%
name
,
lambda
:
storage
.
state
,
5
),
Tag
(
'
sto%s_size
'
%
name
,
lambda
:
storage
.
capacity
,
5
),
Tag
(
'
sto%s_size
'
%
name
,
lambda
:
storage
.
capacity
,
5
),
Tag
(
'
sto%s_free
'
%
name
,
lambda
:
storage
.
available
,
5
),
Tag
(
'
sto%s_free
'
%
name
,
lambda
:
storage
.
available
,
5
),
Tag
(
'
sto%s_used
'
%
name
,
Tag
(
'
sto%s_used
'
%
name
,
...
@@ -224,7 +225,8 @@ class Storage(object):
...
@@ -224,7 +225,8 @@ class Storage(object):
self
.
uuid
=
lv_storage
.
UUID
()
self
.
uuid
=
lv_storage
.
UUID
()
self
.
name
=
lv_storage
.
name
()
self
.
name
=
lv_storage
.
name
()
self
.
capacity
,
self
.
allocation
,
self
.
available
=
lv_storage
.
info
()[
1
:]
self
.
state
,
self
.
capacity
,
self
.
allocation
,
self
.
available
=
lv_storage
.
info
()
self
.
state
=
STORAGE_STATES
[
self
.
state
]
self
.
volumes
=
map
(
self
.
volumes
=
map
(
partial
(
Volume
,
storage
=
self
),
partial
(
Volume
,
storage
=
self
),
...
...
This diff is collapsed.
Click to expand it.
ccnode/hypervisor/lib.py
+
10
−
0
View file @
9b68a4e7
...
@@ -30,6 +30,16 @@ DOMAIN_STATES = (
...
@@ -30,6 +30,16 @@ DOMAIN_STATES = (
)
)
STORAGE_STATES
=
(
'
inactive
'
,
'
building
'
,
'
running
'
,
'
degraded
'
,
'
inaccessible
'
,
'
???
'
,
# 5
)
#: libvirt envents
#: libvirt envents
EVENTS
=
(
EVENTS
=
(
'
Added
'
,
'
Added
'
,
...
...
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