DeletePoolHelper(
            ManagementScope scope,
            ManagementObject rPConfigurationService,
            string resourceType,
            string resourceSubType,
            string poolId)
        {
            string poolPath =
                MsvmResourcePool.GetResourcePoolPath(
                    scope,
                    resourceType,
                    resourceSubType,
                    poolId);

            using (ManagementBaseObject inParams =
                       rPConfigurationService.GetMethodParameters(
                           "DeletePool"))
            {
                inParams["Pool"] = poolPath;

                using (ManagementBaseObject outParams =
                           rPConfigurationService.InvokeMethod(
                               "DeletePool",
                               inParams,
                               null))
                {
                    WmiUtilities.ValidateOutput(outParams, scope, true, true);
                }
            }
        }
        ModifyPoolResourcesHelper(
            ManagementScope scope,
            ManagementObject rPConfigurationService,
            string resourceType,
            string resourceSubType,
            string poolId,
            string[] parentPoolIdArray,
            string[][] parentHostResourcesArray)
        {
            string poolPath =
                MsvmResourcePool.GetResourcePoolPath(
                    scope,
                    resourceType,
                    resourceSubType,
                    poolId);

            ModifyPoolResourcesByPath(
                scope,
                rPConfigurationService,
                resourceType,
                resourceSubType,
                poolPath,
                parentPoolIdArray,
                parentHostResourcesArray);
        }
Example #3
0
        GetParentPoolArrayFromPoolIds(
            ManagementScope scope,
            string resourceType,
            string resourceSubType,
            string[] poolIdArray)
        {
            List <string> pathList = new List <string>();

            foreach (string poolId in poolIdArray)
            {
                pathList.Add(
                    MsvmResourcePool.GetResourcePoolPath(
                        scope,
                        resourceType,
                        resourceSubType,
                        poolId));
            }

            return(pathList.ToArray());
        }
        ModifyPoolSettingsHelper(
            ManagementScope scope,
            ManagementObject rPConfigurationService,
            string resourceType,
            string resourceSubType,
            string poolId,
            string resourcePoolSettingData)
        {
            string poolPath =
                MsvmResourcePool.GetResourcePoolPath(
                    scope,
                    resourceType,
                    resourceSubType,
                    poolId);

            ModifyPoolSettingsByPath(
                scope,
                rPConfigurationService,
                poolPath,
                resourcePoolSettingData);
        }
 Main(
     string[] args)
 {
     if (args.Length > 0)
     {
         if (string.Equals(args[0], "EnumerateSupportedResources", StringComparison.OrdinalIgnoreCase) &&
             args.Length == 1)
         {
             ResourceUtilities.EnumerateSupportedResources();
         }
         else if (string.Equals(args[0], "CreatePool", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 6)
         {
             MsvmResourcePoolConfigurationService.CreatePool(
                 args[1],
                 args[2],
                 args[3],
                 args[4],
                 args[5]);
         }
         else if (string.Equals(args[0], "DisplayPoolResources", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourceAllocationSettingData.DisplayPoolResourceAllocationSettingData(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "ModifyPoolResources", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 5)
         {
             MsvmResourcePoolConfigurationService.ModifyPoolResources(
                 args[1],
                 args[2],
                 args[3],
                 args[4]);
         }
         else if (string.Equals(args[0], "DisplayPoolSettings", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourcePoolSettingData.DisplayPoolResourcePoolSettingData(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "ModifyPoolSettings", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 5)
         {
             MsvmResourcePoolConfigurationService.ModifyPoolSettings(
                 args[1],
                 args[2],
                 args[3],
                 args[4]);
         }
         else if (string.Equals(args[0], "DeletePool", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourcePoolConfigurationService.DeletePool(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "DisplayPool", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourcePool.DisplayPoolVerbose(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "DisplayChildPools", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourcePool.DisplayChildPools(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "DisplayParentPools", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourcePool.DisplayParentPools(
                 args[1],
                 args[2]);
         }
         else if (string.Equals(args[0], "DisplayAllocationCapabilities", StringComparison.OrdinalIgnoreCase) &&
                  args.Length == 3)
         {
             MsvmResourceAllocationSettingData.DisplayValidResourceAllocationSettingDataSettings(
                 args[1],
                 args[2]);
         }
         else
         {
             ShowUsage();
         }
     }
     else
     {
         ShowUsage();
     }
 }