make iSCSI boot with root=dhcp and mount partitions labeled with "ROOT"
authorHarald Hoyer <harald@redhat.com>
Fri, 19 Jun 2009 10:11:21 +0000 (12:11 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 19 Jun 2009 11:00:00 +0000 (13:00 +0200)
or "/"

modules.d/95iscsi/iscsiroot
modules.d/99base/install
test/TEST-30-ISCSI/dhcpd.conf
test/TEST-30-ISCSI/test.sh

index e273fc5..783306b 100755 (executable)
@@ -118,6 +118,14 @@ echo "InitiatorName='$iscsi_initiator'" > /dev/.initiatorname.iscsi
 
 # FIXME $iscsi_lun?? $iscsi_protocol??
 
+# if root does not specify a block device
+# we set a fallback to recognize any filesystems labeled 
+# LABEL=/ or LABEL=ROOT
+if [ "${root#block:*}" = "$root" ]; then
+    ( root="block:/dev/disk/by-label/\x2f" . /pre-udev/30-block-genrules.sh )
+    ( root="block:/dev/disk/by-label/ROOT" . /pre-udev/30-block-genrules.sh )
+fi
+
 iscsistart -i $iscsi_initiator -t $iscsi_target_name   \
     -g $iscsi_target_group -a $iscsi_target_ip \
     -p $iscsi_target_port \
index 68d40fb..06cf6db 100755 (executable)
@@ -7,9 +7,8 @@ fi
 # install our scripts and hooks
 inst "$moddir/init" "/init"
 # Bail out if switch_root does not exist
-if [ ! -x "$moddir/switch_root" ]; then
-    # assume it is installed in the standard path
-    dracut_install switch_root
+if which switch_root >/dev/null 2>&1; then
+    dracut_install switch_root 
 else
     inst "$moddir/switch_root" "/sbin/switch_root"
 fi
index 515922a..6eb035b 100644 (file)
@@ -15,7 +15,7 @@ subnet 192.168.50.0 netmask 255.255.255.0 {
        # NFSv3: last octect starts at 0x00 and works up
 
        group {
-               option root-path "iscsiroot=192.168.50.1::::test";
+               option root-path "iscsi:192.168.50.1::::iqn.2009-06.dracut:target0";
 
                host iscsi-1 {
                        hardware ethernet 52:54:00:12:34:00;
index 134ee73..a6833bf 100755 (executable)
@@ -37,7 +37,7 @@ run_client() {
        -net nic,macaddr=52:54:00:12:34:00,model=e1000 \
        -net socket,mcast=230.0.0.1:1234 \
        -kernel /boot/vmlinuz-$KVERSION \
-       -append "root=LABEL=ROOT netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 rw quiet console=ttyS0,115200n81 $DEBUGFAIL" \
+       -append "root=dhcp rw quiet console=ttyS0,115200n81 $DEBUGFAIL" \
        -initrd initramfs.testing
     grep -m 1 -q iscsi-OK client.img || return 1
 }