When it is time to patch, upgrade or service an ESXi host running VSAN, the first thing you will want to do is to place the host into Maintenance Mode. If you have never performed this operation on a VSAN host before, you should be aware that there is a new option to specify how the data for VSAN will be migrated. Below is a screenshot of the three options provided when using the vSphere Web Client.
To learn more about the new VSAN data migration option, I highly recommend you check out Cormac Hogan's blog article here which goes into more detail. From a vSphere API point of view, the Maintenance Mode operation is still being provided by the traditional EnterMaintenanceMode_Task() method, but there is now a new optional property called HostMaintenanceSpec that specifies the option (exposed as an enum) to use for VSAN data migration. To demonstrate this functionality, I have created a sample vSphere SDK for Perl script called vsanHostMaintenanceMode.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.
The script requires three input parameters:
- vihost - Name of the ESXi host to perform the maintance mode operaton
- operation - The operation to perform [enter|exit]
- mode - The VSAN data migration policy [ensure|evac|no]
Here is an example of placing an ESXi host into Maintenance Mode using the "Ensure Accessibility" VSAN data migration option:
./vsanHostMaintenanceMode.pl --server vcenter55-1.primp-industries.com --username root --vihost vesxi55-1.primp-industries.com --operation enter --mode ensure
To take the ESXi host out of Maintance Mode, you can run the following command:
./vsanHostMaintenanceMode.pl --vcenter55-1.primp-industries.com --username root --vihost vesxi55-1.primp-industries.com --operation exit
- 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
Thanks for the comment!