Example #1
0
 public override void FromManagementObject(ManagementObject m)
 {
     base.FromManagementObject(m);
     this.FriendlyName                  = SpacesApiUtil.GetManagementObjectValue <string>(m, "FriendlyName");
     this.Name                          = SpacesApiUtil.GetManagementObjectValue <string>(m, "Name");
     this.NameFormat                    = (NameFormatEnum)Enum.ToObject(typeof(NameFormatEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "NameFormat"));
     this.UniqueIdFormat                = (UniqueIdFormatEnum)Enum.ToObject(typeof(UniqueIdFormatEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "UniqueIdFormat"));
     this.Usage                         = (VirtualDiskUsage)Enum.ToObject(typeof(VirtualDiskUsage), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "Usage"));
     this.OperationalStatus             = SpacesApiUtil.ManagementObjectArrayToList <OperationalStatusEnum, ushort>(m["OperationalStatus"]);
     this.HealthStatus                  = (HealthStatusEnum)Enum.ToObject(typeof(HealthStatusEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "HealthStatus"));
     this.ResiliencySettingName         = SpacesApiUtil.GetManagementObjectValue <string>(m, "ResiliencySettingName");
     this.Size                          = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "Size");
     this.AllocatedSize                 = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "AllocatedSize");
     this.PhysicalSectorSize            = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "PhysicalSectorSize");
     this.LogicalSectorSize             = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "LogicalSectorSize");
     this.FootprintOnPool               = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "FootprintOnPool");
     this.ProvisioningType              = (ProvisioningTypeEnum)Enum.ToObject(typeof(ProvisioningTypeEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "ProvisioningType"));
     this.NumberOfDataCopies            = SpacesApiUtil.GetManagementObjectValue <ushort>(m, "NumberOfDataCopies");
     this.PhysicalDiskRedundancy        = SpacesApiUtil.GetManagementObjectValue <ushort>(m, "PhysicalDiskRedundancy");
     this.ParityLayout                  = (ParityLayoutEnum)Enum.ToObject(typeof(ParityLayoutEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "ParityLayout"));
     this.NumberOfColumns               = SpacesApiUtil.GetManagementObjectValue <ushort>(m, "NumberOfColumns");
     this.Interleave                    = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "Interleave");
     this.RequestNoSinglePointOfFailure = SpacesApiUtil.GetManagementObjectValue <bool>(m, "RequestNoSinglePointOfFailure");
     this.Access                        = (AccessEnum)Enum.ToObject(typeof(AccessEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "Access"));
     this.IsSnapshot                    = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsSnapshot");
     this.IsManualAttach                = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsManualAttach");
     this.IsDeduplicationEnabled        = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsDeduplicationEnabled");
     this.IsEnclosureAware              = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsEnclosureAware");
     this.NumberOfAvailableCopies       = SpacesApiUtil.GetManagementObjectValue <ushort>(m, "NumberOfAvailableCopies");
     this.DetachedReason                = (DetachedReasonEnum)Enum.ToObject(typeof(DetachedReasonEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "DetachedReason"));
 }
