In addition to having a minimum of one SSD and one HDD to contribute to the VSAN Cluster, an ESXi host must also have a VMkernel interface that is enabled for VSAN traffic. In the vSphere Web Client, this is done by going into each ESXi host and under the Networking section and editing the VMkernel adapter to allow for a particular traffic type.
From a vSphere API perspective, this operation is actually exposed at the vSphere Cluster level which took me by surprised since enabling the other types of VMkernel traffic type is done else where. You will need to use the ReconfigureComputeResource_Task() method and specify a list of ESXi hosts using spec->vsanHostConfigSpec->HostSystem and list of VMkernel adapters that you wish to enable VSAN traffic type on using spec->vsanHostConfigSpec->networkInfo->port->device. The neat thing about doing it at the cluster level is you only need to make a single API call versus having to go to each and every ESXi host. To demonstrate the above operation, I have created a vSphere SDK for Perl sample script called vsanHostTrafficTypeMgmt.pl
Disclaimer: These scripts are provided for informational and educational purposes only. It should be thoroughly tested before attempting to use in a production environment.
To check the current VSAN configuration for a given vSphere Cluster, you can run the “query” operation:
./vsanHostTrafficTypeMgmt.pl --server vcenter55-1.primp-industries.com --username root --cluster VSAN-Cluster --operation query
To simplify the sample script, as part of the "enable" operation, I have added a --vihost option which requires you to specify a particular ESXi host in which you wish to enable VSAN traffic type. You will also need to provide the --vmk option to specify the list of VMkernel interfaces you wish to enable VSAN traffic type.
./vsanHostTrafficTypeMgmt.pl --server vcenter55-1.primp-industries.com --username root --cluster VSAN-Cluster --operation enable --vihost vesxi55-1.primp-industries.com --vmk vmk0
We can now re-run our "query" operation and we should now see that all of our ESXi hosts have vmk0 enabled with VSAN traffic type:
- Exploring VSAN APIs Part 1 – Enable VSAN Cluster
- Exploring VSAN APIs Part 2 – Query available SSDs
- Exploring VSAN APIs Part 3 – Enable VSAN Traffic Type
- Exploring VSAN APIs Part 4 – VSAN Disk Mappings
- Exploring VSAN APIs Part 5 – VSAN Host Status
- Exploring VSAN APIs Part 6 – Modifying Virtual Machine VM Storage Policy
- Exploring VSAN APIs Part 7 – VSAN Datastore Folder Management
- Exploring VSAN APIs Part 8 – Maintenance Mode
- Exploring VSAN APIs Part 9 – VSAN Component count
- Exploring VSAN APIs Part 10 – VSAN Disk Health