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:

  1. VxRail Manager Embedded (interactive web-based API)
  2. Powershell API modules
  3. CLI using a wrapped CURL command

Each example will detail a shutdown dryrun & an actual cluster shutdown.

1. VxRail Manager Embedded (interactive web-based API)

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:

  • API status Code 200 implies a successful operation.
  • API status Code 202 implies API request accepted for processing, but not completed.

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

2. Powershell API modules

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

3. CLI using a wrapped CURL command

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s