Esempio n. 1
0
 protected void UpdateVolumeDrives()
 {
     foreach (Volume volume in this.volumes)
     {
         MarvellVolume marvellVolume = (MarvellVolume)volume;
         foreach (short blkid in marvellVolume.BlockIds)
         {
             short driveIdFromBlockId = this.GetDriveIdFromBlockId(blkid);
             if (driveIdFromBlockId != -1)
             {
                 Drive drive = this.FindDrive(driveIdFromBlockId.ToString());
                 if (drive != null)
                 {
                     drive.Domain = DriveDomain.DRIVE_DOMAIN_RAID;
                     marvellVolume.Drives.Add(drive);
                 }
             }
         }
     }
     foreach (Drive drive2 in this.drives)
     {
         MarvellDrive marvellDrive = (MarvellDrive)drive2;
         if (marvellDrive.Domain == DriveDomain.DRIVE_DOMAIN_UNKNOWN)
         {
             StorApiStatus    a = StorApiStatusEnum.STOR_NO_ERROR;
             SpacesController spacesController = SpacesController.GetSpacesController();
             SpacesDrive      spacesDrive      = null;
             a = spacesController.GetSpacesDrive(marvellDrive.Serial, ref spacesDrive);
             if (a == StorApiStatusEnum.STOR_NO_ERROR && spacesDrive != null)
             {
                 bool flag = false;
                 a = spacesController.IsDriveConfiguredForSpaces(spacesDrive, ref flag);
                 if (a == StorApiStatusEnum.STOR_NO_ERROR && flag)
                 {
                     marvellDrive.Domain = DriveDomain.DRIVE_DOMAIN_SPACES;
                 }
             }
         }
     }
 }
Esempio n. 2
0
        protected MarvellVolume MakeVolume(MvApi.MvApi.LD_Info ldInfo)
        {
            byte          b             = 0;
            MarvellVolume marvellVolume = new MarvellVolume(ldInfo.ID, this);

            marvellVolume.Name       = MarvellUtil.GetApiString(ldInfo.Name, 16);
            marvellVolume.RaidLevel  = MarvellUtil.ToStorApiRaidLevel(ldInfo.RaidMode);
            marvellVolume.StripeSize = (ulong)((long)(ldInfo.StripeBlockSize * 1024));
            marvellVolume.Status     = MarvellUtil.ToStorApiVolumeStatus(ldInfo.Status);
            marvellVolume.Capacity   = ldInfo.Size.ToUlong() * 1024UL;
            for (byte b2 = 0; b2 < ldInfo.HDCount; b2 += 1)
            {
                marvellVolume.BlockIds.Add(ldInfo.BlockIDs[(int)b2]);
            }
            short[] id = new short[]
            {
                ldInfo.ID
            };
            lock (MarvellUtil.mvApiLock)
            {
                try
                {
                    b = MvApi.MvApi.MV_DiskHasOS(this.AdapterId, 0, 1, id);
                }
                catch (Exception ex)
                {
                    Logger.Warn("MakeVolume MV_DiskHasOS exception: {0}", new object[]
                    {
                        ex
                    });
                    throw ex;
                }
            }
            if (b == 158)
            {
                marvellVolume.IsSystem = true;
            }
            if (ldInfo.BGAStatus != 0)
            {
                MvApi.MvApi.LD_Status_Request ld_Status_Request = default(MvApi.MvApi.LD_Status_Request);
                ld_Status_Request.header.Init();
                ld_Status_Request.header.requestType       = 2;
                ld_Status_Request.header.startingIndexOrId = ldInfo.ID;
                ld_Status_Request.header.numRequested      = 1;
                lock (MarvellUtil.mvApiLock)
                {
                    try
                    {
                        b = MvApi.MvApi.MV_LD_GetStatus(this.AdapterId, ref ld_Status_Request);
                    }
                    catch (Exception ex2)
                    {
                        Logger.Warn("MV_LD_GetStatus exception: {0}", new object[]
                        {
                            ex2
                        });
                        throw ex2;
                    }
                }
                if (b == 0)
                {
                    marvellVolume.Progress = (float)ld_Status_Request.ldStatus[0].BgaPercentage;
                    if (ld_Status_Request.ldStatus[0].Bga != 0 && marvellVolume.Status != VolumeStatus.VOLUME_FAILED)
                    {
                        VolumeStatus volumeStatus = MarvellUtil.ToStorApiVolumeStatusBGA(ld_Status_Request.ldStatus[0].Bga);
                        if (volumeStatus != VolumeStatus.VOLUME_UNKNOWN)
                        {
                            marvellVolume.Status = volumeStatus;
                        }
                    }
                    if (ld_Status_Request.ldStatus[0].Bga == 32)
                    {
                        MvApi.MvApi.LD_Info ld_Info = default(MvApi.MvApi.LD_Info);
                        lock (MarvellUtil.mvApiLock)
                        {
                            try
                            {
                                b = MvApi.MvApi.MV_LD_GetTargetLDInfo(this.AdapterId, ldInfo.ID, ref ld_Info);
                            }
                            catch (Exception ex3)
                            {
                                Logger.Warn("MV_LD_GetTargetLDInfo exception: {0}", new object[]
                                {
                                    ex3
                                });
                                throw ex3;
                            }
                        }
                        if (b == 0)
                        {
                            marvellVolume.RaidLevel  = MarvellUtil.ToStorApiRaidLevel(ld_Info.RaidMode);
                            marvellVolume.StripeSize = (ulong)ld_Info.StripeBlockSize;
                            marvellVolume.BlockIds.Clear();
                            for (byte b3 = 0; b3 < ld_Info.HDCount; b3 += 1)
                            {
                                marvellVolume.BlockIds.Add(ld_Info.BlockIDs[(int)b3]);
                            }
                        }
                    }
                }
            }
            return(marvellVolume);
        }