2011/07/05

ESXi modules

Some commando's I always need to lookup so lets gather them a bit

First of all, ESXi modules work a lot like linux. You can find them in a specific location

~ # ls /usr/lib/vmware/vmkmod/bnx*
/usr/lib/vmware/vmkmod/bnx2.o /usr/lib/vmware/vmkmod/bnx2i.o /usr/lib/vmware/vmkmod/bnx2x.o

You can also list the active modules
~ # esxcfg-module -l | grep bnx
bnx2 1 180
bnx2i 0 88

More info about a module can be obtained with the -i switch
~ # esxcfg-module -i bnx2
esxcfg-module module information
input file: /usr/lib/vmware/vmkmod/bnx2.o
License: GPL
Version:
Name-space:
Required name-spaces:
com.vmware.vmkapi@v1_1_0_0
Parameters:
disable_msi: int
Disable Message Signaled Interrupt (MSI)
heap_initial: int
Initial heap size allocated for the driver.
heap_max: int
Maximum attainable heap size for the driver.
skb_heap_initial: int
Initial private socket buffer heap size allocated for the driver.
skb_heap_max: int
Maximum attainable private socket buffer heap size for the driver.
stop_on_tx_timeout: int
For debugging purposes, prevent a chip reset when a tx timeout occurs

You can then get the current options
~ # esxcfg-module -g bnx2
bnx2 enabled = 1 options = ''

Setting an options works with the -s parameter
~ # esxcfg-module -s "oneRequest=false" nfsclient
~ # esxcfg-module -g nfsclient
nfsclient enabled = 1 options = 'oneRequest=false'
~ # esxcfg-module -s "" nfsclient
~ # esxcfg-module -g nfsclient
nfsclient enabled = 1 options = ''

Enabling modules is done by using the -e parameter. To disable a module, you will need the -d switch. Notice, you will need to reboot to get the module enabled this way
~ # ls /usr/lib/vmware/vmkmod/ | grep tg3
tg3.o
~ # esxcfg-module -e tg3
~ # esxcfg-module -d tg3

Esxcfg that a lot of things that the vmkload_mod command does. You can load modules live by using this commando. You will not have to reboot the server
~ # vmkload_mod tg3
Module tg3 loaded successfully
~ # vmkload_mod -u tg3
Module tg3 successfully unloaded

You can also see that the vmkload_mod gives similar output as the esxcfg-module
~ # vmkload_mod -l | grep tg3
tg3 0 120
~ # vmkload_mod -s tg3
vmkload_mod module information
input file: /usr/lib/vmware/vmkmod/tg3.o
Version: Version 3.86.0.1-1vmw, Build: 320137, Interface: ddi_9_1 Built on: Nov 2 2010
License: GPL
Required name-spaces:
com.vmware.vmkapi@v1_1_0_0
Parameters:
skb_heap_max: int
Maximum attainable private socket buffer heap size for the driver.
skb_heap_initial: int
Initial private socket buffer heap size allocated for the driver.
heap_max: int
Maximum attainable heap size for the driver.
heap_initial: int
Initial heap size allocated for the driver.
tg3_debug: int
Tigon3 bitmapped debugging message enable value
~ #

Another fun thing to do with the vmkload_mod is loading the cdrom driver
~ # vmkload_mod iso9660
Module iso9660 loaded successfully

Then you can mount the cdrom with
vsish -e set /vmkModules/iso9660/mount $(esxcfg-mpath -b | grep "CD-ROM" | awk '{print $1}')

You should the see the cdrom mounted in /vmfs/volumes

Unmount it later on
vsish -e set /vmkModules/iso9660/umount $(esxcfg-mpath -b | grep "CD-ROM" | awk '{print $1}')

Afterwards unload the module
~ # vmkload_mod -u iso9660
Module iso9660 successfully unloaded

(CDROM commands are from (http://www.virtuallyghetto.com/2011/04/how-to-mount-cdrom-using-vsish-on-esxi.html)