VxRail 7.0 – Shut-down Via API
The VxRail REST API provides a programmatic interface for performing VxRail administrative tasks. There are many ways to interact with the VxRail API functions, in this example I cover the […]
Virtualization & Storage
The VxRail REST API provides a programmatic interface for performing VxRail administrative tasks. There are many ways to interact with the VxRail API functions, in this example I cover the […]
The VxRail REST API provides a programmatic interface for performing VxRail administrative tasks. There are many ways to interact with the VxRail API functions, in this example I cover the Shutdown API function using 3 different methods:
Each example will detail a shutdown dryrun & an actual cluster shutdown.
From VxRail code version 7.0.350 we have migrated to a new interface based on spotlight with greater capabilities. To access the native API client navigate to the following URL replacing <VxM> with the VxRail Manager FQDN/IP (No need for a special API client):
https://<VxRail_Manager_IP_or_FQDN>/rest/vxm/api-doc.html
Expanding ‘cluster shutdown’ API function we click on ‘Shut down a cluster or perform a shutdown dry run’, best practice is to perform a dryrun and remediate any encountered issues before proceeding. In the body section replace false with true to activate a dryrun, enter your SSO creds and click ‘Send Request’:
The request was accepted ‘202 Accepted’ and we now have a request id associated with the task, we can use this ID to track progress via the get request API:
Note:
Get the request status:
Example response:
200 OK
{ "id": "3efe835d-5f89-4197-9223-4ab572ceaf1a", "owner": "CLUSTER_SHUTDOWN", "state": "COMPLETED", "progress": 100, "start_time": 1666345433469, "extension": { "id": "1da7c85e-0549-4017-a3f1-e59377e0d751", "passed": true, "status": [ { "ignorable": true, "label": "Check and ensure that cluster health monitoring is on.", "message": "Success", "checkResult": "PASSED" }, { "ignorable": true, "label": "Check and ensure that the host(s) aren't in maintenance mode", "message": "Success", "checkResult": "PASSED" }, { "ignorable": true, "label": "Check and ensure that the hosts are connected", "message": "Success", "checkResult": "PASSED" }, { "ignorable": false, "label": "Check and ensure that all customer virtual machines have been shut down", "message": "Success", "checkResult": "PASSED" }, { "ignorable": true, "label": "Check and ensure that File Service is disabled", "message": "Success", "checkResult": "PASSED" }, { "ignorable": true, "label": "Check and ensure that current cluster have no TANZU service.", "message": "Success", "checkResult": "PASSED" }, { "ignorable": true, "label": "Check and ensure that all virtual machines on client cluster have been power off.", "message": "Success", "checkResult": "PASSED" }, { "ignorable": true, "label": "Check and ensure that the time is synchronized between multiple hosts", "message": "Success", "checkResult": "PASSED" }, { "ignorable": true, "label": "Check and ensure that no host is locked down.", "message": "Success", "checkResult": "PASSED" }, { "ignorable": true, "label": "Check and ensure that vSAN is in health state.", "message": "Success", "checkResult": "PASSED" }, { "ignorable": true, "label": "Check and ensure that cluster resync is not ongoing.", "message": "Success", "checkResult": "PASSED" } ] }}
Proceeding with an actual cluster shutdown (“dryrun”: false):
Monitoring progress through the get all requests API using string state in (‘FAILED’,’IN_PROGRESS’) and vSphere UI:
Confirm shutdown status in the VxRail manager web.log:
/var/log/mystic # cat web.log | grep “cluster shutdown: true”
2022-10-21 09:58:34.350+0000 INFO [ForkJoinPool.commonPool-worker-3] com.emc.mystic.manager.web.service.ClusterShutdownServiceImpl ClusterShutdownServiceImpl.lambda$shutdown$0:76 – cluster shutdown: true
Following example details how to use the VxRail API Powershell Module to perform the shutdown procedure. VxRail API functions are exposed via PowerShell commands, more info on the VxRail Powershell API Module can be found here:
Beginning with a shutdown Dryrun:
Start-ClusterShutdown -Server <VxM> -Username administrator@vsphere.local -Password pw -Dryrun
Monitoring progress through the get request API:
Proceeding with a actual cluster shutdown:
cd /var/log/mystic/
cat web.log | grep "cluster shutdown: true"
2022-10-21 14:43:25.340+0000 INFO [ForkJoinPool.commonPool-worker-3] com.emc.mystic.manager.web.service.ClusterShutdownServiceImpl ClusterShutdownServiceImpl.lambda$shutdown$0:76 – cluster shutdown: true
Using a CURL cmd from a VxRail Manager SSH console, initiating a Dryrun:
curl -k --request POST \
-u "administrator@vsphere.local:password" --url https://10.2.0.20/rest/vxm/v1/cluster/shutdown \
--header 'Content-Type: application/json' \
--data '{
"dryrun": true
}'
Monitor the request ID using CURL:
curl -k --request GET \
-u "administrator@vsphere.local:PASSWORD" --url https://10.2.0.20/rest/vxm/v1/requests/2c9cfb2c-8275-41d8-b469-cdff73145735 \
--header 'Content-Type: application/json'
Proceeding with a actual cluster shutdown:
curl -k --request POST \
-u "administrator@vsphere.local:password" --url https://10.2.0.20/rest/vxm/v1/cluster/shutdown \
--header 'Content-Type: application/json' \
--data '{
"dryrun": false
}'
Monitor the request ID using CURL:
curl -k --request GET \
-u "administrator@vsphere.local:password" --url https://10.2.0.20/rest/vxm/v1/requests/90e8801e-56f9-42ea-9742-302c473d0b80 \
--header 'Content-Type: application/json'
Hope the above examples were useful! Please always refer to the official Dell documentation.
Ramblings by Keith Lee
Discussions about all things VxRail.
Random Technology thoughts from an Irish Virtualization Geek (who enjoys saving the world in his spare time).
Musings of a VMware Cloud Geek
Converged and Hyper Converged Infrastructure
'Scamallach' - Gaelic for 'Cloudy' ...
Storing data and be awesome
Best Practices et al
Every Cloud Has a Tin Lining.