ModifySanResources(
            string poolId,
            string[] newHostResources)
        {
            if (newHostResources == null)
            {
                Console.WriteLine("Deleting all resources assigned to Virtual SAN {0} ...", poolId);
            }
            else
            {
                Console.WriteLine("Modifying resources assigned to Virtual SAN {0} ...", poolId);
            }

            ManagementScope scope = FibreChannelUtilities.GetFcScope();

            using (ManagementObject rpConfigurationService =
                       FibreChannelUtilities.GetResourcePoolConfigurationService(scope))
            {
                string poolPath = FibreChannelUtilities.GetResourcePoolPath(scope, poolId);

                string[] parentPoolPathArray = new string[1];
                parentPoolPathArray[0] = FibreChannelUtilities.GetResourcePoolPath(scope, null);

                string[] newPoolAllocationSettingsArray = new string[1];
                newPoolAllocationSettingsArray[0] =
                    FibreChannelUtilities.GetNewPoolAllocationSettings(scope, poolId, newHostResources);

                using (ManagementBaseObject inParams =
                           rpConfigurationService.GetMethodParameters("ModifyPoolResources"))
                {
                    inParams["ChildPool"]          = poolPath;
                    inParams["ParentPools"]        = parentPoolPathArray;
                    inParams["AllocationSettings"] = newPoolAllocationSettingsArray;

                    using (ManagementBaseObject outParams =
                               rpConfigurationService.InvokeMethod(
                                   "ModifyPoolResources",
                                   inParams,
                                   null))
                    {
                        WmiUtilities.ValidateOutput(outParams, scope, true, true);
                    }
                }
            }

            if (newHostResources == null)
            {
                Console.WriteLine("Successfully deleted all resources assigned to Virtual SAN {0}", poolId);
            }
            else
            {
                Console.WriteLine("Successfully modified resources assigned to Virtual SAN {0}", poolId);
            }
        }
        CreateSan(
            string poolId,
            string notes,
            string[] hostResources)
        {
            Console.WriteLine("Creating Virtual SAN - {0} ...", poolId);

            ManagementScope scope = FibreChannelUtilities.GetFcScope();
            string          resourcePoolSettingData =
                FibreChannelUtilities.GetSettingsForPool(scope, poolId, notes);

            //
            // Fibre Channel Connection Resource Pools have only 1 parent, the primordial pool.
            //
            string[] parentPoolPathArray = new string[1];
            parentPoolPathArray[0] = FibreChannelUtilities.GetResourcePoolPath(scope, null);

            string[] resourceAllocationSettingDataArray = new string[1];
            resourceAllocationSettingDataArray[0] =
                FibreChannelUtilities.GetNewPoolAllocationSettings(scope, poolId, hostResources);

            using (ManagementObject rpConfigurationService =
                       FibreChannelUtilities.GetResourcePoolConfigurationService(scope))
                using (ManagementBaseObject inParams =
                           rpConfigurationService.GetMethodParameters("CreatePool"))
                {
                    inParams["PoolSettings"]       = resourcePoolSettingData;
                    inParams["ParentPools"]        = parentPoolPathArray;
                    inParams["AllocationSettings"] = resourceAllocationSettingDataArray;

                    using (ManagementBaseObject outParams =
                               rpConfigurationService.InvokeMethod(
                                   "CreatePool",
                                   inParams,
                                   null))
                    {
                        WmiUtilities.ValidateOutput(outParams, scope, true, true);
                    }
                }

            Console.WriteLine("Successfully Created Virtual SAN: {0}", poolId);
        }