ESXi 5.0 now supports a new feature called Host Cache which allows a user to offload the virtual machine's swap onto a local SSD device for performance, this can be very helpful for VMware View deployments or other VDI type deployments on vSphere 5.
Currently this is a manual process in which a VMFS volume must be created on an local SSD device and then configured to be used as a Host Cache datastore under the host configuration section. There are two ways of automating this whether this is done during the kickstart process which I am a fan of or as part of a post install process.
In the first option, the process involves formatting and creating a VMFS volume on a local SSD devices and using a little python to connect to the vSphere MOB to perform the host cache configuration. Here is a snippet of what the kickstart would look like as part of the %firstboot section:
The script uses the partedUtil to format the local SSD and then using vmkfstools to put a VMFS volume and then finally connecting to the vSphere MOB to configure host cache.
In the second option, I wrote a vSphere SDK for Perl script hostCacheManagement.pl using the vSphere APIs to manage and configure host cache datastores after an ESXi 5 host has been built. The script supports three options: list, enable and disable and will also validate that datastore being specified are SSD datastores.
Download the hostCacheManagement.pl script here.
Here is an example of listing all SSD datastores and whether or not they are being used for host caching:
Here is an example of enabling an SSD datastore for host cache:
Note: Make sure your "--swapsize" is less than or equal to the size of your SSD datastore else an error will be thrown. VMFS does take up some space for its metadata/etc.
Here is an example of disabling an SSD datastore for host cache:
Here is an example if you try to specify a non-SSD datastore, an error will be thrown: