Captain Jack
星期三 九月 23, 2009
Hacking AI installation process to install OpenSolaris to iSCSI device
First of all, contents in this entry are sort of hacking rather than the OpenSolaris solution to support iSCSI boot device. The final solution will be coming from caiman project rather than here, AFAIK caiman is actively working on the support and the draft plan may be available soon.
Currently OpenSolaris can't be installed to iSCSI boot device with the liveCD, the major issue here is that the iSCSI initiator module is not included in the liveCD. That basically limits the ability to access to the iSCSI target.
However with customizing, or hacking in another word, the AI process, it is not that difficult to experience iSCSI boot with OpenSolaris.
Requirements:
For x86, the build number of OpenSolaris should be 104+, and the machine should have at least two NICs - one to support PXE and the other to support iBFT.
For sparc, the build number of OpenSolaris should be 127+(per current plan), and the machine should have an updated OBP (should be coming out soon) to support iSCSI boot.
Seteps:
1. First an AI server needs to be configured following the AI instruction.
2. Modify the default manifest to specify the iSCSI target info by adding a harmless comment, e.g.,
<!--
iscsi-target-name=iqn.1986-03.com.sun:02:1234567890abcdef
iscsi-target-ip=129.158.144.200
iscsi-lun=1
-->
3. Configure a default 'target_device' in manifest, this can be inserted before the
<ai_pkg_repo_default_authority> section.
<ai_target_device>
<target_device_name>0</target_device_name>
<target_device_install_slice_number>0</target_device_install_slice_number>
</ai_target_device>
4. Also don't forget to specify the iSCSI initiator package along with IDM in the manifest by adding following items into the <ai_install_packages> section.
<pkg name="SUNWiscsi"/>
<pkg name="SUNWiscsidm"/>
5. Customizing(hacking) the auto-installer in the microroot.
In case of x86 and the AI target directory on AI server is /export/home/ai_server, the microroot can be customized in this way.
# cd /export/home/ai_server/boot
# gzcat x86.microroot >/tmp/miniroot
# lofiadm -a /tmp/miniroot
/dev/lofi/1
# mount /dev/lofi/1 /mnt
Then open the /mnt/lib/svc/method/auto-installer with a preferred editor, locate the following paragragh.
===============================================
echo "Automated Installation started" | $TEE_LOGTOCONSOLE
echo "The progress of the Automated Installation can be followed by viewing " \
"the logfile at /tmp/install_log" | $TEE_LOGTOCONSOLE
===============================================
Not this is a shell script to be executed on client side, so here we need to put some customized commands to,
1) Establish the connection to the iSCSI target
2) Identify the iSCSI disk OS name
3) Update the manifest to include the iSCSI disk.
One way to do this would be add following commands just below the above paragraph.
# ========Below will add iscsi configuration for AI client. ============
echo "begin iSCSI configuration..." | $TEE_LOGTOCONSOLE
# get target name
input=`cat $AISC_MANIFEST | grep iscsi-target-name=`
target_name=`echo $input | awk -F"=" '{print$2}' `
# get target ip address
input=`cat $AISC_MANIFEST | grep iscsi-target-ip=`
target_ip=`echo $input | awk -F"=" '{print$2}' `
# get lun number
input=`cat $AISC_MANIFEST | grep iscsi-lun=`
lun=`echo $input | awk -F"=" '{print$2}' `
lun="LUN: $lun"
echo "Destination LUN from manifest is $lun on target $target_name" | $TEE_LOGTOCONSOLE
# add the static-config and enable the discovery
/usr/sbin/iscsiadm add static-config $target_name,$target_ip
/usr/sbin/iscsiadm modify discovery -s enable
# wait here for a while
sleep 10
/usr/sbin/devfsadm -C
sleep 30
/usr/sbin/iscsiadm list target -S >/tmp/client_target.out
test=`cat /tmp/client_target.out | grep "$lun" | wc -l`
if [ $test = "0" ] ; then
echo "can't find $lun on target $target_name" | $TEE_LOGTOCONSOLE
exit $SMF_EXIT_ERR_FATAL
fi
# get the os device name of the LUN
i=`sed -n -e /"$lun"/= /tmp/client_target.out`
line=`expr "$i" "+" 3`
string=`sed -n -e ${line}p /tmp/client_target.out`
tmp=`echo ${string} | awk -F"/" '{print$4}' `
name=`echo $tmp | sed 's/..$//' `
echo "Get $name from local disk table for installation" | $TEE_LOGTOCONSOLE
# replace the device name in the manifest
cat $AISC_MANIFEST | sed "s+<target_device_name>.+<target_device_name>${name}+" >/tmp/ai_combined_manifest.xml.2
mv /tmp/ai_combined_manifest.xml.2 $AISC_MANIFEST
echo "iSCSI configuration completes" | $TEE_LOGTOCONSOLE
# =============end of getting iscsi configuration ==================
6. Save the script and umount/delete the lofi device.
# umount /mnt
# lofiadm -d /dev/lofi/1
7. Repack and replace the microroot.
# gzip miniroot
# mv miniroot.gz /export/home/ai_server/boot/x86.microroot
Now go ahead to install the client, good luck!

