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

Bug#495042: debian-installer: add iscsi root installation



Hi,

Bumping an old feature request.

On Thursday, August 14, 2008 09:42:31 AM you wrote:
> Add iscsi root installation feature to debian installer. 

I was wondering if there were any plans to add this?


Did experiment a bit with it myself, and it's not that much work to simply 
detect the iSCSI settings set in the BIOS/boot firmware, and connect to the 
iSCSI target automatically, like CentOS and Windows do.

See the attached (unpolished) patches as a starting point of a way this can be 
done.


In short what is necessary is:

- check for the presence of an iBFT table in memory. This can be done by 
loading the iscsi_ibft kernel module and checking /sys.
  Since it only scans a memory region and does not do any more agressive 
probing, it's safe to load by default.

- if found, it means iSCSI is configured on the computer and the other iscsi 
kernel modules should be loaded. As well as an udeb with the open-scsi 
usermode tools that are responsible for setting up the connection. Calling 
"iscsistart -b" is enough to automatically connect to the target using the 
information found in the iBFT and attach the disks.

- make sure open-iscsi is added to the packages to be installed, and that a 
initramfs with iscsi support is created, so that the system will start after 
reboot.


-- 
Yours sincerely,

Floris Bos
diff -ur hw-detect-1.87.orig/debian/disk-detect.templates hw-detect-1.87/debian/disk-detect.templates
--- hw-detect-1.87.orig/debian/disk-detect.templates	2011-06-23 21:57:17.000000000 +0200
+++ hw-detect-1.87/debian/disk-detect.templates	2011-07-13 01:10:41.000000000 +0200
@@ -42,3 +42,13 @@
 Description: for internal use; can be preseeded
  Check for the presence of multipath devices?
 
+Template: disk-detect/iscsi_connect
+Type: text
+# :sl2:
+_Description: Connecting to iSCSI target
+
+Template: disk-detect/iscsi_error
+Type: error 
+# :sl2:
+_Description: Error connecting to iSCSI target (using the login information found in the iBFT)
+ 
diff -ur hw-detect-1.87.orig/disk-detect.sh hw-detect-1.87/disk-detect.sh
--- hw-detect-1.87.orig/disk-detect.sh	2011-06-23 21:57:17.000000000 +0200
+++ hw-detect-1.87/disk-detect.sh	2011-07-13 01:24:09.000000000 +0200
@@ -120,10 +120,31 @@
 	fi
 }
 
+iscsi_probe() {
+
+	log "Looking for iSCSI iBFT table..."   
+	modprobe iscsi_ibft || true 
+
+	if [ -e /sys/firmware/ibft/target0 ]; then
+		anna-install open-iscsi-udeb
+		modprobe iscsi_tcp
+		db_progress START 0 1 disk-detect/iscsi_connect
+		iscsistart -b || db_input high disk-detect/iscsi_error 
+		db_progress STOP	
+		apt-install open-iscsi || true
+	else
+		log "No iSCSI iBFT table found, not loading iSCSI package"
+	fi
+
+	return 0
+}
+
 if ! hw-detect disk-detect/detect_progress_title; then
 	log "hw-detect exited nonzero"
 fi
 
+iscsi_probe
+
 while ! disk_found; do
 	CHOICES=""
 	for mod in $(list_disk_modules | sort); do
diff -ur kernel-wedge-2.77.orig/modules/scsi-modules kernel-wedge-2.77/modules/scsi-modules
--- kernel-wedge-2.77.orig/modules/scsi-modules	2011-03-12 19:38:58.000000000 +0100
+++ kernel-wedge-2.77/modules/scsi-modules	2011-07-11 20:03:03.000000000 +0200
@@ -26,3 +26,5 @@
 aic94xx ?
 stex ?
 xen-blkfront ?
+iscsi_tcp ?
+iscsi_ibft ?
diff -urN open-iscsi-2.0.871.3.orig/debian/control open-iscsi-2.0.871.3/debian/control
--- open-iscsi-2.0.871.3.orig/debian/control	2011-05-02 20:52:46.000000000 +0200
+++ open-iscsi-2.0.871.3/debian/control	2011-07-11 19:31:03.000000000 +0200
@@ -28,6 +28,15 @@
  The userspace component consists of a daemon, iscsid and a management
  utility, iscsiadm
 
