Beispiel #1
0
        public new static StorApiStatus GetControllers(ref List <Controller> controllers)
        {
            StorApiStatus result = StorApiStatusEnum.STOR_NO_ERROR;

            if (controllers == null)
            {
                controllers = new List <Controller>();
            }
            controllers.Add(SpacesController.GetSpacesController());
            return(result);
        }
Beispiel #2
0
        public static StorApiStatus GetControllers(ref List <Controller> controllers)
        {
            StorApiStatus controllers2 = MarvellController.GetControllers(ref controllers);

            if (controllers2 != StorApiStatusEnum.STOR_NO_ERROR)
            {
                Storage.Debug("Marvell get controllers failed: {0}", new object[]
                {
                    controllers2
                });
            }
            controllers2 = SpacesController.GetControllers(ref controllers);
            if (controllers2 != StorApiStatusEnum.STOR_NO_ERROR)
            {
                Storage.Debug("Storage Spaces get controllers failed: {0}", new object[]
                {
                    controllers2
                });
            }
            return(StorApiStatusEnum.STOR_NO_ERROR);
        }
 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;
                 }
             }
         }
     }
 }
Beispiel #4
0
 public SpacesDrive(string id, SpacesController c) : base(id, c)
 {
 }
Beispiel #5
0
 public SpacesPool(string id, SpacesController c)
 {
     this.id         = id;
     this.controller = c;
 }
        protected override void UpdateController(Controller controller)
        {
            UpdateCompletedEvent updateCompletedEvent = new UpdateCompletedEvent();
            SpacesController     spacesController     = new SpacesController(((SpacesController)controller).Id);
            StorApiStatus        storApiStatus        = spacesController.Update();

            if (storApiStatus != StorApiStatusEnum.STOR_NO_ERROR)
            {
                updateCompletedEvent.updateStatus = storApiStatus;
                updateCompletedEvent.controller   = controller;
                this.OnUpdateCompleted(updateCompletedEvent);
                return;
            }
            ListComparer <Drive> listComparer = new ListComparer <Drive>();

            listComparer.Compare(controller.Drives, spacesController.Drives, new Func <Drive, Drive, bool>(SpacesDrive.CompareAndPreserve));
            ListComparer <Volume> listComparer2 = new ListComparer <Volume>();

            listComparer2.Compare(controller.Volumes, spacesController.Volumes, new Func <Volume, Volume, bool>(SpacesVolume.CompareInfo));
            ListComparer <SpacesPool> listComparer3 = new ListComparer <SpacesPool>();

            listComparer3.Compare(((SpacesController)controller).Pools, spacesController.Pools, new Func <SpacesPool, SpacesPool, bool>(SpacesPool.CompareInfo));
            controller.Drives  = spacesController.Drives;
            controller.Volumes = spacesController.Volumes;
            ((SpacesController)controller).Pools = spacesController.Pools;
            if (listComparer.AnythingChanged)
            {
                listComparer.removedItems.ForEach(delegate(ListComparer <Drive> .ItemData d)
                {
                    DriveEvent driveEvent = new DriveEvent();
                    driveEvent.controller = controller;
                    driveEvent.drive      = d.newItem;
                    driveEvent.oldDrive   = d.oldItem;
                    driveEvent.type       = ControllerEventType.EVENT_TYPE_REMOVED;
                    this.OnDriveChanged(driveEvent);
                });
                listComparer.changedItems.ForEach(delegate(ListComparer <Drive> .ItemData d)
                {
                    DriveEvent driveEvent = new DriveEvent();
                    driveEvent.controller = controller;
                    driveEvent.drive      = d.newItem;
                    driveEvent.oldDrive   = d.oldItem;
                    driveEvent.type       = ControllerEventType.EVENT_TYPE_CHANGED;
                    this.OnDriveChanged(driveEvent);
                });
                listComparer.addedItems.ForEach(delegate(ListComparer <Drive> .ItemData d)
                {
                    DriveEvent driveEvent = new DriveEvent();
                    driveEvent.controller = controller;
                    driveEvent.drive      = d.newItem;
                    driveEvent.oldDrive   = d.oldItem;
                    driveEvent.type       = ControllerEventType.EVENT_TYPE_ADDED;
                    this.OnDriveChanged(driveEvent);
                });
            }
            if (listComparer2.AnythingChanged)
            {
                listComparer2.removedItems.ForEach(delegate(ListComparer <Volume> .ItemData d)
                {
                    VolumeEvent volumeEvent = new VolumeEvent();
                    volumeEvent.controller  = controller;
                    volumeEvent.volume      = d.newItem;
                    volumeEvent.oldVolume   = d.oldItem;
                    volumeEvent.type        = ControllerEventType.EVENT_TYPE_REMOVED;
                    this.OnVolumeChanged(volumeEvent);
                });
                listComparer2.changedItems.ForEach(delegate(ListComparer <Volume> .ItemData d)
                {
                    VolumeEvent volumeEvent = new VolumeEvent();
                    volumeEvent.controller  = controller;
                    volumeEvent.volume      = d.newItem;
                    volumeEvent.oldVolume   = d.oldItem;
                    volumeEvent.type        = ControllerEventType.EVENT_TYPE_CHANGED;
                    this.OnVolumeChanged(volumeEvent);
                });
                listComparer2.addedItems.ForEach(delegate(ListComparer <Volume> .ItemData d)
                {
                    VolumeEvent volumeEvent = new VolumeEvent();
                    volumeEvent.controller  = controller;
                    volumeEvent.volume      = d.newItem;
                    volumeEvent.oldVolume   = d.oldItem;
                    volumeEvent.type        = ControllerEventType.EVENT_TYPE_ADDED;
                    this.OnVolumeChanged(volumeEvent);
                });
            }
            if (listComparer3.AnythingChanged)
            {
                listComparer3.removedItems.ForEach(delegate(ListComparer <SpacesPool> .ItemData d)
                {
                    PoolEvent poolEvent  = new PoolEvent();
                    poolEvent.controller = controller;
                    poolEvent.pool       = d.newItem;
                    poolEvent.oldPool    = d.oldItem;
                    poolEvent.type       = ControllerEventType.EVENT_TYPE_REMOVED;
                    this.OnPoolChanged(poolEvent);
                });
                listComparer3.changedItems.ForEach(delegate(ListComparer <SpacesPool> .ItemData d)
                {
                    PoolEvent poolEvent  = new PoolEvent();
                    poolEvent.controller = controller;
                    poolEvent.pool       = d.newItem;
                    poolEvent.oldPool    = d.oldItem;
                    poolEvent.type       = ControllerEventType.EVENT_TYPE_CHANGED;
                    this.OnPoolChanged(poolEvent);
                });
                listComparer3.addedItems.ForEach(delegate(ListComparer <SpacesPool> .ItemData d)
                {
                    PoolEvent poolEvent  = new PoolEvent();
                    poolEvent.controller = controller;
                    poolEvent.pool       = d.newItem;
                    poolEvent.oldPool    = d.oldItem;
                    poolEvent.type       = ControllerEventType.EVENT_TYPE_ADDED;
                    this.OnPoolChanged(poolEvent);
                });
            }
            updateCompletedEvent.updateStatus = StorApiStatusEnum.STOR_NO_ERROR;
            updateCompletedEvent.controller   = controller;
            this.OnUpdateCompleted(updateCompletedEvent);
        }
Beispiel #7
0
 public SpacesVolume(string id, SpacesController c) : base(id, c)
 {
 }