private LogicalVolumeStatus GetComponentStatus(ComponentRecord cmpnt)
        {
            // NOTE: no support for RAID, so either valid or failed...

            LogicalVolumeStatus status = LogicalVolumeStatus.Healthy;

            foreach (var extent in _database.GetComponentExtents(cmpnt.Id))
            {
                DiskRecord disk = _database.GetDisk(extent.DiskId);
                if (!_disks.ContainsKey(new Guid(disk.DiskGuidString)))
                {
                    status = LogicalVolumeStatus.Failed;
                    break;
                }
            }

            return(status);
        }
Beispiel #2
0
        public static DatabaseRecord ReadFrom(byte[] buffer, int offset)
        {
            DatabaseRecord result = null;

            if (Utilities.ToInt32BigEndian(buffer, offset + 0xC) != 0)
            {
                switch ((RecordType)(buffer[offset + 0x13] & 0xF))
                {
                    case RecordType.Volume:
                        result = new VolumeRecord();
                        break;

                    case RecordType.Component:
                        result = new ComponentRecord();
                        break;

                    case RecordType.Extent:
                        result = new ExtentRecord();
                        break;

                    case RecordType.Disk:
                        result = new DiskRecord();
                        break;

                    case RecordType.DiskGroup:
                        result = new DiskGroupRecord();
                        break;

                    default:
                        throw new NotImplementedException("Unrecognized record type: " + buffer[offset + 0x13]);
                }

                result.DoReadFrom(buffer, offset);
            }

            return result;
        }
        public static DatabaseRecord ReadFrom(byte[] buffer, int offset)
        {
            DatabaseRecord result = null;

            if (Utilities.ToInt32BigEndian(buffer, offset + 0xC) != 0)
            {
                switch ((RecordType)(buffer[offset + 0x13] & 0xF))
                {
                case RecordType.Volume:
                    result = new VolumeRecord();
                    break;

                case RecordType.Component:
                    result = new ComponentRecord();
                    break;

                case RecordType.Extent:
                    result = new ExtentRecord();
                    break;

                case RecordType.Disk:
                    result = new DiskRecord();
                    break;

                case RecordType.DiskGroup:
                    result = new DiskGroupRecord();
                    break;

                default:
                    throw new NotImplementedException("Unrecognized record type: " + buffer[offset + 0x13]);
                }

                result.DoReadFrom(buffer, offset);
            }

            return(result);
        }