Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6657 from kylinstorage/wip-rbd-nbd
rbd-nbd: network block device (NBD) support for RBD Reviewed-by: Jason Dillaman <dillaman@redhat.com>
- Loading branch information
Showing
21 changed files
with
1,307 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
usr/bin/rbd-nbd | ||
usr/share/man/man8/rbd-nbd.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
:orphan: | ||
|
||
========================================= | ||
rbd-nbd -- map rbd images to nbd device | ||
========================================= | ||
|
||
.. program:: rbd-nbd | ||
|
||
Synopsis | ||
======== | ||
|
||
| **rbd-nbd** [-c conf] [--nbds_max *limit*] [--read-only] [--device *nbd device*] map *image-spec* | *snap-spec* | ||
| **rbd-nbd** unmap *nbd device* | ||
| **rbd-nbd** list-mapped | ||
Description | ||
=========== | ||
|
||
**rbd-nbd** is a client for RADOS block device (rbd) images like rbd kernel module. | ||
It will map a rbd image to a nbd (Network Block Device) device, allowing access it | ||
as regular local block device. | ||
|
||
Options | ||
======= | ||
|
||
.. option:: -c ceph.conf | ||
|
||
Use *ceph.conf* configuration file instead of the default | ||
``/etc/ceph/ceph.conf`` to determine monitor addresses during startup. | ||
|
||
.. option:: --nbds_max *limit* | ||
|
||
Override the parameter of NBD kernel module when modprobe, used to | ||
limit the count of nbd device. | ||
|
||
Image and snap specs | ||
==================== | ||
|
||
| *image-spec* is [*pool-name*]/*image-name* | ||
| *snap-spec* is [*pool-name*]/*image-name*\ @\ *snap-name* | ||
The default for *pool-name* is "rbd". If an image name contains a slash | ||
character ('/'), *pool-name* is required. | ||
|
||
Availability | ||
============ | ||
|
||
**rbd-nbd** is part of Ceph, a massively scalable, open-source, distributed storage system. Please refer to | ||
the Ceph documentation at http://ceph.com/docs for more information. | ||
|
||
|
||
See also | ||
======== | ||
|
||
:doc:`rbd <rbd>`\(8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash -ex | ||
|
||
pool=rbd | ||
gen=$pool/gen | ||
data=testfile | ||
size=64 | ||
dev=/dev/nbd0 | ||
|
||
mkdir -p rbd_nbd_test | ||
pushd rbd_nbd_test | ||
|
||
function expect_false() | ||
{ | ||
if "$@"; then return 1; else return 0; fi | ||
} | ||
|
||
rbd remove $gen || true | ||
rbd-nbd unmap $dev || true | ||
|
||
#read test | ||
dd if=/dev/urandom of=$data bs=1M count=$size | ||
rbd --no-progress import $data $gen | ||
rbd-nbd --device $dev map $gen | ||
[ "`dd if=$data bs=1M | md5sum`" != "`dd if=$dev bs=1M | md5sum`" ] && false | ||
|
||
#write test | ||
dd if=/dev/urandom of=$data bs=1M count=$size | ||
dd if=$data of=$dev bs=1M | ||
sync | ||
[ "`dd if=$data bs=1M | md5sum`" != "`rbd --no-progress export $gen - | md5sum`" ] && false | ||
|
||
#trim test | ||
mkfs.ext4 $dev # better idea? | ||
sync | ||
info=`rbd du $gen | tail -n 1` | ||
[ "`echo $info | awk '{print $2}'`" == "`echo $info | awk '{print $3}'`" ] && false | ||
|
||
rbd-nbd unmap $dev | ||
popd | ||
rm -rf rbd_nbd_test | ||
|
||
echo OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.