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
78644782
authored
Apr 09, 2019
by
adamtorok
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upgrade
parent
444c3a93
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
implementation/storage/OpenstackSnapshotManager.py
+20
-8
No files found.
implementation/storage/OpenstackSnapshotManager.py
View file @
78644782
import
Snapshot
import
SnapshotManager
import
openstack
from
openstack.exceptions
import
ResourceNotFound
from
interface.storage.Snapshot
import
Snapshot
class
OpenstackSnapshotManager
(
SnapshotManager
.
SnapshotManager
):
def
__init__
(
self
,
cloud
)
->
None
:
def
__init__
(
self
,
os
)
->
None
:
super
()
.
__init__
()
self
.
openstack
=
o
penstack
.
connect
(
cloud
=
cloud
)
self
.
openstack
=
o
s
@staticmethod
def
os_snapshot_to_rc_snapshot
(
os_snapshot
):
return
Snapshot
.
Snapshot
(
return
Snapshot
(
os_snapshot
.
id
,
os_snapshot
.
size
os_snapshot
.
volume_id
,
os_snapshot
.
size
,
os_snapshot
.
status
,
os_snapshot
.
created_at
)
def
create_from_volume
(
self
,
id
):
...
...
@@ -23,7 +27,10 @@ class OpenstackSnapshotManager(SnapshotManager.SnapshotManager):
return
self
.
os_snapshot_to_rc_snapshot
(
os_snapshot
)
def
get
(
self
,
id
):
os_snapshot
=
self
.
openstack
.
block_storage
.
get_snapshot
(
id
)
try
:
os_snapshot
=
self
.
openstack
.
block_storage
.
get_snapshot
(
id
)
except
ResourceNotFound
:
return
None
return
self
.
os_snapshot_to_rc_snapshot
(
os_snapshot
)
...
...
@@ -36,4 +43,9 @@ class OpenstackSnapshotManager(SnapshotManager.SnapshotManager):
return
snapshots
def
delete
(
self
,
id
):
print
(
self
.
openstack
.
block_storage
.
delete_snapshot
(
id
))
try
:
self
.
openstack
.
block_storage
.
delete_snapshot
(
id
)
except
ResourceNotFound
:
return
False
return
True
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