Example #2
0
 public override void FromManagementObject(ManagementObject m)
 {
     base.FromManagementObject(m);
     this.DeviceId          = SpacesApiUtil.GetManagementObjectValue <string>(m, "DeviceId");
     this.FriendlyName      = SpacesApiUtil.GetManagementObjectValue <string>(m, "FriendlyName");
     this.Usage             = (StorageUsage)Enum.ToObject(typeof(StorageUsage), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "Usage"));
     this.Description       = SpacesApiUtil.GetManagementObjectValue <string>(m, "Description");
     this.Manufacturer      = SpacesApiUtil.GetManagementObjectValue <string>(m, "Manufacturer");
     this.Model             = SpacesApiUtil.GetManagementObjectValue <string>(m, "Model");
     this.SerialNumber      = SpacesApiUtil.GetManagementObjectValue <string>(m, "SerialNumber").Trim();
     this.FirmwareVersion   = SpacesApiUtil.GetManagementObjectValue <string>(m, "FirmwareVersion");
     this.OperationalStatus = SpacesApiUtil.ManagementObjectArrayToList <OperationalStatusEnum, ushort>(m["OperationalStatus"]);
     this.HealthStatus      = (HealthStatusEnum)Enum.ToObject(typeof(HealthStatusEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "HealthStatus"));
     this.Size               = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "Size");
     this.AllocatedSize      = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "AllocatedSize");
     this.BusType            = (BusTypeEnum)Enum.ToObject(typeof(BusTypeEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "BusType"));
     this.PhysicalSectorSize = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "PhysicalSectorSize");
     this.LogicalSectorSize  = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "LogicalSectorSize");
     this.PhysicalLocation   = SpacesApiUtil.GetManagementObjectValue <string>(m, "PhysicalLocation");
     this.EnclosureNumber    = SpacesApiUtil.GetManagementObjectValue <ushort>(m, "EnclosureNumber");
     this.SlotNumber         = SpacesApiUtil.GetManagementObjectValue <ushort>(m, "SlotNumber");
     this.CanPool            = SpacesApiUtil.GetManagementObjectValue <bool>(m, "CanPool");
     this.CannotPoolReasons  = SpacesApiUtil.ManagementObjectArrayToList <CannotPoolReasonEnum, ushort>(m["CannotPoolReason"]);
     this.IsPartial          = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsPartial");
 }
Example #3
0
 public override void FromManagementObject(ManagementObject m)
 {
     base.FromManagementObject(m);
     this.FriendlyName                      = SpacesApiUtil.GetManagementObjectValue <string>(m, "FriendlyName");
     this.Name                              = SpacesApiUtil.GetManagementObjectValue <string>(m, "Name");
     this.OtherUsageDescription             = SpacesApiUtil.GetManagementObjectValue <string>(m, "OtherUsageDescription");
     this.Usage                             = (PoolUsage)Enum.ToObject(typeof(PoolUsage), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "Usage"));
     this.IsPrimordial                      = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsPrimordial");
     this.HealthStatus                      = (HealthStatusEnum)Enum.ToObject(typeof(HealthStatusEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "HealthStatus"));
     this.OperationalStatus                 = SpacesApiUtil.ManagementObjectArrayToList <OperationalStatusEnum, ushort>(m["OperationalStatus"]);
     this.OtherOperationalStatusDescription = SpacesApiUtil.GetManagementObjectValue <string>(m, "OtherOperationalStatusDescription");
     this.Size                              = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "Size");
     this.AllocatedSize                     = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "AllocatedSize");
     this.PhysicalSectorSize                = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "PhysicalSectorSize");
     this.LogicalSectorSize                 = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "LogicalSectorSize");
     this.ProvisioningTypeDefault           = (ProvisioningTypeEnum)Enum.ToObject(typeof(ProvisioningTypeEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "ProvisioningTypeDefault"));
     this.SupportedProvisioningTypes        = SpacesApiUtil.ManagementObjectArrayToList <ProvisioningTypeEnum, ushort>(m["SupportedProvisioningTypes"]);
     this.ResiliencySettingNameDefault      = SpacesApiUtil.GetManagementObjectValue <string>(m, "ResiliencySettingNameDefault");
     this.IsReadOnly                        = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsReadOnly");
     this.ReadOnlyReason                    = (DetachedReasonEnum)Enum.ToObject(typeof(DetachedReasonEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "ReadOnlyReason"));
     this.SupportsDeduplication             = SpacesApiUtil.GetManagementObjectValue <bool>(m, "SupportsDeduplication");
     this.IsClustered                       = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsClustered");
     this.ThinProvisioningAlertThresholds   = SpacesApiUtil.ManagementObjectArrayToList <ushort, ushort>(m["ThinProvisioningAlertThresholds"]);
     this.ClearOnDeallocate                 = SpacesApiUtil.GetManagementObjectValue <bool>(m, "ClearOnDeallocate");
     this.IsPowerProtected                  = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsPowerProtected");
     this.EnclosureAwareDefault             = SpacesApiUtil.GetManagementObjectValue <bool>(m, "EnclosureAwareDefault");
     this.RetireMissingPhysicalDisks        = (RetireMissingPhysicalDisksEnum)Enum.ToObject(typeof(RetireMissingPhysicalDisksEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "RetireMissingPhysicalDisks"));
 }
