[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

initramfs-tools patches for AoE



Hey folks,

I'm playing with AoE root on kvm using libvirt.  I wrote a blog post:

http://wp.colliertech.org/cj/?p=678

And I'm putting together a patch against git.  I'd love to have some
input from someone who's fiddled with this package before.

Cheers,

C.J.


diff --git a/conf/initramfs.conf b/conf/initramfs.conf
index 23dd249..8728107 100644
--- a/conf/initramfs.conf
+++ b/conf/initramfs.conf
@@ -40,11 +40,13 @@ KEYMAP=n
 #
 
 #
-# BOOT: [ local | nfs ]
+# BOOT: [ local | nfs | aoe ]
 #
 # local - Boot off of local media (harddrive, USB stick).
 #
-# nfs - Boot using an NFS drive as the root of the drive.
+# nfs - Boot using an NFS export as the root filesystem.
+#
+# aoe - Boot using an AoE export as the root filesystem.
 #
 
 BOOT=local
diff --git a/hook-functions b/hook-functions
index 9d59dc1..216ed68 100644
--- a/hook-functions
+++ b/hook-functions
@@ -378,7 +378,7 @@ auto_add_modules()
 	base)
 		for x in ehci-hcd ohci-hcd uhci-hcd usbhid usb-storage ext2 \
 		ext3 ext4 ext4dev isofs jfs nfs reiserfs udf xfs af_packet \
-		atkbd i8042 virtio_pci; do
+		atkbd i8042 virtio_pci aoe; do
 			manual_add_modules "${x}"
 		done
 	;;
diff --git a/scripts/aoe b/scripts/aoe
new file mode 100644
index 0000000..a3c70f5
--- /dev/null
+++ b/scripts/aoe
@@ -0,0 +1,38 @@
+# NFS filesystem mounting			-*- shell-script -*-
+
+# FIXME This needs error checking
+
+retry_nr=0
+
+# parse nfs bootargs and mount nfs 
+do_aoemount()
+{
+	configure_networking
+        mount ${ROOT} ${rootmnt}
+}
+
+# AoE root mounting
+mountroot()
+{
+	modprobe aoe
+
+	# Default delay is around 180s
+	# FIXME: add usplash_write info
+	if [ -z "${ROOTDELAY}" ]; then
+		delay=180
+	else
+		delay=${ROOTDELAY}
+	fi
+
+        echo > /dev/etherd/discover
+
+	# loop until aoemount succeeds
+	while [ ${retry_nr} -lt ${delay} ] && [ ! -e ${rootmnt}${init} ]; do
+		[ ${retry_nr} -gt 0 ] && \
+		[ "$quiet" != "y" ] && log_begin_msg "Retrying AoE mount"
+		do_aoemount
+		retry_nr=$(( ${retry_nr} + 1 ))
+		[ ! -e ${rootmnt}${init} ] && /bin/sleep 1
+		[ ${retry_nr} -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg
+	done
+}

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: