VMware Cloud Community
csapl
Contributor
Contributor
Jump to solution

ESXi 4.1 U1: qla2xxx module cannot be unloaded

Hi all,

I'm trying to port an ESX 4.0 kickstart script to install ESXi 4.1 U1 and I'm running into issues unloading the qla2xxx module. We run HP blades which report the local SAS disk as remote disk during installation (as described here http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=102781... ) This can far too easily result in undesired LUN reformatting, if the HBA is not disabled correctly, so the module unload is a second line of defence.

Our current script works fine on ESX 4.0 but given the differences in ESXi I have updated the HBA module unload function in the %pre section of the kickstart as below:

----------------------------------------------------

# !/bin/sh

remove_qla(){
for i in $(vmkload_mod -l | grep qla | awk '{ print $1 }'); do
echo Will unload: $i
esxcfg-module -u $i
vmkload_mod -u $i
sleep 1
done
}

remove_qla

----------------------------------------------------

And to partition we use:

clearpart --firstdisk --overwritevmfs
autopart --firstdisk --overwritevmfs

This added to the ESXi 4.1 U1 kickstart did not work and the 1st LUN was formatted (DEV Lab only so no harm done!).

When the above function is run from a shell script I get:

/tmp # ./unload.sh
Will unload: qla2xxx
Unable to load module qla2xxx: Busy
vmkload_mod: Can not remove module qla2xxx: module symbols in use

I've spent a few days looking at my options and I'm reasonably convinced that qla2xxx module cannot be unloaded, but can't find any doco to prove it.

Can anyone confirm/deny this?

PS My current workaround is to run a different function to check the HBA has been disabled in BIOS and abort the installation by way of reboot if it hasn’t… which isn’t what I consider a good solution but it does the job!

----------------------------------------------------

# If qla module is present abort installation and reboot

check_qla(){

for i in $(vmkload_mod -l | grep qla | awk '{ print $1 }'); do

if [ -n $i ]; then

reboot

fi

done

}

check_qla

----------------------------------------------------

Any other options for my kickstart script?

Cheers.

0 Kudos
1 Solution

Accepted Solutions
nirvy
Commander
Commander
Jump to solution

Hi csapl

Oh I know - sorry, the code was something I had lying around from around 10 months ago embedded in html.  The problem was that it had lost all it's formatting so I had to fix it quickly yesterday and screwed up a section of it.  I've attached a fixed update and edited it to match for 'HP' on the Vendor parameter, though bear in mind if there are multiple devices with a Vendor string of 'HP' this script will just match the first it finds.  You may need to match on several parameters.

Good luck!

View solution in original post

0 Kudos
6 Replies
csapl
Contributor
Contributor
Jump to solution

No update on my original question, but I've created another option for our guys who prefer to disable paths instead of turn off HBA's... this one works for either method where the one in my previous post required the HBA's disabled:

-------------------------------------------------------------------------------------

%pre --unsupported --interpreter=busybox

#!/bin/sh

# If any active SAN paths are found reboot the server.

check_hba(){
esxcfg-scsidevs -a | grep link-up
if [ $? -eq 0 ]; then
   reboot
else
   echo "No active SAN paths found, continue installation"
fi
}

check_hba

-------------------------------------------------------------------------------------

**Warning** As with all scripts you should test in a dev environment before using on servers/LUN's containing production data!

Cheers

0 Kudos
nirvy
Commander
Commander
Jump to solution

If you run esxcli corestorage device list on one of these hosts, is there any differences between your local disks and the remote disks that you might use to identify them during the install?

There are several properties that might help, such as Display Name, Vendor, Model, Revision, etc..

If there are differences you can use, it should be relatively trivial to use the same command in %pre to identify and return the Devfs path for the local disk that you can then insert into the partitioning section of the kickstart

0 Kudos
nirvy
Commander
Commander
Jump to solution

I'll throw this out there incase you do find esxcli useful - attached is a kickstart script that shows how you could use the command output to identify the disk.  I'm by no means a python expert, but it should work...  Smiley Happy

Message was edited by: nirvy - Removed broken script

0 Kudos
csapl
Contributor
Contributor
Jump to solution

Thanks Nirvy,

My problem is our 'local' disks report as remote disks (see the article I linked in my first post... it's a known issue)... so the script won't work for us. But I actually couldn't get it to run no matter what I tried. Seemed to work OK up until the "for arg in args:" loop but after that point kept giving me a key error.

I was going to use ['Vendor'] == 'HP' instead of ['Is Local'] == 'true' but neither works. It doesn't seem to grab each of the 'arg in args' consecutively or put them somewhere in any order I can figure out... but being a python noob I can't figure out how to fix it!

Here's a sample of the output I got when I added some print lines and hashed out the line that was failing:

print dic_device

print "@"

devname = dic_device['Devfs Path']

@

{'Display Name': 'HP Serial Attached SCSI Disk (naa.600508b1001cefdb014a4ed918c01ede)'}
@

{'Size': '69973', 'Display Name': 'HP Serial Attached SCSI Disk (naa.600508b1001cefdb014a4ed918c01ede)'}
@
{'Device Type': 'Direct-Access', 'Size': '69973', 'Display Name': 'HP Serial Attached SCSI Disk (naa.600508b1001cefdb014a4ed918c01ede)'}
@
{'Multipath Plugin': 'NMP', 'Device Type': 'Direct-Access', 'Size': '69973', 'Display Name': 'HP Serial Attached SCSI Disk (naa.600508b1001cefdb014a4ed918c01ede)'}
@
{'Multipath Plugin': 'NMP', 'Device Type': 'Direct-Access', 'Size': '69973', 'Devfs Path': '/vmfs/devices/disks/naa.600508b1001cefdb014a4ed918c01ede', 'Display Name': 'HP Serial Attached SCSI Disk (naa.600508b1001cefdb014a4ed918c01ede)'}
@
{'Vendor': 'HP', 'Devfs Path': '/vmfs/devices/disks/naa.600508b1001cefdb014a4ed918c01ede', 'Device Type': 'Direct-Access', 'Display Name': 'HP Serial Attached SCSI Disk (naa.600508b1001cefdb014a4ed918c01ede)', 'Size': '69973', 'Multipath Plugin': 'NMP'}

(continue for another 20 pages...)

0 Kudos
nirvy
Commander
Commander
Jump to solution

Hi csapl

Oh I know - sorry, the code was something I had lying around from around 10 months ago embedded in html.  The problem was that it had lost all it's formatting so I had to fix it quickly yesterday and screwed up a section of it.  I've attached a fixed update and edited it to match for 'HP' on the Vendor parameter, though bear in mind if there are multiple devices with a Vendor string of 'HP' this script will just match the first it finds.  You may need to match on several parameters.

Good luck!

0 Kudos
csapl
Contributor
Contributor
Jump to solution

Thanks nirvy!

There was an extra indent which I've fixed up (in case anyone uses it thats worse at python than I am) and included the clearpart command as well, but a python script was a great idea and its working in the DEV Lab already.

Thanks again!

0 Kudos