Using the vRealize Suite Lifecycle Manager (vRSLCM) API for vRSLCM Day 2 Operations - Managing Storage



vRealize Suite Lifecycle Manager vRSLCM API

Published on 30 November 2021 by Christopher Lewis. Words: 838. Reading Time: 4 mins.

In this post, we will look at how we can use the VMware vRealize Suite Lifecycle Manager (vRSLCM) API to complete Day 2 Operations in vRSLCM to manage the amount of storage available to the appliance.

We are going to be using cURL to complete API calls to complete the following operation tasks around managing the vRSLCM Storage:

  • Viewing the vRSLCM storage
  • Expanding the available vRSLCM storage

This post is a part of a series that covers how we can install, configure and manage the vRealize Suite using the vRSLCM API.

Prerequisites

The following prerequisites are required for this blog post:

Walkthrough

Viewing the vRSLCM storage

Overview

In this section we are going to be looking at what we need to create an API request to get informaton on the existing storage allocated to store all of those Product ISO and OVA files, including patches, updates and upgrades.

API Request

The following REST API request is required:

  • Request Type: GET
  • Request URL: https://{vrslcm.fqdn}/lcm/lcops/api/v2/settings/system-details/disks
  • Request Header(s):
    • Accept: application/json
    • Content-Type: application/json
    • Authorization: Basic {admin@local credential hash}
  • Request Body Values:
    • None

API Example

An example cURL command for this REST API is:

curl --location --request GET 'https://{vrslcm.fqdn}/lcm/lcops/api/v2/settings/system-details/disks' \
--header 'Authorization: Basic {admin@local credential hash}' \

Note: Remember, the –insecure flag is also required if you are using self-signed SSL certificates.

API Response

When submitting a successful request (Status Code = 200), you should receive a response that shows the following information about the available storage within the vRSLCM appliance:

{
    "vendor": "VMware Inc.",
    "name": "VMware vRealize Suite Life Cycle Manager Appliance",
    "version": "8.6.0.20",
    "patchVersion": "",
    "diskStorageDTO": [
        {
            "diskName": "/root",
            "totalStorage": "8.7G",
            "usedStorage": "1.8G",
            "availableStorage": "6.6G",
            "storagePercentage": "21%"
        },
        {
            "diskName": "/data",
            "totalStorage": "49G",
            "usedStorage": "341M",
            "availableStorage": "47G",
            "storagePercentage": "1%"
        },
        {
            "diskName": "/storage",
            "totalStorage": "9.8G",
            "usedStorage": "99M",
            "availableStorage": "9.2G",
            "storagePercentage": "2%"
        }
    ],
    "properties": {},
    "diskAvailableForUpgrade": true
}

As we can see the currently available storage in /storage is 49GB. Will that be enough for all our ISOs and OVAs? I’mnot sure so let us look at how we can expand it!

Expanding the available vRSLCM storage

Overview

In this section we are going to be using an API request to extend the vRSLCM storage to ensure we have enough space to store all of those Product ISO and OVA files.

Note: The disk size can be expanded as part of the installation of vRSLCM but you may still need additional storage in the future because we do not have a crystal ball!

POST API Request

The following REST API request is required:

  • Request Type: POST
  • Request URL: https://{vrslcm.fqdn}/lcm/lcops/api/v2/settings/system-details/disks/expand
  • Request Header(s):
    • Accept: application/json
    • Content-Type: application/json
    • Authorization: Basic {insert credential hash}
  • Request Body Values:
    • diskSizeInGb - The amount (in GB) that you would like to the vRSLCM appliance disk to be extended by.
    • vCenterHost - the vCenter Server where the vRSLCM appliance is deployed.
    • vcUsername - the vCenter username that has sufficient priviliges in vCenter to expand the disk.
    • vcPassword - the password for the vCenter username. This can be specified as a credential stored in vRSLCM locker (using the format locker:password:{vmid}:{alias}) OR as a plain text password).

Note: You can use a GET API request https://{vrslcm.fqdn}/lcm/locker/api/v2/passwords to retrieve all of the passwords in the vRSLCM locker (assuming you have the rights obviously!). You can then locate the vmid for a particular credential.

API Example

An example cURL command for this REST API is:

curl --location --request POST 'https://{vrslcm.fqdn}/lcm/lcops/api/v2/settings/system-details/disks/expand' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {admin@local credential hash}' \
--data-raw '{
    "diskSizeInGb": 20,
    "vCenterHost": "{vcenter.fqdn}",
    "vcPassword": "locker:password:{vcenter.password.vmid}:{vcenter.password.alias}",
    "vcUsername": "{vcenter.username}"
}'

Note: The –insecure flag is also required if you are using self-signed SSL certificates.

API Response

When submitting that request, a request is created and the API response should be a request ID for you to track. Something similar to:

{
    "requestId": "aa55550d-2548-4b89-b3b2-3a27f920e432"
}

Now we could just log into the UI and locate how the request is progressing, but where is the fun in that? We can track the progress of requests via the API too! Check out Using the vRealize Suite Lifecycle Manager (vRSLCM) API to track vRSLCM Requests for more information!

Once the request is completed, if we logged into the vRSLCM appliance we will see the total storage now is 69GB.

Wrapping It All Up!

In this post we have started to explore the way we can complete Day 2 Operations that manage different aspects of vRSLCM via the API. We first viewed the storage allocated to the vRSLCM Appliance before extending it using the vRSLCM API. Using th API is a a quick and efficient way in which we can interact with the vRSLCM appliance.

If this API this snippet has been helpful, make sure you checkout the rest of the series !

Published on 30 November 2021 by Christopher Lewis. Words: 838. Reading Time: 4 mins.