Get or Set System State or Power State (Run Remotely)
- Updated2025-08-04
- 2 minute(s) read
Get or Set System State or Power State (Run Remotely)
The GetRackSystemStateAsync function returns the current rack system state as a RackSystemState enum. The GetRackPowerStateAsync function returns the rack power state as a RackPowerState enum. You can can use this function, for example, to remotely change the ATECCGEN2 rack power state from Standby to Running.
When the rack is turned on and initialized, the RCU service cycles through the system states of Inactive, Init1 and Init2 before reaching the Operational system state. During rack initialization, the rack power state is set to RackControlUnitBooting. When the rack system state reaches the Operational state, the rack power state is set to Standby.
In the Standby power state, the rack does not supply power to the payloads. Pressing the power button on the rack or programmatically calling the SetRackPowerStateToRunningAsync function from a host changes the rack power state to Running and the system supplies power to the payloads.
To stop the system from supplying power to any payloads and return to the Standby power state from the Running power state, press the power button or programmatically call the SetRackPowerStateToStandbyAsync function.
Performing a Full Restart and Getting the System State
IAteCoreSession ateCoreSession;
try
{
// To create an object of IAteCoreSession.
ateCoreSession = await AteCoreSession.CreateAteCoreSessionAsync(hostname, password);
// Perform a full restart
await ateCoreSession.InitiateRackRestartAsync(RackRestartLevel.FullRestart); // Dispose ateCoreSession will be handled in InitiateRackRestartAsync
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
while (true)
{
try
{
ateCoreSession = await AteCoreSession.CreateAteCoreSessionAsync(hostname, password);
break;
}
catch
{
// Give some time (30 seconds) for a full restart
if (stopWatch.ElapsedMilliseconds > 30000)
{
throw new TimeoutException();
}
}
}
stopWatch.Stop();
stopWatch.Restart();
while (await ateCoreSession.GetRackSystemStateAsync() != RackSystemState.Operational)
{
// throw if the ATECCGEN2 hasn't moved to Operational system state over 5 seconds
if (stopWatch.ElapsedMilliseconds > 5000)
{
throw new TimeoutException();
}
}
stopWatch.Stop();
// Proceed with other operations after ATECCGEN2 is in an operational system state.
}
catch(Exception ex)
{
Console.WriteLine(ex.Message); //Print the exception message.
}
finally
{
if (ateCoreSession != null)
{
// To close the session.
ateCoreSession.Dispose();
}
}
Get and Set the Rack Power State
IAteCoreSession ateCoreSession;
try
{
// To create an object of IAteCoreSession.
ateCoreSession = await AteCoreSession.CreateAteCoreSessionAsync(hostname, password);
// Set the ATECCGEN2 Power State to Running when it is in Standby
if (await ateCoreSession.GetRackPowerStateAsync() == RackPowerState.Standby)
{
await ateCoreSession.SetRackPowerStateToRunningAsync();
// Call other functions to perform operations that require Power State Running on ATECCGEN2.
}
}
catch(Exception ex)
{
Console.WriteLine(ex.Message); //Print the exception message.
}
finally
{
if (ateCoreSession != null)
{
// To close the session.
ateCoreSession.Dispose();
}
}
Related Information
- Rack System State and Rack Power State Descriptions
The RCU service reports four system states during the initialization process: Inactive, Init1, Init2, and Operational. When the RCU service is terminated, it transitions from the Operational system state to the Deactivating system state and then the Inactive system state. In the event of an unrecoverable error in the system, the RCU service enters the Halt system state.