S2D UPS Shutdown Sript (S2DUPS) v121 - with Installer 1.0.30

Andrew Sharrad 15/04/26


Pre-requisites:
===============

Optional:
A/ Create a Domain Service / Adminstrator account called svcUPS, in the S2D management Domain

This step is optional. If you choose not to create the account yourself, the installation program will create a new account
when to do the installation on the first host. If a new account is created, you will be prompted for a complex password


Installation on Each S2D Host:
==============================
1/ Log onto each host as the regular Domain Administrator

2/ Extract the following file to a folder, such as C:\_STONE\S2DUPSShutdown

Install_S2D_UPS_Shutdown_Script.ps1

3/ Start the installaton program by double clicking on Install_S2D_UPS_Shutdown_Script.ps1

4/ Follow the onscreen messages

5/ If you have a supported UPS Application installed you will be prompted if you would like the shutdown script settings of these programs configured for you

Supported Applications:
Eaton Intelligent Power Protector
Eaton Intelligent Power Manager
Riello Powershield 3
APC Powerchute Network Shutdown
HPE Power Protector
APC Powerchute Serial Shutdown (partial config only - see the instruction on screen)


6/ Always check that your UPS software is registered with the UPC Network Management Card and that the shutdown settings (i.e. script and script location, as well as a shutdown duration of 600 seconds) are configured

7/ Edit the shutdown settings contained in C:\Program Files\Stone\HAS\S2D UPS Shutdown Script\S2D_UPS_Settings.ini
This is not normally necessary. See Changing the Settings, below.



Post Installation Tasks
=======================


Finally:
It is recommended that when you can have planned cluster downtime, you test the script.

- Either by using the UPS software to call the script (recommended)
- Or by running the scheduled task under MANAGEMENT\UPSShutdown
- Or by running C:\Program Files\Stone\HAS\S2D UPS Shutdown Script\SD2_UPS_StartShutdown.cmd

...on one or multiple nodes

Master and Slave
================

In a standard deployment, each Node in the Cluster should be running UPS software, and be connected to the same UPS using the UPS network management card. This means that when a low battery condition is detected, all nodes start shutting down at the same time.

However, the following configurations break this process:

-Different UPS for different nodes in the cluster
In this situation, shutdowns may be triggered at different times depending on battery condition and load. This may lead to degraded storage at the end of the shutdown process
-Using a UPS that only supports serial or USB
In this situation, only one node actually shuts down. The other nodes may or may not be running cluster VMs, but at the very least local VMs will still be running, and the hosts will not be cleanly shutdown.

In this situation, configure the SlaveNodes setting in the configuration file with a comma separated list of other nodes to initiate shutdowns on.

From Installer 1.0.26 and newer, this is automatically offered during the configuration process.

Sample Process:

-UPS Software on Node 1, connected via USB, detects a low battery condition
-It starts the UPS Shutdown command file
-This starts the Node 1 shutdown Task from Task Scheduler
-Node 1 then initiates the shutdown Tasks in Task Scheduler on the other nodes in the cluster
-The cluster is fully shutdown
-All local VMs are stopped
-And all hosts shutdown


Changing the Settings
=====================

Default settings below. They can be changed by editing C:\Program Files\Stone\HAS\S2D UPS Shutdown Script\S2D_UPS_Settings.ini, post-installation.



[Locations]
LogFilePath=C:\Program Files\Stone\HAS\S2D UPS Shutdown Script\Logs

[LocalVMSettings]
;maximum number of seconds to start shutting down all local VMs
MaximumTimetoStartShuttingdownLocalVMs=120
;maximum number of seconds in between starting each VM shutdown. Will be automatically reduced to shutdown within MaximumTimetoStartShuttingdownLocalVMs
LocalVMsStaggeredDelay=5
;Set this to False to Always Shut down local VMs, to Set to True to save VMs instead of shutting down, dependant upon each VMs memory demand and the OnlySaveLocalVMsBelowMemoryDemandThreshold setting
SaveLocalVMs=True
;Set this to False to Always Save local VMs, or set to True to only Save VMs that have a memory demand below the threshold. If set to True and the VM has a memory demand above the threshold, it will be shutdown instead of being saved
OnlySaveLocalVMsBelowMemoryDemandThreshold=True
SaveLocalVMsMemoryDemandThresholdMB=8192
;VMs with a memory demand above this threshold will be shutdown, instead of being saved

[ClusterSettings]
ShutdownCluster=True
OnlyInitiateClusterShutdownIfPoolOwner=False
;The amount of time in seconds before shutdown-cluster is issued
StartClusterShutdownDelay=120

[LocalNodePowerOff]
;Shutdown of this Node - in S2D, this needs to happen after all Cluster IO has ceased
TurnOffThisNode=True
;The settings below is the time in seconds, after Stage 2 has been started, that we will wait for the cluster shutdown job to complete before testing to see if we are ready to turn off the node
ClusterShutdownTimeout=240
;The settings below get the script to check every 5 seconds to see if these conditions have been met
DontTurnOffNodeifLocalClusteredVMsStillRunning=True
DontTurnOffNodeifLocalNonClusteredVMsStillRunning=True
DontTurnOffNodeifClusterIsStillRunning=True

[Slave]
SlaveNodes=

[Misc]
Version=121

;Total Shutdown time should be:
;The greater of:
;MaximumTimetoStartShuttingdownLocalVMs + time to save or shutdown last VMs
;StartClusterShutdownDelay + ClusterShutdownTimeout
;Then a final optional checks for LocalClusteredVMs, LocalNon-ClusteredVMs, and then the Cluster itself
;Then issuing Local Host Shutdown




Andrew Sharrad
05/06/25



