/// <summary> /// Gets the backup status. /// </summary> /// <param name="bladeId">The blade identifier.</param> /// <param name="backupStatus">The backup status.</param> /// <param name="nvdimmPresentTimeRemaining">The NVDIMM present time remaining.</param> /// <param name="adrCompleteDelay">The ADR complete delay.</param> /// <param name="nvdimmPresentPowerOffDelay">The NVDIMM present power off delay.</param> /// <returns>true: Backup status obtained successfully from blade. /// false: Failed to obtain backup status from blade</returns> private static bool GetBackupStatus(int bladeId, out NvdimmBackupStatus backupStatus, out int nvdimmPresentTimeRemaining, out byte adrCompleteDelay, out byte nvdimmPresentPowerOffDelay) { // Kill any active serial session - use the force kill option with invalid blade id since we do not know // what blade currently has open serial session and the session token is also not known to us Contracts.ChassisResponse killSessionResponse = BladeSerialSessionMetadata.StopBladeSerialSession(0, null, true); if ((killSessionResponse.completionCode != Contracts.CompletionCode.NoActiveSerialSession) && (killSessionResponse.completionCode != Contracts.CompletionCode.Success)) { Tracer.WriteError("Before GetNvDimmTrigger Datasafe Operation (BladeId-{0}): Cannot kill the serial session.", bladeId); // It makes sense to proceed further as a best effort even if we cannot kill the serial session.. so continue.. } // Get ADR trigger status. SendReceive() in SerialPortManager will disable safe mode // for NVDIMM commands so this command will not be blocked by any existing serial sessions NvDimmTrigger getTrigger = WcsBladeFacade.GetNvDimmTrigger((byte)bladeId); // Command executed successfully if (getTrigger.CompletionCode == 0x00) { // Determine backup status if (getTrigger.AdrComplete == 0x01) { if (getTrigger.NvdimmPresentTimeRemaining == 0) { backupStatus = NvdimmBackupStatus.Complete; } else { backupStatus = NvdimmBackupStatus.Pending; } } else { backupStatus = NvdimmBackupStatus.NotPending; } nvdimmPresentTimeRemaining = getTrigger.NvdimmPresentTimeRemaining; adrCompleteDelay = (byte)getTrigger.AdrCompleteDelay; nvdimmPresentPowerOffDelay = (byte)getTrigger.NvdimmPresentPowerOffDelay; return true; } else { backupStatus = NvdimmBackupStatus.Unknown; nvdimmPresentTimeRemaining = ConfigLoaded.NvDimmPresentPowerOffDelay; adrCompleteDelay = (byte)ConfigLoaded.AdrCompleteDelay; nvdimmPresentPowerOffDelay = (byte)ConfigLoaded.NvDimmPresentPowerOffDelay; return false; } }
/// <summary> /// Gets the backup status. /// </summary> /// <param name="bladeId">The blade identifier.</param> /// <param name="backupStatus">The backup status.</param> /// <param name="nvdimmPresentTimeRemaining">The NVDIMM present time remaining.</param> /// <param name="adrCompleteDelay">The ADR complete delay.</param> /// <param name="nvdimmPresentPowerOffDelay">The NVDIMM present power off delay.</param> /// <returns>true: Backup status obtained successfully from blade. /// false: Failed to obtain backup status from blade</returns> private static bool GetBackupStatus(int bladeId, out NvdimmBackupStatus backupStatus, out int nvdimmPresentTimeRemaining, out byte adrCompleteDelay, out byte nvdimmPresentPowerOffDelay) { // Get ADR trigger status. SendReceive() in SerialPortManager will disable safe mode // for NVDIMM commands so this command will not be blocked by any existing serial sessions NvDimmTrigger getTrigger = WcsBladeFacade.GetNvDimmTrigger((byte)bladeId); // Command executed successfully if (getTrigger.CompletionCode == 0x00) { // Determine backup status if (getTrigger.AdrComplete == 0x01) { if (getTrigger.NvdimmPresentTimeRemaining == 0) { backupStatus = NvdimmBackupStatus.Complete; } else { backupStatus = NvdimmBackupStatus.Pending; } } else { backupStatus = NvdimmBackupStatus.NotPending; } nvdimmPresentTimeRemaining = getTrigger.NvdimmPresentTimeRemaining; adrCompleteDelay = (byte)getTrigger.AdrCompleteDelay; nvdimmPresentPowerOffDelay = (byte)getTrigger.NvdimmPresentPowerOffDelay; Tracer.WriteInfo("GetBackupStatus timeRemain ({0}), adrCompDelay ({1}), powerOffDelay ({2})", nvdimmPresentTimeRemaining, adrCompleteDelay, nvdimmPresentPowerOffDelay); return true; } else { backupStatus = NvdimmBackupStatus.Unknown; nvdimmPresentTimeRemaining = ConfigLoaded.NvDimmPresentPowerOffDelay; adrCompleteDelay = (byte)ConfigLoaded.AdrCompleteDelay; nvdimmPresentPowerOffDelay = (byte)ConfigLoaded.NvDimmPresentPowerOffDelay; return false; } }