Example #4
0
 public override void FromManagementObject(ManagementObject m)
 {
     base.FromManagementObject(m);
     this.FriendlyName       = SpacesApiUtil.GetManagementObjectValue <string>(m, "FriendlyName");
     this.Path               = SpacesApiUtil.GetManagementObjectValue <string>(m, "Path");
     this.Location           = SpacesApiUtil.GetManagementObjectValue <string>(m, "Location");
     this.UniqueIdFormat     = (UniqueIdFormatEnum)Enum.ToObject(typeof(UniqueIdFormatEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "UniqueIdFormat"));
     this.Number             = SpacesApiUtil.GetManagementObjectValue <uint>(m, "Number");
     this.Manufacturer       = SpacesApiUtil.GetManagementObjectValue <string>(m, "Manufacturer");
     this.Model              = SpacesApiUtil.GetManagementObjectValue <string>(m, "Model");
     this.SerialNumber       = SpacesApiUtil.GetManagementObjectValue <string>(m, "SerialNumber");
     this.FirmwareVersion    = SpacesApiUtil.GetManagementObjectValue <string>(m, "FirmwareVersion");
     this.TotalSize          = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "TotalSize");
     this.AllocatedSize      = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "AllocatedSize");
     this.PhysicalSectorSize = SpacesApiUtil.GetManagementObjectValue <uint>(m, "PhysicalSectorSize");
     this.LogicalSectorSize  = SpacesApiUtil.GetManagementObjectValue <uint>(m, "LogicalSectorSize");
     this.LargestFreeExtent  = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "LargestFreeExtent");
     this.NumberOfPartitions = SpacesApiUtil.GetManagementObjectValue <uint>(m, "NumberOfPartitions");
     this.ProvisioningType   = (ProvisioningTypeEnum)Enum.ToObject(typeof(ProvisioningTypeEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "ProvisioningType"));
     this.OperationalStatus  = (DiskOperationalStatusEnum)Enum.ToObject(typeof(DiskOperationalStatusEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "OperationalStatus"));
     this.HealthStatus       = (DiskHealthStatusEnum)Enum.ToObject(typeof(DiskHealthStatusEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "HealthStatus"));
     this.BusType            = (BusTypeEnum)Enum.ToObject(typeof(BusTypeEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "BusType"));
     this.PartitionStyle     = (PartitionStyleEnum)Enum.ToObject(typeof(PartitionStyleEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "PartitionStyle"));
     this.Signature          = SpacesApiUtil.GetManagementObjectValue <uint>(m, "Signature");
     this.Guid               = SpacesApiUtil.GetManagementObjectValue <string>(m, "Guid");
     this.OfflineReason      = (OfflineReasonEnum)Enum.ToObject(typeof(OfflineReasonEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "OfflineReason"));
     this.IsReadOnly         = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsReadOnly");
     this.IsSystem           = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsSystem");
     this.IsClustered        = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsClustered");
     this.IsBoot             = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsBoot");
     this.BootFromDisk       = SpacesApiUtil.GetManagementObjectValue <bool>(m, "BootFromDisk");
 }
Example #5
0
 public virtual void FromManagementObject(ManagementObject m)
 {
     this.ObjectId             = SpacesApiUtil.GetManagementObjectValue <string>(m, "ObjectId");
     this.UniqueId             = SpacesApiUtil.GetManagementObjectValue <string>(m, "UniqueId");
     this.PassThroughClass     = SpacesApiUtil.GetManagementObjectValue <string>(m, "PassThroughClass");
     this.PassThroughIds       = SpacesApiUtil.GetManagementObjectValue <string>(m, "PassThroughIds");
     this.PassThroughNamespace = SpacesApiUtil.GetManagementObjectValue <string>(m, "PassThroughNamespace");
     this.PassThroughServer    = SpacesApiUtil.GetManagementObjectValue <string>(m, "PassThroughServer");
 }
