Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASMINST-3798: handle the metal-nowipe=1 case for SQFS handling #22

Merged
merged 1 commit into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.1
1.9.2
20 changes: 12 additions & 8 deletions 90metalmdsquash/metal-md-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ fetch_sqfs() {
(
set -e
cd "$1"
curl ${metal_ipv4:+-4} -O "${metal_server}/${squashfs_file}" > /dev/null 2>&1 && echo >2 "${squashfs_file} downloaded ... "
curl ${metal_ipv4:+-4} -O "${metal_server}/kernel" > /dev/null 2>&1 && echo >2 'grabbed the kernel it rode in on ... '
curl ${metal_ipv4:+-4} -O "${metal_server}/${initrd}" > /dev/null 2>&1 && echo >2 'and its initrd ... '
curl ${metal_ipv4:+-4} -O "${metal_server}/${squashfs_file}" > /dev/null 2>&1 && echo "${squashfs_file} downloaded ... " > debug_log
curl ${metal_ipv4:+-4} -O "${metal_server}/kernel" > /dev/null 2>&1 && echo 'grabbed the kernel it rode in on ... ' >> debug_log
curl ${metal_ipv4:+-4} -O "${metal_server}/${initrd}" > /dev/null 2>&1 && echo 'and its initrd ... ' >> debug_log
) || warn 'Failed to download ; may retry'
else
# File support; copy the authority to tmp; tmp auto-clears on root-pivot.
Expand All @@ -246,9 +246,9 @@ fetch_sqfs() {
(
set -e
cd "$1"
cp -pv "/tmp/source/${metal_local_dir#//}/${squashfs_file}" . && echo >2 "copied ${squashfs_file} ... "
cp -pv "/tmp/source/${metal_local_dir#//}/kernel" . && echo >2 'grabbed the kernel we rode in on ... '
cp -pv "/tmp/source/${metal_local_dir#//}${initrd}" . && echo >2 'and its initrd ... '
cp -pv "/tmp/source/${metal_local_dir#//}/${squashfs_file}" . && echo "copied ${squashfs_file} ... " > debug_log
cp -pv "/tmp/source/${metal_local_dir#//}/kernel" . && echo 'grabbed the kernel we rode in on ... ' >> debug_log
cp -pv "/tmp/source/${metal_local_dir#//}${initrd}" . && echo 'and its initrd ... ' >> debug_log
) || warn 'Failed to copy ; may retry'
umount /tmp/source
fi
Expand Down Expand Up @@ -282,13 +282,17 @@ add_sqfs() {
fi
fi
mkdir -pv $sqfs_store
if mount -n -t xfs /dev/md/SQFS $sqfs_store; then
# if metal-nowipe=1, this will already exist
if mount -n -t xfs -L "${sqfs_drive_authority}" $sqfs_store; then
# nothing to do
umount $sqfs_store
return
elif mount -n -t xfs /dev/md/SQFS $sqfs_store; then
mkdir -pv "$sqfs_store/$live_dir"
fetch_sqfs "$sqfs_store/$live_dir" || metal_die 'Failed to fetch squashFS into squashFS storage!'
umount $sqfs_store
xfs_admin -L "${sqfs_drive_authority}" /dev/md/SQFS
else

# No RAID mount, issue warning, delete mount-point and return
metal_die "Failed to mount /dev/md/SQFS at $sqfs_store"
fi
Expand Down