def set_qos(server_name, user_name, password, vm_uuids, new_min_value, new_max_value):

    # Get the preferred version
    r = tintri.api_get(server_name, '/info')
    json_info = r.json()
    preferred_version = json_info['preferredVersion']
    
    # Verify the correct major and minor versions.
    versions = preferred_version.split(".")
    major_version = versions[0]
    minor_version = int(versions[1])
    if major_version != "v310":
        print_error("Incorrect major version: " + major_version + ".  Should be v310.")
        return "Error"
    if minor_version < 21:
        print_error("Incorrect minor Version: " + str(minor_version) + ".  Should be 21 or greater")
        return "Error"

    # Login into the appropriate VMstore
    session_id = tintri.api_login(server_name, user_name, password)
    if session_id is None:
        return "Error"
    print_info("Logged onto " + server_name)

    # Create new QoS object with the fields to be changed
    modify_qos_info = {'minNormalizedIops': int(new_min_value),
                       'maxNormalizedIops': int(new_max_value),
                       'typeId': 'com.tintri.api.rest.v310.dto.domain.beans.vm.VirtualMachineQoSConfig'
                      }
                      
    # Create the MultipleSelectionRequest object
    MS_Request = {'typeId': 'com.tintri.api.rest.v310.dto.MultipleSelectionRequest',
                  'ids': vm_uuids,
                  'newValue': modify_qos_info,
                  'propertyNames': ["minNormalizedIops", "maxNormalizedIops"]
                 }
    
    print_debug("Changing min and max QOS values to (" + str(new_min_value) + ", " + str(new_max_value) + ")")
    
    # Update the min and max QoS IOPs
    modify_qos_url = "/v310/vm/qosConfig"
    r = tintri.api_put(server_name, modify_qos_url, MS_Request, session_id)
    print_debug("The JSON response of the get invoke to the server " +
                server_name + " is: " + r.text)
    
    # if HTTP Response is not 204 then raise an exception
    if r.status_code != 204:
        print_error("The HTTP response for the put invoke to the server " +
              server_name + " is not 204, but is: " + str(r.status_code))
        print_error("url = " + modify_qos_url)
        print_error("payload = " + str(MS_Request))
        print_error("response: " + r.text)
        tintri.api_logout(server_name, session_id)
        print_info("Error log off " + server_name)
        return "Error"

    tintri.api_logout(server_name, session_id)
    print_info("Sucesss log off " + server_name)
    return "OK"
    print("\nDelete the oldest user generated snapshot.\n")
    print("Usage: " + sys.argv[0] + " server_name user_name password\n")
    sys.exit(-1)

server_name = sys.argv[1]
user_name = sys.argv[2]
password = sys.argv[3]

# Get the preferred version
r = tintri.api_get(server_name, '/info')
json_info = r.json()

print_info("API Version: " + json_info['preferredVersion'])

# Login to VMstore
session_id = tintri.api_login(server_name, user_name, password)

# Create filter to get the oldest user generated snapshot
q_filter = {'queryType': 'TOP_DOCS_BY_TIME',
            'limit': '1',
            'type': 'USER_GENERATED_SNAPSHOT'}

# Get the oldest user generated snapshot
url = "/v310/snapshot"
r = tintri.api_get_query(server_name, url, q_filter, session_id)
print_debug("The JSON response of the get invoke to the server " +
            server_name + " is: " + r.text)

# if HTTP Response is not 200 then raise an exception
if r.status_code != 200:
    print_error("The HTTP response for the get invoke to the server " +
# Get the preferred version
r = tintri.api_get(server_name, '/info')
if r.status_code != 200:
    print_error("The HTTP response for the get invoke to the server " +
                server_name + " is not 200, but is: " + str(r.status_code))
    print_error("URL = /api/info")
    print_error("response: " + r.text)
    sys.exit(-2)

json_info = r.json()

print_info("API Version: " + json_info['preferredVersion'])

# Login to VMstore
session_id = tintri.api_login(server_name, user_name, password)

# Get a VM to work with
p_filter = {
    'limit': 1,
    'sortedBy': 'LATENCY',
    'sortOrder': 'DESC',
    'live': "TRUE"
}
url = "/v310/vm"
r = tintri.api_get_query(server_name, url, p_filter, session_id)
if r.status_code != 200:
    print_error("The HTTP response for the get invoke to the server " +
                server_name + " is not 200, but is: " + str(r.status_code))
    print_error("URL = " + url)
    print_error("response: " + r.text)