Browse Source

iscsi/nbd: do not try to mount the whole disk, if root= is missing

only mount the whole disk for root=dhcp
master
Harald Hoyer 11 years ago
parent
commit
fa9384b1c0
  1. 11
      modules.d/95iscsi/iscsiroot.sh
  2. 2
      modules.d/95nbd/nbdroot.sh

11
modules.d/95iscsi/iscsiroot.sh

@ -40,14 +40,6 @@ modprobe crc32c 2>/dev/null
[ -e /sys/module/bnx2i ] && iscsiuio [ -e /sys/module/bnx2i ] && iscsiuio


if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
if [ -z "$root" -o -n "${root%%block:*}" ]; 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 for p in $(getargs rd.iscsi.param -d iscsi_param); do
iscsi_param="$iscsi_param --param $p" iscsi_param="$iscsi_param --param $p"
done done
@ -55,6 +47,7 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
iscsistart -b $iscsi_param iscsistart -b $iscsi_param
echo 'started' > "/tmp/iscsistarted-iscsi" echo 'started' > "/tmp/iscsistarted-iscsi"
echo 'started' > "/tmp/iscsistarted-firmware" echo 'started' > "/tmp/iscsistarted-firmware"
need_shutdown
exit 0 exit 0
fi fi


@ -137,7 +130,7 @@ handle_netroot()


# FIXME $iscsi_protocol?? # FIXME $iscsi_protocol??


if [ -z "$root" -o -n "${root%%block:*}" ]; then if [ "$root" = "dhcp" ]; then
# if root is not specified try to mount the whole iSCSI LUN # 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 printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
udevadm control --reload udevadm control --reload

2
modules.d/95nbd/nbdroot.sh

@ -97,7 +97,7 @@ done


# If we didn't get a root= on the command line, then we need to # If we didn't get a root= on the command line, then we need to
# add the udev rules for mounting the nbd0 device # add the udev rules for mounting the nbd0 device
if [ -z "$root" -o -n "${root%%block:*}" -o "$root" = "block:/dev/root" ]; then if [ "$root" = "block:/dev/root" -o "$root" = "dhcp" ]; then
printf 'KERNEL=="nbd0", ENV{DEVTYPE}!="partition", ENV{ID_FS_TYPE}=="?*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-nbd-root.rules printf 'KERNEL=="nbd0", ENV{DEVTYPE}!="partition", ENV{ID_FS_TYPE}=="?*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-nbd-root.rules
udevadm control --reload udevadm control --reload
type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh

Loading…
Cancel
Save