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>
30 lines
985 B
Bash
30 lines
985 B
Bash
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
mkdir -p /mnt/source /mnt/target /mnt/source-fs /mnt/target-fs
|
|
pids=()
|
|
cleanup() {
|
|
trap - EXIT TERM INT
|
|
umount /mnt/source /mnt/target /mnt/source-fs /mnt/target-fs 2>/dev/null || true
|
|
if ((${#pids[@]})); then
|
|
kill "${pids[@]}" 2>/dev/null || true
|
|
wait "${pids[@]}" 2>/dev/null || true
|
|
fi
|
|
}
|
|
trap cleanup EXIT
|
|
trap 'exit 0' TERM INT
|
|
for cluster in source target; do
|
|
ceph-fuse -f -c "/clusters/$cluster/ceph.conf" \
|
|
-k "/clusters/$cluster/ceph.client.admin.keyring" \
|
|
--client-fs cephfs -r "$(cat "/clusters/$cluster/subvolume-path")" \
|
|
"/mnt/$cluster" &
|
|
pids+=("$!")
|
|
done
|
|
# Administrative mount for snapshot getpath results (outside the data UUID).
|
|
for cluster in source target; do
|
|
ceph-fuse -f -c "/clusters/$cluster/ceph.conf" \
|
|
-k "/clusters/$cluster/ceph.client.admin.keyring" --client-fs cephfs "/mnt/$cluster-fs" &
|
|
pids+=("$!")
|
|
done
|
|
wait -n "${pids[@]}"
|
|
exit 1
|