ONTAP Rest API Discussions

Powershell - ONTAP update - reboot of node fails the script

Christian_Ott
930 Views

hi at all

I need help with a little ONTAP update script in PowerShell.
The point is the reboot of one node of a HA cluster. The cluster managment interface is moved to the other node and during this action, my script fails because the cluster is not responding. A query to the availability of the ipaddress is not possible, because the PING is blocked by the firewall is many network segments.

 

here is the code snippet I use to monitor the process after trigger the update
====================================================================
Do
{
$InstallStatus = Get-NcClusterImageUpdateProgressOverview
Write-Host "...still installing, completed nodes >> $($InstallStatus.CompletedNodeCount) << " -ForegroundColor Darkyellow
wait-event -Timeout 10

} until ( $InstallStatus.CompletedNodeCount -eq $InstallStatus.TotalNodeCount )

If ( $InstallStatus.CompletedNodeCount -eq $InstallStatus.TotalNodeCount ) { Write-Host "Update erfolgreich durchgeführt" -Foregroundcolor Green }
====================================================================

and here the error message:
====================================================================
...still installing, completed nodes >> 1 << ### the first node is updated and the takeover in progress
Get-NcClusterImageUpdateProgressOverview:
Line |
3 | $InstallStatus = Get-NcClusterImageUpdateProgressOverview
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| API invoke failed. ### the script fails while the cluster management interface is offline
...still installing, completed nodes >> <<
====================================================================

During this do-until-loop, the cluster interface is moved to the other node and offline for a short time - this causes the script to fail.
Any hints? What can I do, that the script does not stop at this point and reconnect, if the cluster is available?

 

thanks for your help

Christian

2 REPLIES 2

JimRobertson
749 Views

I haven't done this myself, but something to try.  Have it sleep for a while, and then try to reconnect before continuing with the script?

Start-Sleep -Seconds 60
Connect-NcController Cluster_Name

When the cluster management LIF moves to another node, it doesn't change the IP address, so I wouldn't think that this would cause firewalls to start blocking it.  Let me know if that works... if not, I can test it out in our lab and see what works.  I'm curious myself.

Christian_Ott
716 Views

I have also already thought of this and edited the (the do-until loop) scipt in:

===================

$ErrorActionPreference = "SilentlyContinue"
Do {
   Try {
       $InstallStatus = Get-NcClusterImageUpdateProgressOverview
       }
   Catch {
       Write-Host "API ggf. wg. Reboot nicht erreichbar - warte 2 Minuten!"
       Start-Sleep -Seconds 120
          }
  Finally {
       Write-Host "...still installing, completed nodes >> $($InstallStatus.CompletedNodeCount) << " -ForegroundColor Darkyellow
       wait-event -Timeout 5
           }
} until ( $InstallStatus.CompletedNodeCount -eq $InstallStatus.TotalNodeCount )

===================

hopefully, that try-catch will not terminate the script, but the script still terminate - just without a an error message 😉

In my opinion, the failed API call and the availability of the management interface is totally independent.

Is it possible to check the connection for the API calls instead the ip address of the interface?

I'll keep your info "reconnect the cluster" in mind and will test it after my vacation 😉

 

Thanks for this hint!

Christian

 

Public