Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
RECIRCLE
/
interface-openstack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
4
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c167610b
authored
Apr 08, 2019
by
edems
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
real storage manager added
parent
ee20dc12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
19 deletions
+22
-19
implementation/storage/OpenstackStorageManager.py
+22
-19
No files found.
implementation/storage/OpenstackStorageManager.py
View file @
c167610b
import
Snapshot
import
Volume
import
SnapshotManager
import
openstack
import
openstack
import
StorageManager
class
OpenstackS
napshotManager
(
SnapshotManager
.
Snapshot
Manager
):
class
OpenstackS
torageManager
(
StorageManager
.
Storage
Manager
):
def
__init__
(
self
,
cloud
)
->
None
:
def
__init__
(
self
,
cloud
)
->
None
:
super
()
.
__init__
()
super
()
.
__init__
()
self
.
openstack
=
openstack
.
connect
(
cloud
=
cloud
)
self
.
openstack
=
openstack
.
connect
(
cloud
=
cloud
)
@staticmethod
@staticmethod
def
os_snapshot_to_rc_snapshot
(
os_snapshot
):
def
os_volume_to_rc_volume
(
os_volume
):
return
Snapshot
.
Snapshot
(
return
Volume
.
Volume
(
os_snapshot
.
id
,
os_volume
.
id
,
os_snapshot
.
size
os_volume
.
size
,
os_volume
.
is_bootable
)
)
def
create
_from_volume
(
self
,
id
):
def
create
(
self
,
size
,
bootable
):
os_
snapshot
=
self
.
openstack
.
block_storage
.
create_snapshot
(
volume_id
=
id
)
os_
volume
=
self
.
openstack
.
block_storage
.
create_volume
(
size
=
size
,
bootable
=
bootable
)
return
self
.
os_
snapshot_to_rc_snapshot
(
os_snapshot
)
return
self
.
os_
volume_to_rc_volume
(
os_volume
)
def
get
(
self
,
id
):
def
get
(
self
,
id
):
os_snapshot
=
self
.
openstack
.
block_storage
.
get_snapshot
(
id
)
os_volume
=
self
.
openstack
.
block_storage
.
get_volume
(
id
)
return
self
.
os_volume_to_rc_volume
(
os_volume
)
return
self
.
os_snapshot_to_rc_snapshot
(
os_snapshot
)
def
delete
(
self
,
id
):
print
(
self
.
openstack
.
block_storage
.
delete_volume
(
id
))
def
list
(
self
):
def
list
(
self
):
snapshot
s
=
[]
volume
s
=
[]
for
os_
snapshot
in
self
.
openstack
.
block_storage
.
snapshot
s
():
for
os_
volume
in
self
.
openstack
.
block_storage
.
volume
s
():
snapshots
.
append
(
self
.
os_snapshot_to_rc_snapshot
(
os_snapshot
))
volumes
.
append
(
self
.
os_volume_to_rc_volume
(
os_volume
))
return
snapshot
s
return
volume
s
def
delet
e
(
self
,
id
):
def
resiz
e
(
self
,
id
):
p
rint
(
self
.
openstack
.
block_storage
.
delete_snapshot
(
id
))
p
ass
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