skip to Main Content

Tintri Blog

For Developers: Dealing with VMstore Pool Recommendations

August 25, 2016

There has been a lot written about Tintri’s VM Scale-out feature, but nothing has been written about how to use the VM-Scale-out APIs. This blog is going to correct this.

If you’re unfamiliar with Tintri’s VM scale-out, I recommend this excellent blog, Tintri VM Scale-Out Explained in Detail.

One of the features of VM scale-out is the recommendation. Currently you have to check for the recommendation in the TGC GUI. What if you could get the recommendation from a command, or send e-mail about the information, or execute the recommendation automatically? If those questions intrigues you, then read on, because I have created a Python script,, that answers the question.

Basically scans all the VMstore pools. If there is a recommendation available, it gets the issues, the action groups, and the outcomes. The recommendation is accepted if the a script input flag is set. Also, e-mail can be sent that summarizes the recommendation. Let’s look at this code:

reco_available = False

    pools = get_pools(server_name, session_id)

    # For each pool, get the current recommendation

    for pool in pools:
        reco = get_current_reco(server_name, session_id, pool)

        buffer("Pool: " + pool.get_name() + ": " + reco["state"])
        if (reco["state"] == "NO_RECOMMENDATION_NEEDED"):
        if (reco["state"] == "AVAILABLE"):

            get_outcomes(server_name, session_id, reco)
            reco_available = True


    if accept_reco:
        for pool in pools:
            if reco["state"] == "AVAILABLE" and pool.get_reco_uuid():
                execute_reco(server_name, session_id, pool)
                buffer("Accepted and executed recommendation for pool " + pool.get_name())


except tintri.TintriRequestsException as tre:
except tintri.TintriApiException as tae:

All the output is placed into output_text with the buffer() function. This allows the output to go to stdout and e-mail if selected.

Let’s look at the first function get_pools() which obtains information on all VMstore pools. The GET v310/vmstorePool API is invoked. The pool information is returned as a Page. For each pool, the pool name and UUID is used to create a VmstorePool object. This new object is appended to a list of pools, and this list of pools is returned to the caller.

# Return the the VMstore pools from a TGC server.

def get_pools(server, tgc_sess_id):
    vmstore_pools = []

    url = "/v310/vmstorePool"
    r = tintri.api_get(server, url, tgc_sess_id)
    print_debug("The JSON response of the get invoke to the server " +
                server + " is: " + r.text)

    vm_paginated_result = r.json()
    num_pools = int(vm_paginated_result["filteredTotal"])
    if (num_pools) == 0:
        raise tintri.TintriRequestsException("No VMstore Pools present")

    # Load up the pools
    items = vm_paginated_result["items"]
    for pool in items:
        print_info(pool["name"] + ": " + pool["uuid"]["uuid"])
        vmstore_pool = VmstorePool(pool["name"], pool["uuid"]["uuid"])

    return vmstore_pools

Getting the current recommendation is done in get_current_reco(). This is done with the GET /v310/vmstorePool/{poolUUID/recommendation/current API. A recommendation object is returned and examined by the caller.

# Get the current recommendation

def get_current_reco(server, tgc_sess_id, pool):
    print_debug("Looking for recommendation on pool " + pool.get_name())
    reco_url = "/v310/vmstorePool/" + pool.get_uuid() + "/recommendation/current"

    r = tintri.api_get(server, reco_url, tgc_sess_id)
    print_debug("The JSON response of the reco get invoke to the server " +
                server + " is: " + r.text)
    reco = r.json()

    return reco

The next bits of code extract information from the recommendation object. First the issues. There are 3 types of issues: flash, IOPs, and space. The function, get_issues() returns the issues type and summary from the recommendation object. A recommendation can have multiple issues. Next, the function get_action_groups() collects the recommendation actions. Multiple action groups can also be in a recommendation as well. Finally the outcomes are collected in get_outcomes(). These are outcomes if the recommendation is accepted.

After collecting all the recommendation information, it is accepted if the input parameter --accept is specified. The recommendation acceptance is done in the execute_reco() which invokes the POST /v310/vmstorePool/{poolUUID}/recommendation/{recoUUID}/accept.

# Execute and accept the recommendation

def execute_reco(server, tgc_sess_id, pool):
    reco_url = "/v310/vmstorePool/" + pool.get_uuid() + "/recommendation/" + 
               pool.get_reco_uuid() + "/accept"
    r = tintri.api_post(server, reco_url, None, tgc_sess_id)

All the recommendation information is printed to stdout. If a recommendation is available, and an e-mail address is specified, then the recommendation information is emailed to the specified address.

Since analysis for recommendations are preformed at 6:00 am and 6:00 pm, this script could run in a cron job after 6:15 am and 6:15 pm. With the e-mail feature, you won’t have to check the TGC for recommendations. The code is located on our Tintri GitHub.

And finally there are some outside people that were impressed with VM scale-out. Duncan Epping’s Yellow Bricks blog, Playing around with Tintri Global Center and Tintri storage systems , is an objective review from the VM point of view. Howard Marks mentions VM scale-out in his blog, Scale out Architectures, which discusses different scale out architectures.

Back To Top