#REST API - Image update estimation and validation

1 messages · Page 1 of 1 (latest)

hard iron
#

Hi, I'm trying to find the equivalent API endpoint(s) for the following CLI command: cluster image update -version <version> -estimate-only true:

::> cluster image update -version 9.13.1P4 -estimate-only true

Cluster               Items Requiring
Component             Updates           Estimated Duration
--------------------- ----------------- -----------------------------------
Node Updates          2                 102 minutes

Component Component ID Current Version Updated Version Estimated Duration
--------- ------------ --------------- --------------- ------------------
Node      node-  9.13.1P4        9.13.1P4        31 minutes
          01
Node      node-  9.13.1P4        9.13.1P4        31 minutes
          02

Per the docs, I am running the following curl command to test: curl -u user:pass --insecure -X PATCH "https://cluster/api/cluster/software?estimate_only=true" -d '{"version": "9.13.1P4"}'. This executes successfully, but I don't get the same output as seen above. What I see is the following:

{
  "job": {
    "uuid": "161ad0d7-a9b4-11ee-8b6e-00a098b81cba",
    "_links": {
      "self": {
        "href": "/api/cluster/jobs/161ad0d7-a9b4-11ee-8b6e-00a098b81cba"
      }
    }
  }
}

Even looking at the information about that particular job UUID doesn't give me what I'm hoping to see. This is what I see instead:

{
  "uuid": "161ad0d7-a9b4-11ee-8b6e-00a098b81cba",
  "description": "PATCH /api/cluster/software",
  "state": "success",
  "message": "success",
  "code": 0,
  "start_time": "2024-01-02T16:15:42-05:00",
  "end_time": "2024-01-02T16:15:42-05:00",
  "_links": {
    "self": {
      "href": "/api/cluster/jobs/161ad0d7-a9b4-11ee-8b6e-00a098b81cba"
    }
  }
}
left bronze
#

NetApp team - Any input on the query above by Michael?

hard iron
#

Also, there's a second CLI command that I'm looking for the API equivalent(s) as well:
CLI Command: cluster image show-update-progress CLI output:

Update Phase         Status                   Duration        Duration
-------------------- ----------------- --------------- ---------------
Pre-update checks    completed                00:10:00        00:00:36

Details:

Pre-update Check     Status            Error-Action
-------------------- ----------------- --------------------------------------
Manual checks        Warning           Warning: Manual validation checks
                                       need to be performed. Refer to the
                                       Upgrade Advisor Plan or the "What
                                       should I verify before I upgrade with
                                       or without Upgrade Advisor" section
                                       in the "Upgrade ONTAP" documentation
                                       for the remainingvalidation checks
                                       that need to be performed before
                                       update. Failing to do so can result
                                       in an update failure or an I/O
                                       disruption.
                                       Action: Refer to the Upgrade Advisor
                                       Plan or the "What should I verify
...

Running the same command via curl, I get the following:

curl -u user:pass --insecure -X GET "https://cluster/api/private/cli/cluster/image/show-update-progress"
{
  "records": [
    {
      "ndu_phase": "validation"
    }
  ],
  "num_records": 1
}
drifting sigil
#

With /private/cli try adding the field names with "?fields=xxx,yyy,zzz" (can't use wildcard *). The field names will be the same as the CLI -fields

hard iron
#

@drifting sigil I went that route and the the fields you see in the CLI output (i.e. cluster component, estimated duration, update phase, status, duration, error-action, etc) are not available via API. My gut says that the CLI command is actually executing multiple commands in the background and displaying the output from those commands. Any idea the best way to take a peak at what those two CLI commands are actually doing?

drifting sigil
#

Tried it using PowerShell / Invoke-RestMethod and seem to work with specifying the fields

hard iron
#

@drifting sigil 🤦‍♂️ completely missed those fields. Let me see what I can do with this. I'll reach out in the next day or so if I have other questions

hard iron
#

@drifting sigil Thanks to the above, got the the info i needed from show-update-progress. I actually ended up using the api/cluster/software endpoint. Now, the remaining issue is to get the output from cluster image update -version 9.13.1P6 -estimate-only true -show-validation-details true from the API. Here is what you get when running that via CLI:

Cluster               Items Requiring
Component             Updates           Estimated Duration
--------------------- ----------------- -----------------------------------
Node Updates          2                 102 minutes

Component Component ID Current Version Updated Version Estimated Duration
--------- ------------ --------------- --------------- ------------------
Node      node-         9.13.1P6        9.13.1P6        31 minutes
          01
Node      node-         9.13.1P6        9.13.1P6        31 minutes
          02
2 entries were displayed.

Running the same command via cURL - curl -u user:pass --insecure -X POST "https://<ontap_clustername>/api/private/cli/cluster/image/update" -d '{"version":"9.13.1P6","estimate-only":"true","show-validation-details":"true"}' - I get an empty dataset back:

{
}

According to the api docs there is a cluster/software endpoint that translates to cluster image update .

cURL command: curl -u user:pass --insecure -X PATCH "https://<ontap_clustername>/api/cluster/software" -d '{"version":"9.13.1P6","estimate_only":"true","show_validation_details":"true"}'

output:

{
  "job": {
    "uuid": "63b63cbe-af2b-11ee-ae0c-00a098b81cba",
    "_links": {
      "self": {
        "href": "/api/cluster/jobs/63b63cbe-af2b-11ee-ae0c-00a098b81cba"
      }
    }
  }
}
drifting sigil
#

Do you get a meaningful result after calling job._links.self.href ?

drifting sigil
#

curl -u user:pass --insecure -X PATCH "https://<ontap_clustername>/api/cluster/software?estimate_only=true&show_validation_details=true" -d "{ "version": "9.13.1P6"}"

#

I used swagger to see which settings go in the URL and what goes in the body - it is confusing sometimes so I let swagger show me 😉

hard iron
#

For some reason I still get the same thing when I run the curl you provided (note i had to make some changes to the qoutes around the json body). I ran this curl -u user:pass --insecure -X PATCH "https://<ontap_cluster>/api/cluster/software?estimate_only=true&show_validation_details=true" -d '{"version":"9.13.1P4"}' and get this:

  "job": {
    "uuid": "672398bb-afbf-11ee-ae0c-00a098b81cba",
    "_links": {
      "self": {
        "href": "/api/cluster/jobs/672398bb-afbf-11ee-ae0c-00a098b81cba"
      }
    }
  }
}