Adding an iSCSI LUN
This is used to add a new iSCSI LUN to the SAN.
All of the iSCSI exports on the SAN are currently backed by ZVOL block devices. ZVOLs provide much better performance than using raw datafiles over top of a normal filesystem and are easily expanded and managed using ZFS.
For ease of management, related ZVOLs are typically grouped underneath a ZFS filesystem. First we create the filesystem, then we create each of the ZVOLs beneath it. For most VMs, you will need two ZVOLs; one for the root partition and one for swap.
zfs create apocalypse/vms/ion zfs create -V 15G apocalypse/vms/ion/root zfs create -V 1G apocalypse/vms/ion/swap
iSCSI Exports are currently done using the LIO iSCSI Target managed through Pacemaker. Therefore, we need to add the new LUNs to Pacemaker which will handle bringing them online on the appropriate host.
First you need to generate a unique value for each LUN to use as an SCSI ID. We use the first half of the md5 hash of the LUN's name as a reliably unique value.
echo -n apocalypse-iron-root | md5sum | head -c 16 echo -n apocalypse-iron-swap | md5sum | head -c 16
You will also need a LUN number for each LUN you are adding; these are generally assigned starting from 0 and incrementing with each LUN added. To get the highest numbered LUN currently in the cluster run and read through the configuration.
crm configure show
Now its time to add the LUNs to the cluster configuration. This will be done using a Shadow CIB (a cloned copy of the configuration). This is *IMPORTANT* because if the entire configuration is not added at once, the cluster may behave unexpectedly.
First we create the new Shadow CIB
crm crm(live)# cib crm(live)cib# new ion ##Notice we are now viewing/editting the (ion) configuration not the (live) configuration crm(ion)cib# cd ..
Next we create the iSCSILogicalUnit configurations; make sure to adjust the LUN number, scsi_sn, and path values appropriately.
crm(ion)# configure crm(ion)configure# primitive apocalypse-ion-root ocf:heartbeat:iSCSILogicalUnit \ params implementation="lio" target_iqn="iqn.1992-03.edu.tjhsst:target:apocalypse.0" lun="9" \ path="/dev/zvol/apocalypse/vms/ion/root" scsi_sn="090427202e6db84c" \ op start interval="0" timeout="10s" \ op stop interval="0" timeout="60s" crm(ion)configure# primitive apocalypse-ion-swap ocf:heartbeat:iSCSILogicalUnit \ params implementation="lio" target_iqn="iqn.1992-03.edu.tjhsst:target:apocalypse.0" lun="10" \ path="/dev/zvol/apocalypse/vms/ion/swap" scsi_sn="a5165df4904a7083" \ op start interval="0" timeout="10s" \ op stop interval="0" timeout="60s"
Next, you need to add the new iSCSILogicalUnits to the apocalypse-luns resource group to ensure that they are appropriate managed in conjunction with the rest of the iSCSI system.
crm(ion)configure# edit apocalypse-luns ##The configuration entry for apocalypse-luns will open in EDITOR (usually vim) ##Add apocalypse-ion-root apocalypse-ion-swap to the end of the configuration line just before apocalypseTarget ##When you are done, save and quit the editor (default :wq)
Finally, commit the configuration changes to the Shadow CIB and leave the configuration submenu:
crm(ion)configure# commit crm(ion)configure# cd ..
At this point if you have any questions, now is a very good time to ask someone to double-check your configuration before you crash the SAN. Otherwise, if you are VERY sure you know what you're doing, commit the changes to the live configuration.
crm(ion)# cib crm(ion)cib# commit ion INFO: commited 'ion' shadow CIB to the cluster crm(ion)cib# exit bye
Finally, start the cluster monitor and make sure your new resources have started: