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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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
SnapshotManager
import
Volume
import
openstack
import
StorageManager
class
OpenstackS
napshotManager
(
SnapshotManager
.
Snapshot
Manager
):
class
OpenstackS
torageManager
(
StorageManager
.
Storage
Manager
):
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
os_volume_to_rc_volume
(
os_volume
):
return
Volume
.
Volume
(
os_volume
.
id
,
os_volume
.
size
,
os_volume
.
is_bootable
)
def
create
_from_volume
(
self
,
id
):
os_
snapshot
=
self
.
openstack
.
block_storage
.
create_snapshot
(
volume_id
=
id
)
def
create
(
self
,
size
,
bootable
):
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
):
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
):
snapshot
s
=
[]
volume
s
=
[]
for
os_
snapshot
in
self
.
openstack
.
block_storage
.
snapshot
s
():
snapshots
.
append
(
self
.
os_snapshot_to_rc_snapshot
(
os_snapshot
))
for
os_
volume
in
self
.
openstack
.
block_storage
.
volume
s
():
volumes
.
append
(
self
.
os_volume_to_rc_volume
(
os_volume
))
return
snapshot
s
return
volume
s
def
delet
e
(
self
,
id
):
p
rint
(
self
.
openstack
.
block_storage
.
delete_snapshot
(
id
))
def
resiz
e
(
self
,
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