Пример #1
0
        public StorApiStatus RemoveDrive(string serial, ref Drive removedDrive)
        {
            StorApiStatus result = StorApiStatusEnum.STOR_NO_ERROR;

            if (this.drives == null)
            {
                return(result);
            }
            for (int i = 0; i < this.drives.Count; i++)
            {
                Drive drive = this.drives[i];
                if (drive.Serial == serial)
                {
                    removedDrive = drive;
                    this.drives.RemoveAt(i);
                    break;
                }
            }
            return(result);
        }
Пример #2
0
        public virtual StorApiStatus GetDriveVolumes(Drive drive, ref List <Volume> driveVolumes)
        {
            StorApiStatus result = StorApiStatusEnum.STOR_NO_ERROR;

            foreach (Volume volume in this.volumes)
            {
                foreach (Drive d in volume.Drives)
                {
                    if (drive.Equals(d))
                    {
                        if (driveVolumes == null)
                        {
                            driveVolumes = new List <Volume>();
                        }
                        driveVolumes.Add(volume);
                        break;
                    }
                }
            }
            return(result);
        }
Пример #3
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;
                 }
             }
         }
     }
 }
Пример #4
0
 public static bool CompareAndPreserve(Drive d1, Drive d2)
 {
     if (string.IsNullOrEmpty(d2.Model))
     {
         d2.Model = d1.Model;
     }
     if (string.IsNullOrEmpty(d2.Serial))
     {
         d2.Serial = d1.Serial;
     }
     if (string.IsNullOrEmpty(d2.Revision))
     {
         d2.Revision = d1.Revision;
     }
     if (d2.SectorCount == 0UL)
     {
         d2.SectorCount = d1.SectorCount;
     }
     if (d2.SectorSize == 0UL)
     {
         d2.SectorSize = d1.SectorSize;
     }
     return(SpacesDrive.CompareInfo(d1, d2));
 }
Пример #5
0
        public virtual StorApiStatus IsDriveConfiguredForSpaces(Drive drive, ref bool configured)
        {
            StorApiStatus storApiStatus = StorApiStatusEnum.STOR_NO_ERROR;

            if (drive == null)
            {
                return(StorApiStatusEnum.STOR_INVALID_PARAM);
            }
            StoragePool    storagePool      = null;
            SpacesApiError physicalDiskPool = SpacesApi.SpacesApi.GetPhysicalDiskPool(drive.Id, ref storagePool);

            if (physicalDiskPool == SpacesApiError.Success)
            {
                if (storagePool == null)
                {
                    configured = false;
                }
                else
                {
                    configured = !storagePool.IsPrimordial;
                }
            }
            return(SpacesUtil.ToStorApiStatus(physicalDiskPool));
        }
Пример #6
0
 public override bool Equals(Drive d)
 {
     return(d != null && string.Equals(d.Id, this.id, StringComparison.OrdinalIgnoreCase));
 }