Initial import of the existing CephFS subvolume migration prototype, including the native libcephfs transport, rsync backend, local Ceph lab environment and integration tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
2.5 KiB
Bash
58 lines
2.5 KiB
Bash
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
compose=(docker compose -f dev/compose.yaml)
|
|
count=${FILES:-10000}
|
|
report=${REPORT_DIR:-/tmp/cephmig-smallfiles-report}
|
|
binary=${BINARY:-/usr/local/bin/cephmig-native}
|
|
mkdir -p "$report"
|
|
docker inspect cephmig-dev-native-1 --format '{{.Image}}' > "$report/native-image.txt"
|
|
python3 - "$count" "$binary" "$report/settings.json" <<'PY'
|
|
import json,sys
|
|
with open(sys.argv[3],"w") as f: json.dump(dict(files=int(sys.argv[1]),bytes_per_file=128,workers=4,binary=sys.argv[2]),f)
|
|
PY
|
|
mds_counters() {
|
|
"${compose[@]}" exec -T "$1" ceph daemon mds.a perf dump | python3 -c '
|
|
import json,sys
|
|
d=json.load(sys.stdin)
|
|
s=d["mds_server"]
|
|
print(json.dumps(dict(requests=d["mds"]["request"],**{
|
|
k:s["req_"+k+"_latency"]["avgcount"] for k in ("getattr","lookup","lookupsnap","setattr","readdir")})))'
|
|
}
|
|
df -B1 . > "$report/host-before.txt"
|
|
"${compose[@]}" exec -T source ceph df --format json > "$report/source-before.json"
|
|
"${compose[@]}" exec -T target ceph df --format json > "$report/target-before.json"
|
|
name=$("${compose[@]}" exec -T client python3 /lab/smallfiles.py setup --count "$count")
|
|
printf '%s\n' "$name" > "$report/fixture-name.txt"
|
|
completed=false
|
|
cleanup() {
|
|
if [[ $completed = true ]]; then
|
|
"${compose[@]}" exec -T client python3 /lab/smallfiles.py cleanup "$name"
|
|
else
|
|
echo "FAIL: retained fixture $name; diagnostics at /state/$name" >&2
|
|
fi
|
|
}
|
|
trap cleanup EXIT
|
|
for phase in initial catchup final; do
|
|
if [[ $phase = catchup ]]; then
|
|
"${compose[@]}" exec -T client python3 /lab/smallfiles.py mutate "$name"
|
|
fi
|
|
echo "smallfiles: phase=$phase count=$count"
|
|
for cluster in source target; do
|
|
mds_counters "$cluster" > "$report/$phase-$cluster-mds-before.json"
|
|
done
|
|
"${compose[@]}" exec -T native python3 /lab/smallfiles.py run "$name" --phase "$phase" --binary "$binary" |
|
|
tee "$report/$phase.json"
|
|
for cluster in source target; do
|
|
mds_counters "$cluster" > "$report/$phase-$cluster-mds-after.json"
|
|
done
|
|
done
|
|
"${compose[@]}" exec -T client python3 /lab/smallfiles.py verify "$name" |
|
|
tee "$report/verification.json"
|
|
"${compose[@]}" exec -T native du -sk "/state/$name" > "$report/local-state-kib.txt"
|
|
"${compose[@]}" exec -T source ceph df --format json > "$report/source-after.json"
|
|
"${compose[@]}" exec -T target ceph df --format json > "$report/target-after.json"
|
|
df -B1 . > "$report/host-after.txt"
|
|
completed=true
|
|
echo "PASS: $count small files, snapshots, same-mtime changes, deletes, renames, metadata, links; report=$report"
|