Browse Source

iscsi, nbd: call write_fs_tab() and write /etc/fstab

master
Harald Hoyer 12 years ago
parent
commit
5e1e1ec060
  1. 5
      modules.d/95iscsi/iscsiroot.sh
  2. 4
      modules.d/95iscsi/parse-iscsiroot.sh
  3. 9
      modules.d/95nbd/nbdroot.sh

5
modules.d/95iscsi/iscsiroot.sh

@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@

type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh

PATH=/usr/sbin:/usr/bin:/sbin:/bin

@ -43,6 +44,8 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then @@ -43,6 +44,8 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
# if root is not specified try to mount the whole iSCSI LUN
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
udevadm control --reload
write_fs_tab /dev/root
wait_for_dev /dev/root
fi

for p in $(getargs rd.iscsi.param -d iscsi_param); do
@ -136,6 +139,8 @@ handle_netroot() @@ -136,6 +139,8 @@ handle_netroot()
# if root is not specified try to mount the whole iSCSI LUN
printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
udevadm control --reload
write_fs_tab /dev/root
wait_for_dev /dev/root

# install mount script
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh

4
modules.d/95iscsi/parse-iscsiroot.sh

@ -24,6 +24,8 @@ @@ -24,6 +24,8 @@

[ -n "$iscsiroot" ] && [ -n "$iscsi_firmware" ] && die "Mixing iscsiroot and iscsi_firmware is dangerous"

type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh

# Root takes precedence over netroot
if [ "${root%%:*}" = "iscsi" ] ; then
if [ -n "$netroot" ] ; then
@ -33,6 +35,8 @@ if [ "${root%%:*}" = "iscsi" ] ; then @@ -33,6 +35,8 @@ if [ "${root%%:*}" = "iscsi" ] ; then
# if root is not specified try to mount the whole iSCSI LUN
printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
root=/dev/root

write_fs_tab /dev/root
fi

# If it's not empty or iscsi we don't continue

9
modules.d/95nbd/nbdroot.sh

@ -101,11 +101,14 @@ nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1 @@ -101,11 +101,14 @@ nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1
# add the udev rules for mounting the nbd0 device
root=$(getarg root=)
if [ -z "$root" ] || strstr "$root" "nbd:" || strstr "$root" "dhcp"; then
echo '[ -e /dev/root ] || { info=$(udevadm info --query=env --name=/dev/nbd0); [ -z "${info%%*ID_FS_TYPE*}" ] && { ln -s /dev/nbd0 /dev/root 2>/dev/null; :; };} && rm $job;' \
echo '[ -e /dev/root ] || { info=$(udevadm info --query=env --name=/dev/nbd0); [ -z "${info%%*ID_FS_TYPE*}" ] && { ln -s /dev/nbd0 /dev/root 2>/dev/null; type systemctl >/dev/null 2>&1 && systemctl --no-block start sysroot.mount;:; };} && rm $job;' \
> $hookdir/initqueue/settled/nbd.sh

printf '/bin/mount -t %s -o %s %s %s\n' \
"$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh
write_fs_tab /dev/nbd0 "$nbdfstype" "$fsopts"

printf '/bin/mount %s\n' \
"$NEWROOT" \
> $hookdir/mount/01-$$-nbd.sh
fi


Loading…
Cancel
Save