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>
43 lines
2.4 KiB
Bash
43 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
|
# Save a completed run, then release only this isolated test project's volumes.
|
|
set -Eeuo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
compose=(docker compose -p cephmig-million -f dev/compose.yaml -f dev/compose.million.yaml)
|
|
python3 - <<'PY'
|
|
import json,pathlib
|
|
s=json.loads(pathlib.Path('.dev/million/main/status.json').read_text())
|
|
if s.get('result') != 'PASS':
|
|
raise SystemExit('Refusing cleanup: independent million-file verification has not passed')
|
|
PY
|
|
# PASS is written just before the independent writer shuts down.
|
|
exit_code=$(docker wait cephmig-million-benchmark-1)
|
|
[[ $exit_code = 0 ]] || { echo "Benchmark exited $exit_code; retaining diagnostics" >&2; exit 1; }
|
|
mkdir -p .dev/million/summary
|
|
for cluster in source target; do
|
|
"${compose[@]}" exec -T "$cluster" ceph df --format json > ".dev/million/summary/$cluster-capacity.json"
|
|
"${compose[@]}" exec -T "$cluster" ceph health detail --format json > ".dev/million/summary/$cluster-health.json"
|
|
"${compose[@]}" exec -T "$cluster" python3 -c '
|
|
import os,json
|
|
s=os.stat("/state/osd/block")
|
|
print(json.dumps(dict(logical_bytes=s.st_size,allocated_bytes=s.st_blocks*512)))' > ".dev/million/summary/$cluster-host-allocation.json"
|
|
done
|
|
docker inspect cephmig-million-benchmark-1 --format '{{.Image}}' > .dev/million/native-image.txt
|
|
python3 - <<'PY'
|
|
import datetime,json,pathlib
|
|
root=pathlib.Path('.dev/million/main')
|
|
def read(name): return json.loads((root/name).read_text())
|
|
def sample(name): return json.loads((pathlib.Path('.dev/million/summary')/name).read_text())
|
|
result=dict(status=read('status.json'),migration=read('migration-state.json'),
|
|
phases={phase:read(phase+'.metrics.json') for phase in ('initial','catchup','final')},
|
|
ceph_capacity={c:sample(c+'-capacity.json') for c in ('source','target')},
|
|
ceph_health={c:sample(c+'-health.json') for c in ('source','target')},
|
|
host_osd_allocation={c:sample(c+'-host-allocation.json') for c in ('source','target')},
|
|
image=pathlib.Path('.dev/million/native-image.txt').read_text().strip(),
|
|
recorded_at=datetime.datetime.now(datetime.timezone.utc).isoformat())
|
|
pathlib.Path('docs/million-local.json').write_text(json.dumps(result,indent=2)+'\n')
|
|
print('Saved docs/million-local.json')
|
|
PY
|
|
"${compose[@]}" down --volumes
|
|
df -B1 . > .dev/million/host-after-cleanup.txt
|
|
echo 'PASS: results saved; isolated million-file cluster storage released.'
|