Skip to content

Commit fcd1203

Browse files
Merge pull request #2082 from falconizmi/fix/rclone-symlink-eloop
Fix rclone mover crash on PVCs with symlinks
2 parents 44ebe86 + a60c034 commit fcd1203

4 files changed

Lines changed: 27 additions & 3 deletions

File tree

mover-rclone/active.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fi
7777
START_TIME=$SECONDS
7878
case "${DIRECTION}" in
7979
source)
80-
find "${MOUNT_PATH}" -path "${MOUNT_PATH}/lost+found" -prune -o -print | getfacl -P - > /tmp/permissions.facl
80+
find "${MOUNT_PATH}" -path "${MOUNT_PATH}/lost+found" -prune -o -not -type l -print | getfacl -P - > /tmp/permissions.facl
8181
rclone sync "${RCLONE_FLAGS_SYNC[@]}" --exclude "lost+found/**" "${MOUNT_PATH}" "${RCLONE_CONFIG_SECTION}:${RCLONE_DEST_PATH}" --log-level DEBUG
8282
rclone copy "${RCLONE_FLAGS_COPY[@]}" --include permissions.facl /tmp "${RCLONE_CONFIG_SECTION}:${RCLONE_DEST_PATH}" --log-level DEBUG
8383
;;

test-e2e/roles/compare_pvc_data/templates/job.yml.j2

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ spec:
3838

3939
echo "... all file contents matched"
4040

41+
{% if not skip_symlink_check | default(false) %}
4142
echo "Validating symlinks: PVC1 -> PVC2"
4243
find /mnt -type l | { grep -v lost+found || true; } | sort | while IFS= read -r f; do
4344
f2=$(echo "$f" | sed 's|^/mnt/|/mnt2/|')
@@ -64,13 +65,24 @@ spec:
6465
done
6566

6667
echo "... all symlinks matched"
68+
{% else %}
69+
echo "Skipping symlink validation (skip_symlink_check=true)"
70+
{% endif %}
6771

6872
echo "File attributes:"
73+
{% if skip_symlink_check | default(false) %}
74+
find /mnt -not -type l -exec stat -c "{{ properties_to_verify }}" {} \; | \
75+
{% else %}
6976
find /mnt -exec stat -c "{{ properties_to_verify }}" {} \; | \
77+
{% endif %}
7078
grep -v lost+found | \
7179
sort | tee /tmp/attributes-mnt
7280
sed -ri 's|/mnt|/mnt2|' /tmp/attributes-mnt
81+
{% if skip_symlink_check | default(false) %}
82+
find /mnt2 -not -type l -exec stat -c "{{ properties_to_verify }}" {} \; | \
83+
{% else %}
7384
find /mnt2 -exec stat -c "{{ properties_to_verify }}" {} \; | \
85+
{% endif %}
7486
grep -v lost+found | \
7587
sort > /tmp/attributes-mnt2
7688

test-e2e/test_rclone_normal.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,18 @@
4747
requests:
4848
storage: 1Gi
4949

50-
- name: Write data into the source PVC
50+
- name: Write data and symlinks into the source PVC
5151
include_role:
5252
name: write_to_pvc
5353
vars:
5454
data: 'data'
5555
path: '/datafile'
5656
pvc_name: 'data-source'
57+
symlinks:
58+
- path: '/mysql.sock'
59+
target: '/var/run/mysqld/mysqld.sock'
60+
- path: '/link-relative'
61+
target: 'datafile'
5762

5863
- name: Sync data from source volume (w/ mSC)
5964
kubernetes.core.k8s:
@@ -242,3 +247,4 @@
242247
pvc1_name: data-source
243248
pvc2_name: data-dest
244249
timeout: 900
250+
skip_symlink_check: true

test-e2e/test_rclone_priv.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,18 @@
5050
requests:
5151
storage: 1Gi
5252

53-
- name: Write data into the source PVC
53+
- name: Write data and symlinks into the source PVC
5454
include_role:
5555
name: write_to_pvc
5656
vars:
5757
data: 'data'
5858
path: '/datafile'
5959
pvc_name: 'data-source'
60+
symlinks:
61+
- path: '/mysql.sock'
62+
target: '/var/run/mysqld/mysqld.sock'
63+
- path: '/link-relative'
64+
target: 'datafile'
6065

6166
- name: Sync data from source volume
6267
kubernetes.core.k8s:
@@ -184,3 +189,4 @@
184189
pvc1_name: data-source
185190
pvc2_name: data-dest
186191
timeout: 900
192+
skip_symlink_check: true

0 commit comments

Comments
 (0)