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
cf89ed48
Commit
cf89ed48
authored
7 years ago
by
Antoine Millet
Browse files
Options
Downloads
Patches
Plain Diff
Added a way to handle ceph storages without refreshing them
parent
5f24a255
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cloudcontrol/node/hypervisor/lib.py
+51
-3
51 additions, 3 deletions
cloudcontrol/node/hypervisor/lib.py
with
51 additions
and
3 deletions
cloudcontrol/node/hypervisor/lib.py
+
51
−
3
View file @
cf89ed48
...
...
@@ -293,6 +293,9 @@ class EventLoop(object):
class
StorageIndex
(
object
):
"""
Keep an index of all storage volume paths.
"""
SHARED_TYPES
=
[
'
rbd
'
]
def
__init__
(
self
,
handler
,
lv_con
):
"""
:param handler: Hypervisor handler instance
...
...
@@ -319,7 +322,11 @@ class StorageIndex(object):
self
.
storages
[
lv_storage
.
name
()].
update
(
retry
)
else
:
# add storage pool
s
=
Storage
(
lv_storage
)
storage_type
=
et
.
ElementTree
().
parse
(
StringIO
(
lv_storage
.
XMLDesc
(
0
))).
get
(
'
type
'
)
if
storage_type
in
self
.
SHARED_TYPES
:
s
=
SharedStorage
(
lv_storage
)
else
:
s
=
Storage
(
lv_storage
)
self
.
storages
[
s
.
name
]
=
s
# add tags
self
.
handler
.
tag_db
.
add_tags
((
...
...
@@ -416,7 +423,6 @@ class StorageIndex(object):
class
Storage
(
object
):
"""
Storage abstraction.
"""
SHARED_TYPES
=
[
'
rbd
'
]
REFRESH_RETRY_INTERVAL
=
1
def
__init__
(
self
,
lv_storage
):
...
...
@@ -438,7 +444,7 @@ class Storage(object):
@property
def
is_shared
(
self
):
return
True
if
self
.
type
in
Storage
.
SHARED_TYPES
else
False
return
False
def
update
(
self
,
retry
=
1
):
for
_
in
xrange
(
retry
):
...
...
@@ -473,6 +479,36 @@ class Storage(object):
StringIO
(
self
.
lv_storage
.
XMLDesc
(
0
))).
get
(
'
type
'
)
class
SharedStorageVolumeDispenser
(
object
):
def
__init__
(
self
,
storage
):
self
.
storage
=
storage
def
get
(
self
,
name
):
return
SharedVolume
(
self
.
storage
,
name
)
def
itervalues
(
self
):
return
iter
([])
class
SharedStorage
(
Storage
):
"""
Shared storage abstraction.
"""
def
__init__
(
self
,
lv_storage
):
"""
:param lv_storage: Libvirt pool storage instance
"""
super
(
SharedStorage
,
self
).
__init__
(
lv_storage
)
self
.
volumes
=
SharedStorageVolumeDispenser
(
self
)
@property
def
is_shared
(
self
):
return
True
def
update
(
self
,
retry
=
1
):
pass
# Do nothing.
class
Volume
(
object
):
"""
Volume abstraction.
"""
def
__init__
(
self
,
storage
,
lv_volume
):
...
...
@@ -490,6 +526,18 @@ class Volume(object):
self
.
capacity
,
self
.
allocation
=
self
.
lv_volume
.
info
()[
1
:]
class
SharedVolume
(
object
):
"""
Shared volume abstraction.
"""
def
__init__
(
self
,
storage
,
name
):
self
.
storage
=
storage
self
.
path
,
self
.
capacity
,
self
.
allocation
=
None
,
None
,
None
self
.
name
=
name
self
.
lv_volume
=
None
def
update
(
self
):
pass
# Do nothing.
class
BoundVolumeProxy
(
object
):
"""
Proxy object to an existing Volume when its bound to a VM.
"""
...
...
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