Example #6
0
 public override void FromManagementObject(ManagementObject m)
 {
     base.FromManagementObject(m);
     this.DriveLetter     = SpacesApiUtil.GetManagementObjectValue <char>(m, "DriveLetter");
     this.Path            = SpacesApiUtil.GetManagementObjectValue <string>(m, "Path");
     this.HealthStatus    = (VolumeHealthEnum)Enum.ToObject(typeof(VolumeHealthEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "HealthStatus"));
     this.FileSystem      = SpacesApiUtil.GetManagementObjectValue <string>(m, "FileSystem");
     this.FileSystemLabel = SpacesApiUtil.GetManagementObjectValue <string>(m, "FileSystemLabel");
     this.Size            = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "Size");
     this.SizeRemaining   = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "SizeRemaining");
     this.DriveType       = (DriveTypeEnum)Enum.ToObject(typeof(DriveTypeEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "DriveType"));
 }
Example #7
0
        public static SpacesApiError GetPhysicalDisk(string serial, ref PhysicalDisk disk)
        {
            SpacesApiError spacesApiError = SpacesApiError.Success;

            try
            {
                ManagementObjectCollection managementObjectCollection = null;
                disk = null;
                string query = string.Format("Select * From MSFT_PhysicalDisk Where SerialNumber like '%{0}'", serial);
                spacesApiError = SpacesApi.GetStorageObjectsByQuery(query, ref managementObjectCollection);
                if (spacesApiError != SpacesApiError.Success)
                {
                    return(spacesApiError);
                }
                foreach (ManagementBaseObject managementBaseObject in managementObjectCollection)
                {
                    ManagementObject m = (ManagementObject)managementBaseObject;
                    string           b = SpacesApiUtil.GetManagementObjectValue <string>(m, "SerialNumber").Trim();
                    if (serial == b)
                    {
                        disk = new PhysicalDisk();
                        disk.FromManagementObject(m);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                spacesApiError = SpacesApiError.Failed;
                if (SpacesApi.DebugOn)
                {
                    SpacesApi.Debug("Failed to get physical disk: {0}", new object[]
                    {
                        ex
                    });
                }
            }
            return(spacesApiError);
        }
Example #8
0
 public override void FromManagementObject(ManagementObject m)
 {
     base.FromManagementObject(m);
     this.DiskNumber        = SpacesApiUtil.GetManagementObjectValue <uint>(m, "DiskNumber");
     this.PartitionNumber   = SpacesApiUtil.GetManagementObjectValue <uint>(m, "PartitionNumber");
     this.DriveLetter       = SpacesApiUtil.GetManagementObjectValue <char>(m, "DriveLetter");
     this.AccessPaths       = SpacesApiUtil.ManagementObjectArrayToList <string, string>(m["AccessPaths"]);
     this.OperationalStatus = (DiskOperationalStatusEnum)Enum.ToObject(typeof(DiskOperationalStatusEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "OperationalStatus"));
     this.TransitionState   = (PartitionTransitionStateEnum)Enum.ToObject(typeof(PartitionTransitionStateEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "TransitionState"));
     this.Offset            = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "Offset");
     this.Size                 = SpacesApiUtil.GetManagementObjectValue <ulong>(m, "Size");
     this.MbrType              = (MbrTypeEnum)Enum.ToObject(typeof(MbrTypeEnum), SpacesApiUtil.GetManagementObjectValue <ushort>(m, "MbrType"));
     this.GptType              = SpacesApiUtil.GetManagementObjectValue <string>(m, "GptType");
     this.Guid                 = SpacesApiUtil.GetManagementObjectValue <string>(m, "Guid");
     this.IsReadOnly           = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsReadOnly");
     this.IsOffline            = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsOffline");
     this.IsSystem             = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsSystem");
     this.IsBoot               = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsBoot");
     this.IsActive             = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsActive");
     this.IsHidden             = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsHidden");
     this.IsShadowCopy         = SpacesApiUtil.GetManagementObjectValue <bool>(m, "IsShadowCopy");
     this.NoDefaultDriveLetter = SpacesApiUtil.GetManagementObjectValue <bool>(m, "NoDefaultDriveLetter");
 }