-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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 #34090 from trociny/wip-ceph-erasure-code-tool
tools/erasure-code: new tool to encode/decode files Reviewed-by: Josh Durgin <jdurgin@redhat.com> Reviewed-by: Kefu Chai <kchai@redhat.com>
- Loading branch information
Showing
11 changed files
with
373 additions
and
210 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
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
43 changes: 43 additions & 0 deletions
43
src/test/ceph-erasure-code-tool/test_ceph-erasure-code-tool.sh
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,43 @@ | ||
#!/bin/sh -ex | ||
|
||
TMPDIR=/tmp/test_ceph-erasure-code-tool.$$ | ||
mkdir $TMPDIR | ||
trap "rm -fr $TMPDIR" 0 | ||
|
||
ceph-erasure-code-tool test-plugin-exists INVALID_PLUGIN && exit 1 | ||
ceph-erasure-code-tool test-plugin-exists jerasure | ||
|
||
ceph-erasure-code-tool validate-profile \ | ||
plugin=jerasure,technique=reed_sol_van,k=2,m=1 | ||
|
||
test "$(ceph-erasure-code-tool validate-profile \ | ||
plugin=jerasure,technique=reed_sol_van,k=2,m=1 chunk_count)" = 3 | ||
|
||
test "$(ceph-erasure-code-tool calc-chunk-size \ | ||
plugin=jerasure,technique=reed_sol_van,k=2,m=1 4194304)" = 2097152 | ||
|
||
dd if="$(which ceph-erasure-code-tool)" of=$TMPDIR/data bs=770808 count=1 | ||
cp $TMPDIR/data $TMPDIR/data.orig | ||
|
||
ceph-erasure-code-tool encode \ | ||
plugin=jerasure,technique=reed_sol_van,k=2,m=1 \ | ||
4096 \ | ||
0,1,2 \ | ||
$TMPDIR/data | ||
test -f $TMPDIR/data.0 | ||
test -f $TMPDIR/data.1 | ||
test -f $TMPDIR/data.2 | ||
|
||
rm $TMPDIR/data | ||
|
||
ceph-erasure-code-tool decode \ | ||
plugin=jerasure,technique=reed_sol_van,k=2,m=1 \ | ||
4096 \ | ||
0,2 \ | ||
$TMPDIR/data | ||
|
||
size=$(stat -c '%s' $TMPDIR/data.orig) | ||
truncate -s "${size}" $TMPDIR/data # remove stripe width padding | ||
cmp $TMPDIR/data.orig $TMPDIR/data | ||
|
||
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 was deleted.
Oops, something went wrong.
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,5 @@ | ||
add_executable(ceph-erasure-code-tool | ||
${PROJECT_SOURCE_DIR}/src/osd/ECUtil.cc | ||
ceph-erasure-code-tool.cc) | ||
target_link_libraries(ceph-erasure-code-tool global ceph-common) | ||
install(TARGETS ceph-erasure-code-tool DESTINATION bin) |
Oops, something went wrong.