Esempio n. 1
0
        public StorApiStatus AddVolume(SpacesVolume volume)
        {
            StorApiStatus result = StorApiStatusEnum.STOR_NO_ERROR;

            if (this.volumes == null)
            {
                this.volumes = new List <Volume>();
            }
            int i;

            for (i = 0; i < this.volumes.Count; i++)
            {
                Volume volume2 = this.volumes[i];
                if (string.Equals(volume2.Id, volume.Id, StringComparison.OrdinalIgnoreCase))
                {
                    this.volumes[i] = volume2;
                    break;
                }
            }
            if (i == this.volumes.Count)
            {
                this.volumes.Add(volume);
            }
            return(result);
        }
Esempio n. 2
0
        public new static bool CompareInfo(Volume v1, Volume v2)
        {
            bool flag = Volume.CompareInfo(v1, v2);

            if (flag)
            {
                SpacesVolume spacesVolume  = (SpacesVolume)v1;
                SpacesVolume spacesVolume2 = (SpacesVolume)v2;
                ListComparer <OperationalStatusEnum> listComparer = new ListComparer <OperationalStatusEnum>();
                if (spacesVolume.Health != spacesVolume2.Health || listComparer.Compare(spacesVolume.operationalStatuses, spacesVolume2.operationalStatuses, new Func <OperationalStatusEnum, OperationalStatusEnum, bool>(SpacesUtil.CompareOperationalStatus)))
                {
                    flag = false;
                }
            }
            return(flag);
        }
Esempio n. 3
0
        public SpacesVolume MakeVolume(VirtualDisk d)
        {
            SpacesVolume spacesVolume = new SpacesVolume(d.ObjectId, this);

            spacesVolume.Name                = d.FriendlyName;
            spacesVolume.StripeSize          = d.Interleave;
            spacesVolume.RaidLevel           = SpacesUtil.DetermineVirtualDiskRaidLevel(d);
            spacesVolume.Progress            = 0f;
            spacesVolume.Status              = SpacesUtil.ToStorApiVolumeStatus(d);
            spacesVolume.IsSystem            = false;
            spacesVolume.Health              = d.HealthStatus;
            spacesVolume.OperationalStatuses = d.OperationalStatus;
            List <Drive>  drives       = new List <Drive>();
            StorApiStatus volumeDrives = this.GetVolumeDrives(spacesVolume, ref drives);

            if (volumeDrives == StorApiStatusEnum.STOR_NO_ERROR)
            {
                spacesVolume.Drives = drives;
            }
            return(spacesVolume);
        }