+Package: open-iscsi-udeb
+Architecture: any
+Section: debian-installer
+XC-Package-Type: udeb
+Depends: ${shlibs:Depends}, ${misc:Depends}, scsi-modules, libnss-files-udeb 
+Description: Open-iSCSI initiator
+ .
+ For use by debian-installer.
+
 #Package: linux-iscsi-modules-source
 #Architecture: all
 #Depends: ${shlibs:Depends}, ${misc:Depends}, module-assistant, debhelper (>= 4.0.0), bzip2
diff -urN open-iscsi-2.0.871.3.orig/debian/extra/initramfs.hook open-iscsi-2.0.871.3/debian/extra/initramfs.hook
--- open-iscsi-2.0.871.3.orig/debian/extra/initramfs.hook	2011-05-02 20:52:46.000000000 +0200
+++ open-iscsi-2.0.871.3/debian/extra/initramfs.hook	2011-07-13 01:02:57.000000000 +0200
@@ -26,6 +26,6 @@
 cp /etc/iscsi/initiatorname.iscsi $DESTDIR/etc
 cp /etc/iscsi/iscsi.initramfs $DESTDIR/etc
 
-for x in crc32c libcrc32c iscsi_tcp libiscsi scsi_transport_iscsi; do
+for x in crc32c libcrc32c iscsi_tcp iscsi_ibft libiscsi scsi_transport_iscsi; do
 	manual_add_modules ${x}
 done
diff -urN open-iscsi-2.0.871.3.orig/debian/open-iscsi-udeb.dirs open-iscsi-2.0.871.3/debian/open-iscsi-udeb.dirs
--- open-iscsi-2.0.871.3.orig/debian/open-iscsi-udeb.dirs	1970-01-01 01:00:00.000000000 +0100
+++ open-iscsi-2.0.871.3/debian/open-iscsi-udeb.dirs	2011-07-11 23:20:22.000000000 +0200
@@ -0,0 +1,5 @@
+usr/bin
+usr/sbin
+var/lib/open-iscsi
+usr/lib/finish-install.d
+etc/iscsi
diff -urN open-iscsi-2.0.871.3.orig/debian/open-iscsi-udeb.finish-install open-iscsi-2.0.871.3/debian/open-iscsi-udeb.finish-install
--- open-iscsi-2.0.871.3.orig/debian/open-iscsi-udeb.finish-install	1970-01-01 01:00:00.000000000 +0100
+++ open-iscsi-2.0.871.3/debian/open-iscsi-udeb.finish-install	2011-07-13 01:02:25.000000000 +0200
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+#
+# We are using iSCSI as root so make sure it is in the initramfs
+#
+
+echo 'ISCSI_AUTO=true' > /target/etc/iscsi/iscsi.initramfs
+in-target update-initramfs -uv
+
+exit 0
+
diff -urN open-iscsi-2.0.871.3.orig/debian/rules open-iscsi-2.0.871.3/debian/rules
--- open-iscsi-2.0.871.3.orig/debian/rules	2011-05-02 20:52:46.000000000 +0200
+++ open-iscsi-2.0.871.3/debian/rules	2011-07-11 23:36:40.000000000 +0200
@@ -91,6 +91,16 @@
 	install -m 755 debian/extra/initramfs.local-top \
 		$(CURDIR)/debian/open-iscsi/usr/share/initramfs-tools/scripts/local-top/iscsi
 
+	# debian/open-iscsi-udeb
+	install -m 755 usr/iscsiadm $(CURDIR)/debian/open-iscsi-udeb/usr/bin
+	install -m 755 usr/iscsid $(CURDIR)/debian/open-iscsi-udeb/usr/sbin
+	install -m 755 usr/iscsistart $(CURDIR)/debian/open-iscsi-udeb/usr/sbin
+	install -m 755 utils/iscsi_discovery $(CURDIR)/debian/open-iscsi-udeb/usr/sbin
+	install -m 755 utils/iscsi-iname $(CURDIR)/debian/open-iscsi-udeb/usr/sbin
+	install -m 644 debian/initiatorname.iscsi $(CURDIR)/debian/open-iscsi-udeb/etc/iscsi/initiatorname.iscsi
+	install -m 600 etc/iscsid.conf $(CURDIR)/debian/open-iscsi-udeb/etc/iscsi
+	install -m 755 debian/open-iscsi-udeb.finish-install $(CURDIR)/debian/open-iscsi-udeb/usr/lib/finish-install.d/10open-iscsi
+
 	dh_install -s
 
 # Must not depend on anything. This is to be called by

Reply to: