示例#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;
                 }
             }
         }
     }
 }
示例#2
0
        protected MarvellDrive MakeDrive(MvApi.MvApi.HD_Info hdInfo)
        {
            byte          b            = 0;
            StorApiStatus a            = StorApiStatusEnum.STOR_NO_ERROR;
            MarvellDrive  marvellDrive = new MarvellDrive(hdInfo.Link.Self.DevID, this);

            marvellDrive.Port           = this.GetDrivePort(hdInfo);
            marvellDrive.Model          = MarvellUtil.GetApiString(hdInfo.Model, 40);
            marvellDrive.Serial         = MarvellUtil.GetApiString(hdInfo.SerialNo, 20);
            marvellDrive.Revision       = MarvellUtil.GetApiString(hdInfo.FWVersion, 8);
            marvellDrive.SectorSize     = (ulong)((hdInfo.BlockSize == 0u) ? 512u : hdInfo.BlockSize);
            marvellDrive.SectorCount    = hdInfo.Size.ToUlong() * 1024UL / marvellDrive.SectorSize;
            marvellDrive.IsSmartEnabled = false;
            marvellDrive.IsSystem       = false;
            marvellDrive.Status         = DriveStatus.DRIVE_UNKNOWN;
            marvellDrive.Domain         = DriveDomain.DRIVE_DOMAIN_UNKNOWN;
            short[] id = new short[]
            {
                hdInfo.Link.Self.DevID
            };
            lock (MarvellUtil.mvApiLock)
            {
                try
                {
                    b = MvApi.MvApi.MV_DiskHasOS(this.AdapterId, 1, 1, id);
                }
                catch (Exception ex)
                {
                    Logger.Warn("MV_DiskHasOS exception: {0}", new object[]
                    {
                        ex
                    });
                    throw ex;
                }
            }
            if (b == 159)
            {
                marvellDrive.IsSystem = true;
            }
            MvApi.MvApi.HD_Config_Request hd_Config_Request = default(MvApi.MvApi.HD_Config_Request);
            hd_Config_Request.header.Init();
            hd_Config_Request.header.requestType       = 2;
            hd_Config_Request.header.startingIndexOrId = hdInfo.Link.Self.DevID;
            hd_Config_Request.header.numRequested      = 1;
            lock (MarvellUtil.mvApiLock)
            {
                try
                {
                    b = MvApi.MvApi.MV_PD_GetConfig(this.AdapterId, ref hd_Config_Request);
                }
                catch (Exception ex2)
                {
                    Logger.Warn("MV_PD_GetConfig exception: {0}", new object[]
                    {
                        ex2
                    });
                    throw ex2;
                }
            }
            marvellDrive.IsSmartEnabled = (hd_Config_Request.hdConfig[0].SMARTOn == 1);
            if (!marvellDrive.IsSmartEnabled)
            {
                a = marvellDrive.EnableSmart();
                if (a == StorApiStatusEnum.STOR_NO_ERROR)
                {
                    marvellDrive.IsSmartEnabled = true;
                }
            }
            return(marvellDrive);
        }