Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Support multipath root / boot device #853

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 2 additions & 0 deletions images/00-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ RUN apk --no-cache add \
# replicate the default "no idea, friend" behavior of virt-what
&& touch /usr/sbin/virt-what \
&& chmod +x /usr/sbin/virt-what

COPY multipath.conf /etc/multipath.conf
13 changes: 13 additions & 0 deletions images/00-base/multipath.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
defaults {
find_multipaths "yes"
user_friendly_names "yes"
}
blacklist_exceptions {
property "(SCSI_IDENT_|ID_WWN)"
}
blacklist {
device {
vendor "VMware"
product "Virtual disk"
}
}
1 change: 1 addition & 0 deletions images/10-kernel-stage1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RUN apt-get --assume-yes update \
lz4 \
rsync \
xz-utils \
multipath-tools-boot \
&& echo 'r8152' >> /etc/initramfs-tools/modules \
&& echo 'hfs' >> /etc/initramfs-tools/modules \
&& echo 'hfsplus' >> /etc/initramfs-tools/modules \
Expand Down
6 changes: 6 additions & 0 deletions overlay/libexec/k3os/boot
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ setup_services()
ln -s /etc/init.d/$i /etc/runlevels/sysinit
done

if [ "$K3OS_MODE" = "local" ]; then
for i in udev-trigger multipath multipathd; do
ln -s /etc/init.d/$i /etc/runlevels/sysinit
done
fi

for i in acpid hwclock syslog bootmisc hostname sysctl modules connman dbus haveged issue; do
ln -s /etc/init.d/$i /etc/runlevels/boot
done
Expand Down
16 changes: 16 additions & 0 deletions overlay/libexec/k3os/mode-disk
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,22 @@ takeover()
fi
}

### For boot from SAN, we need to ensure that the multipath devices are setup
### while termporarily in mode=disk so that the mount & pivot_root for mode=local
### will be the proper multipath device (rather than a single path)
setup_multipath()
{
modprobe dm-multipath
udevd -d
udevadm settle
udevadm trigger --type=devices --action=add
udevadm settle
multipath -v3
udevadm settle
udevadm control --exit
Comment on lines +156 to +161
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't dealt with multi-path directly (other than including the libs way back when to make openebs and longhorn work correctly iirc). This seems rather ... delicate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we probably can (and should) add more testing around these particular steps.

With that said though, I don't think that everyone will want extra packages and/or modules continuing to bloat the size -- I think I've seen a similar comment here before about not wanting to keep adding more and more packages when most/many people don't want them. The value here is tracking how to make it work, in one place, sharing the info for those that do need it. However maybe this is a build-time decision via a flag/switch/etc? Then somewhere in the docs we could list such flags and explain what they impact. Additionally, for common ones maybe you could provide alternative builds directly for download.

}

setup_multipath
setup_mounts
setup_k3os
setup_kernel_squashfs
Expand Down