Posted at 02:25上午 九月 23, 2009 by jackmeng in Tech@Sun | 评论[2]
Guidance for installing Solaris Nevada CE Sparc to iSCSI device
Installation Guide For Sparc - Solaris SXCE
Basically the install process is very similar to the process of installing Solaris x86 onto iSCSI disk. The biggest difference is the way to configure different firmware, as before booting to Solaris, x86 platform will be relying on iBFT-capable firmware (BIOS) to communicate with the iSCSI target, while Sparc platform will be relying on OBP to do the almost same thing.
Before proceeding, please make sure the system is running OBP version >= 4.31 and the command 'show-iscsi' is available.
Prerequisites
Collecting following items before starting the installation, some of them will be used during
the installation process, and may also be a part of the boot argument to 'boot' command in OBP.
* iSCSI Target IP/Port
* Router/Gateway IP if the iSCSI Target is on a different subnet
* Which ethernet interface to be used to access the iSCSI target
* Lun number which will be used as the root disk
Installation Process
The installation process is very similar to the x86 case as described in an earlier post, for
both the cd/network installation and desktop/console session. However a few items are needed to be collected for later use to boot the OS.
* Target Name
* Root Slice if it is not 'a' as default
Also, specifying chap via 'iscsiadm' if authentication is setup in target side. For detailed steps please refer to the Chap. 14 of System Administration Guide: Devices and File Systems.
Postinstall Configuration
A special boot device argument needs to be composed to perform iSCSI boot in OBP, which is in the format of,
'net:key=value[,...]'
The following keys are used to support iSCSI boot,
iscsi-target-ip <Required> iSCSI Target IP address
iscsi-target-name <Required> iSCSI Target Name
host-ip <Required> Host IP address
router-ip <Optional> The gateway IP address. It may not be necessary if the host and the iSCSI target are within the same subnet.
iscsi-lun <Optional> The lun unit number required by iscsi boot. It is a hexadecimal dash-separated format, defaults to 0. A example of the fully specified number would be 2-0-0-0, however usually it is specified as '2'.
iscsi-port <Optional> iSCSI target IP port. It is a decimal formatted integer from 1 to 65535, defaults to 3260.
iscsi-partition <Optional> The bootable partition on the iscsi target, defaults to "a".
If you have used the CHAP as the authentication method, you can set the CHAP user name and password as follows in OK mode:
{0} ok set-ascii-security-key chap-user <your chap name>
{0} ok set-ascii-security-key chap-password <your chap secret>
Note, bidirectional authentication is not available here.
An example of the full argument would be,
net:iscsi-target-name=iqn.1986-03.com.sun:2510.600a0b800049c94d00000000493c920b,host-ip=10.13.49.129,iscsi-lun=3-0-0-0,iscsi-target-ip=10.13.49.145,router-ip=10.13.49.1
An dev alias is probably preferred for such an argument, and then passed to the 'boot' command in OBP.
Posted at 01:34上午 九月 23, 2009 by jackmeng in Tech@Sun | 评论[0]

