DeleteSan(
            string poolId)
        {
            Console.WriteLine("Deleting Virtual SAN - {0} ...", poolId);

            ManagementScope scope = FibreChannelUtilities.GetFcScope();

            using (ManagementObject rpConfigurationService =
                       FibreChannelUtilities.GetResourcePoolConfigurationService(scope))
                using (ManagementBaseObject inParams =
                           rpConfigurationService.GetMethodParameters("DeletePool"))
                {
                    inParams["Pool"] = FibreChannelUtilities.GetResourcePoolPath(scope, poolId);

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

            Console.WriteLine("Successfully deleted Virtual SAN - {0}", poolId);
        }
        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);
        }
        ModifySanSettings(
            string poolId,
            string newPoolId
            )
        {
            Console.WriteLine("Modifying a Virtual SAN's settings:");
            Console.WriteLine("\tSAN Name: {0} (change to {1})", poolId, newPoolId);

            ManagementScope scope = FibreChannelUtilities.GetFcScope();

            using (ManagementObject rpConfigurationService =
                       FibreChannelUtilities.GetResourcePoolConfigurationService(scope))
            {
                string resourcePoolSettingData = FibreChannelUtilities.GetSettingsForPool(scope,
                                                                                          newPoolId,
                                                                                          null);
                string poolPath = FibreChannelUtilities.GetResourcePoolPath(scope, poolId);
                using (ManagementBaseObject inParams =
                           rpConfigurationService.GetMethodParameters("ModifyPoolSettings"))
                {
                    inParams["ChildPool"]    = poolPath;
                    inParams["PoolSettings"] = resourcePoolSettingData;

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

            Console.WriteLine("Successfully renamed Virtual SAN: from {0} to {1}", poolId, newPoolId);
        }