コード例 #1
0
 /// <summary>
 /// Mapping between Contracts BootType and Ipmi BootType
 /// Used in GetNextBoot and SetNextBoot APIs associated with blades 
 /// </summary>
 /// <param name="bootType"></param>
 /// <returns></returns>
 internal static Contracts.BladeBootType GetContractsBootType(Ipmi.BootType bootType)
 {
     if (bootType == Ipmi.BootType.NoOverride)
         return Contracts.BladeBootType.NoOverride;
     else if (bootType == Ipmi.BootType.ForcePxe)
         return Contracts.BladeBootType.ForcePxe;
     else if (bootType == Ipmi.BootType.ForceDefaultHdd)
         return Contracts.BladeBootType.ForceDefaultHdd;
     else if (bootType == Ipmi.BootType.ForceIntoBiosSetup)
         return Contracts.BladeBootType.ForceIntoBiosSetup;
     else if (bootType == Ipmi.BootType.ForceFloppyOrRemovable)
         return Contracts.BladeBootType.ForceFloppyOrRemovable;
     else
         return Contracts.BladeBootType.Unknown;
 }
コード例 #2
0
ファイル: ChassisFru.cs プロジェクト: kewencai/ChassisManager
        /// <summary>
        /// Complete constructor for CM Fru
        /// </summary>
        /// <param name="commonHeader"></param>
        /// <param name="chassisInfoBytes"></param>
        /// <param name="boardInfoBytes"></param>
        /// <param name="productInfoBytes"></param>
        /// <param name="completionCode"></param>
        public void PopulateChassisFru(Ipmi.FruCommonHeader commonHeader,
                            byte[] chassisInfoBytes,
                            byte[] boardInfoBytes,
                            byte[] productInfoBytes, byte completionCode)
        {
            this.CommonHeader = commonHeader;
            this._completionCode = completionCode;
            if (chassisInfoBytes != null)
            {
                this.ChassisInfo = new Ipmi.FruChassisInfo(chassisInfoBytes);
            }

            if (boardInfoBytes != null)
            {
                this.BoardInfo = new Ipmi.FruBoardInfo(boardInfoBytes);
            }

            if (productInfoBytes != null)
            {
                this.ProductInfo = new Ipmi.FruProductInfo(productInfoBytes);
            }

        }
        /// <summary>
        /// Extract SEL Text Strings
        /// </summary>
        private EventLogData ExtractEventMessage(Ipmi.SystemEventLogMessage eventLog)
        {
            Ipmi.EventLogMsgType classification = eventLog.EventMessage.MessageType;

            string spacer = ConfigLoaded.EventLogStrSpacer +
                            ConfigLoaded.EventLogStrSeparator +
                            ConfigLoaded.EventLogStrSpacer;

            switch (classification)
            {
                case Microsoft.GFS.WCS.ChassisManager.Ipmi.EventLogMsgType.Threshold:
                    {
                        Ipmi.ThresholdEvent log = (Ipmi.ThresholdEvent)eventLog.EventMessage;

                        EventLogData logData = ConfigLoaded.GetEventLogData(classification, log.EventTypeCode, log.ReadingOffset);

                        logData.EventMessage = string.Format(logData.EventMessage, log.TriggerReading, log.TriggerThreshold);

                        return logData;
                    }
                case Microsoft.GFS.WCS.ChassisManager.Ipmi.EventLogMsgType.Discrete:
                    {
                        Ipmi.DiscreteEvent log = (Ipmi.DiscreteEvent)eventLog.EventMessage;

                        EventLogData logData = ConfigLoaded.GetEventLogData(classification, log.EventTypeCode, log.ReadingOffset);

                        logData.EventMessage = string.Format(logData.EventMessage, log.EventPayload[1], log.EventPayload[2]);

                        return logData;
                    }
                case Microsoft.GFS.WCS.ChassisManager.Ipmi.EventLogMsgType.SensorSpecific:
                    {
                        Ipmi.DiscreteEvent log = (Ipmi.DiscreteEvent)eventLog.EventMessage;

                        // Sensor Specific Event Types use the SensorType for indexing the TypeCode.
                        EventLogData logData = ConfigLoaded.GetEventLogData(classification, log.SensorType,
                            log.ReadingOffset);

                        // create exceptions to logging for DIMM number lookup, as opposed to reporting DIMM index.
                        if (log.SensorType == 12 || (log.SensorType == 16 && log.ReadingOffset == 0))
                        {
                            // dimm number is unknown at first.
                            string dimmNumber = ConfigLoaded.Unknown;

                            // Get WCS DIMM number
                            if (log.SensorType == 12)
                                dimmNumber = ConfigLoaded.GetDimmNumber(log.EventPayload[2]);
                            else
                                dimmNumber = ConfigLoaded.GetDimmNumber(log.EventPayload[1]);

                            logData.EventMessage = string.Format(logData.EventMessage, dimmNumber);
                        }
                        else if (eventLog.SensorType == Ipmi.SensorType.CriticalInterrupt && (log.ReadingOffset == 0x07 || log.ReadingOffset == 0x08 || log.ReadingOffset == 0x0A))
                        {
                            // Correctable, uncorrectable and fatal bus errors
                            logData.EventMessage = string.Format(logData.EventMessage, (byte)(((byte)log.EventPayload[1] >> 3) & 0x1F),
                                                                                       ((byte)log.EventPayload[1] & 0x07), log.EventPayload[2]);
                        }
                        else
                        {
                            logData.EventMessage = string.Format(logData.EventMessage, log.EventPayload[1],
                                log.EventPayload[2]);
                        }

                        string extension = logData.GetExtension(log.EvtByte2Reading);

                        if (extension != string.Empty)
                        {
                            logData.EventMessage = (logData.EventMessage +
                                               spacer +
                                               extension);
                        }

                        return logData;
                    }
                case Microsoft.GFS.WCS.ChassisManager.Ipmi.EventLogMsgType.Oem:
                    {
                        Ipmi.OemEvent log = (Ipmi.OemEvent)eventLog.EventMessage;

                        EventLogData logData = ConfigLoaded.GetEventLogData(classification, 0, 0);

                        return logData;
                    }
                case Microsoft.GFS.WCS.ChassisManager.Ipmi.EventLogMsgType.OemTimestamped:
                    {
                        Ipmi.OemTimeStampedEvent log = (Ipmi.OemTimeStampedEvent)eventLog.EventMessage;

                        EventLogData logData = ConfigLoaded.GetEventLogData(classification, 0, 0);

                        // Format OEM Timestamped SEL Record
                        logData.EventMessage = string.Format(logData.EventMessage, string.Format("0x{0:X}", log.ManufacturerID),
                            Ipmi.IpmiSharedFunc.ByteArrayToHexString(log.OemDefined));

                        return logData;
                    }
                case Microsoft.GFS.WCS.ChassisManager.Ipmi.EventLogMsgType.OemNonTimeStamped:
                    {
                        Ipmi.OemNonTimeStampedEvent log = (Ipmi.OemNonTimeStampedEvent)eventLog.EventMessage;

                        EventLogData logData = ConfigLoaded.GetEventLogData(classification, 0, 0);

                        // Format OEM Non-timestamped SEL Record
                        logData.EventMessage = string.Format(logData.EventMessage, Ipmi.IpmiSharedFunc.ByteArrayToHexString(log.OemDefined));

                        return logData;
                    }
                default:
                    {
                        Ipmi.UnknownEvent log = (Ipmi.UnknownEvent)eventLog.EventMessage;

                        EventLogData logData = ConfigLoaded.GetEventLogData(classification, 0, 0);

                        return logData;
                    }
            }
        }
        /// <summary>
        /// Converts NicInfo into contracts object
        /// </summary>
        /// <param name="ipmiNicInfo"></param>
        /// <returns></returns>
        internal Contracts.NicInfo GetNicInfoObject(Ipmi.NicInfo ipmiNicInfo)
        {
            Contracts.NicInfo nicInfoObject = new Contracts.NicInfo();
            if (ipmiNicInfo.CompletionCode == (byte)CompletionCode.Success)
            {
                nicInfoObject.completionCode = Contracts.CompletionCode.Success;
            }
            // IpmiInvalidDataFieldInRequest is returned when a NIC that is not present in the system is requested.
            else if (ipmiNicInfo.CompletionCode == (byte)CompletionCode.IpmiInvalidDataFieldInRequest)
            {
                nicInfoObject.completionCode = Contracts.CompletionCode.Success;
                nicInfoObject.statusDescription = "Not Present";
            }
            else if (ipmiNicInfo.CompletionCode == (byte)Contracts.CompletionCode.FirmwareDecompressing)
            {
                nicInfoObject.completionCode = Contracts.CompletionCode.FirmwareDecompressing;
                nicInfoObject.statusDescription = "Blade Firmware still decompressing, cannot read data at this time";
            }
            // Else an unkown error occured.
            else
            {
                nicInfoObject.completionCode = Contracts.CompletionCode.Failure;
                nicInfoObject.statusDescription = Contracts.CompletionCode.Failure.ToString() + ": Internal error";
            }

            nicInfoObject.deviceId = ipmiNicInfo.DeviceId;
            nicInfoObject.macAddress = ipmiNicInfo.MacAddress;

            return nicInfoObject;
        }
コード例 #5
0
        internal static EventLogData GetEventLogData(Ipmi.EventLogMsgType eventType, int number, int offset)
        {
            EventLogData logDataQuery =
            (from eventLog in EventStrings
             where eventLog.Number == number
             && eventLog.OffSet == offset
             && eventLog.MessageClass == eventType
             select eventLog).FirstOrDefault();

            if (logDataQuery != null)
            {
                // Create new instance of EventLogData to avoid overwriting EventMessage and Description
                EventLogData tempData = new EventLogData(logDataQuery.Number, logDataQuery.OffSet, logDataQuery.MessageClass,
                    string.Copy(logDataQuery.EventMessage), string.Copy(logDataQuery.Description));
                return tempData;
            }
            else
            {
                return new EventLogData();
            }
        }