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
bbe885fe
authored
Apr 08, 2019
by
adamtorok
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Openstack Storage Manager added
parent
95958bf8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
implementation/storage/OpenstackStorageManager.py
+39
-0
No files found.
implementation/storage/OpenstackStorageManager.py
0 → 100644
View file @
bbe885fe
import
Snapshot
import
SnapshotManager
import
openstack
class
OpenstackSnapshotManager
(
SnapshotManager
.
SnapshotManager
):
def
__init__
(
self
,
cloud
)
->
None
:
super
()
.
__init__
()
self
.
openstack
=
openstack
.
connect
(
cloud
=
cloud
)
@staticmethod
def
os_snapshot_to_rc_snapshot
(
os_snapshot
):
return
Snapshot
.
Snapshot
(
os_snapshot
.
id
,
os_snapshot
.
size
)
def
create_from_volume
(
self
,
id
):
os_snapshot
=
self
.
openstack
.
block_storage
.
create_snapshot
(
volume_id
=
id
)
return
self
.
os_snapshot_to_rc_snapshot
(
os_snapshot
)
def
get
(
self
,
id
):
os_snapshot
=
self
.
openstack
.
block_storage
.
get_snapshot
(
id
)
return
self
.
os_snapshot_to_rc_snapshot
(
os_snapshot
)
def
list
(
self
):
snapshots
=
[]
for
os_snapshot
in
self
.
openstack
.
block_storage
.
snapshots
():
snapshots
.
append
(
self
.
os_snapshot_to_rc_snapshot
(
os_snapshot
))
return
snapshots
def
delete
(
self
,
id
):
print
(
self
.
openstack
.
block_storage
.
delete_snapshot
(
id
))
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