BuildSanInfo() { ManagementObjectCollection fcPools = WmiUtilities.GetResourcePools(FibreChannelUtilities.FcConnectionResourceType, FibreChannelUtilities.FcConnectionResourceSubType, FibreChannelUtilities.GetFcScope()); List <SanInfo> sanInfoList = new List <SanInfo>(); foreach (ManagementObject san in fcPools) { // // Virtual SANs are resource pools that are children of the primordial pool. // if (!(bool)san["Primordial"]) { SanInfo sanInfo = new SanInfo(); sanInfo.SanName = (string)san["PoolId"]; // // The resources assigned to the Virtual SAN are present in the HostResource // property of the associated Resource Allocation Setting Data. // using (ManagementObjectCollection poolRasds = san.GetRelated("Msvm_FcPortAllocationSettingData")) using (ManagementObject allocationSettingData = WmiUtilities.GetFirstObjectFromCollection(poolRasds)) { sanInfo.HostResources = (string[])allocationSettingData["HostResource"]; } sanInfoList.Add(sanInfo); } } if (sanInfoList.Count == 0) { Console.WriteLine("No Virtual SANs detected in the system."); } return(sanInfoList); }
BuildSanInfo() { ManagementObjectCollection fcPools = WmiUtilities.GetResourcePools(FibreChannelUtilities.FcConnectionResourceType, FibreChannelUtilities.FcConnectionResourceSubType, FibreChannelUtilities.GetFcScope()); List<SanInfo> sanInfoList = new List<SanInfo>(); foreach (ManagementObject san in fcPools) { // // Virtual SANs are resource pools that are children of the primordial pool. // if (!(bool)san["Primordial"]) { SanInfo sanInfo = new SanInfo(); sanInfo.SanName = (string) san["PoolId"]; // // The resources assigned to the Virtual SAN are present in the HostResource // property of the associated Resource Allocation Setting Data. // using (ManagementObjectCollection poolRasds = san.GetRelated("Msvm_FcPortAllocationSettingData")) using (ManagementObject allocationSettingData = WmiUtilities.GetFirstObjectFromCollection(poolRasds)) { sanInfo.HostResources = (string[])allocationSettingData["HostResource"]; } sanInfoList.Add(sanInfo); } } if (sanInfoList.Count == 0) { Console.WriteLine("No Virtual SANs detected in the system."); } return sanInfoList; }