Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
storagedriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6220467b
authored
Jun 23, 2016
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename util.py --> ceph.py, copy ceph.py from vmdriver
parent
b5f38f5c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
32 deletions
+2
-32
disk.py
+1
-1
storagedriver.py
+1
-1
util.py
+0
-30
No files found.
disk.py
View file @
6220467b
...
...
@@ -16,7 +16,7 @@ import requests
import
rbd
from
rbd
import
InvalidArgument
,
ImageNotFound
from
util
import
CephConnection
from
ceph
import
CephConnection
logger
=
logging
.
getLogger
(
__name__
)
...
...
storagedriver.py
View file @
6220467b
from
disk
import
Disk
,
CephDisk
from
util
import
CephConnection
from
ceph
import
CephConnection
from
storagecelery
import
celery
import
os
from
os
import
unlink
,
statvfs
,
listdir
...
...
util.py
deleted
100644 → 0
View file @
b5f38f5c
import
rados
import
os
class
CephConnection
:
def
__init__
(
self
,
pool_name
,
ceph_config
=
None
):
self
.
pool_name
=
pool_name
self
.
ceph_config
=
ceph_config
self
.
cluster
=
None
self
.
ioctx
=
None
def
__enter__
(
self
):
try
:
if
self
.
ceph_config
is
None
:
self
.
ceph_config
=
os
.
getenv
(
"CEPH_CONFIG"
,
"/etc/ceph/ceph.conf"
)
self
.
cluster
=
rados
.
Rados
(
conffile
=
self
.
ceph_config
)
self
.
cluster
.
connect
(
timeout
=
2
)
self
.
ioctx
=
self
.
cluster
.
open_ioctx
(
self
.
pool_name
)
except
rados
.
InterruptedOrTimeoutError
as
e
:
raise
Exception
(
e
)
return
self
def
__exit__
(
self
,
type
,
value
,
traceback
):
self
.
ioctx
.
close
()
self
.
cluster
.
shutdown
()
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