Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
vmdriver
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
6abcc2f6
authored
May 01, 2016
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ceph: make more robust save() and restore()
parent
104ebd1a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
ceph.py
+7
-3
No files found.
ceph.py
View file @
6abcc2f6
...
@@ -50,8 +50,8 @@ def map_rbd(ceph_path, local_path):
...
@@ -50,8 +50,8 @@ def map_rbd(ceph_path, local_path):
def
save
(
domain
,
poolname
,
diskname
):
def
save
(
domain
,
poolname
,
diskname
):
diskname
=
str
(
diskname
)
diskname
=
str
(
diskname
)
poolname
=
str
(
poolname
)
poolname
=
str
(
poolname
)
ceph_path
=
"
%
s/
%
s"
%
(
poolname
,
diskname
)
ceph_path
=
os
.
path
.
join
(
poolname
,
diskname
)
local_path
=
"/dev/rbd/"
+
ceph_path
local_path
=
os
.
path
.
join
(
"/dev/rbd"
,
ceph_path
)
disk_size
=
DUMP_SIZE_LIMIT
disk_size
=
DUMP_SIZE_LIMIT
with
CephConnection
(
poolname
)
as
conn
:
with
CephConnection
(
poolname
)
as
conn
:
...
@@ -67,13 +67,17 @@ def save(domain, poolname, diskname):
...
@@ -67,13 +67,17 @@ def save(domain, poolname, diskname):
except
:
except
:
rbd_inst
.
remove
(
conn
.
ioctx
,
diskname
)
rbd_inst
.
remove
(
conn
.
ioctx
,
diskname
)
raise
raise
finally
:
sudo
(
"/bin/rbd"
,
"unmap"
,
local_path
)
def
restore
(
connection
,
poolname
,
diskname
):
def
restore
(
connection
,
poolname
,
diskname
):
diskname
=
str
(
diskname
)
diskname
=
str
(
diskname
)
poolname
=
str
(
poolname
)
poolname
=
str
(
poolname
)
local_path
=
"/dev/rbd/
%
s/
%
s"
%
(
poolname
,
diskname
)
ceph_path
=
os
.
path
.
join
(
poolname
,
diskname
)
local_path
=
os
.
path
.
join
(
"/dev/rbd"
,
ceph_path
)
map_rbd
(
ceph_path
,
local_path
)
connection
.
restore
(
local_path
)
connection
.
restore
(
local_path
)
sudo
(
"/bin/rbd"
,
"unmap"
,
local_path
)
sudo
(
"/bin/rbd"
,
"unmap"
,
local_path
)
with
CephConnection
(
poolname
)
as
conn
:
with
CephConnection
(
poolname
)
as
conn
:
...
...
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