Ejemplo n.º 1
0
        /// <summary>
        /// Method to delete VM Anti AffinityRule
        /// </summary>
        /// <param name="podName">string</param>
        /// <param name="ruleName">string</param>
        private void DeleteVmAntiAffinityRule(string podName, string ruleName)
        {
            ManagedObjectReference srmRef  = cb._connection._sic.storageResourceManager;
            ManagedObjectReference sdrsMor = cb._svcUtil.getEntityByName("StoragePod", podName);

            if (sdrsMor != null)
            {
                PodStorageDrsEntry          podStorageDrsEntry     = (PodStorageDrsEntry)cb._svcUtil.GetDynamicProperty(sdrsMor, "podStorageDrsEntry");
                ClusterRuleSpec             ruleSpec               = new ClusterRuleSpec();
                ClusterRuleInfo[]           clusterRuleInfo        = podStorageDrsEntry.storageDrsConfig.podConfig.rule;
                StorageDrsConfigSpec        sdrsConfigSpec         = new StorageDrsConfigSpec();
                StorageDrsPodConfigSpec     podConfigSpec          = new StorageDrsPodConfigSpec();
                ClusterAntiAffinityRuleSpec vmAntiAffinityRuleSpec = null;
                if (clusterRuleInfo != null)
                {
                    foreach (ClusterRuleInfo vmRule in clusterRuleInfo)
                    {
                        if (vmRule.name.Equals(ruleName))
                        {
                            vmAntiAffinityRuleSpec = (ClusterAntiAffinityRuleSpec)vmRule;
                        }
                    }
                    if (vmAntiAffinityRuleSpec != null)
                    {
                        ruleSpec.operation           = ArrayUpdateOperation.remove;
                        ruleSpec.info                = vmAntiAffinityRuleSpec;
                        ruleSpec.removeKey           = vmAntiAffinityRuleSpec.key;
                        podConfigSpec.rule           = new ClusterRuleSpec[] { ruleSpec };
                        sdrsConfigSpec.podConfigSpec = podConfigSpec;
                        ManagedObjectReference taskmor =
                            cb._connection._service.ConfigureStorageDrsForPod_Task(srmRef,
                                                                                   sdrsMor, sdrsConfigSpec, true);
                        if (taskmor != null)
                        {
                            String status = cb.getServiceUtil().WaitForTask(taskmor);
                            if (status.Equals("sucess"))
                            {
                                Console.WriteLine("Success: Delete VmAntiAffinity Rule.");
                            }
                            else
                            {
                                Console.WriteLine("Failure: Delete VmAntiAffinity Rule.");
                                throw new Exception(status);
                            }
                        }
                    }
                    else
                    {
                        string msg = "\nFailure: Rule " + ruleName + " not found.";
                        throw new Exception(msg);
                    }
                }
            }
            else
            {
                throw new Exception("Storage Pod " + podName + "not found");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create Object of StorageDrsConfigSpec
        /// </summary>
        /// <param name="behavior">string</param>
        /// <param name="loadBalanceInterval">string</param>
        /// <returns></returns>
        private StorageDrsConfigSpec GetStorageDrsConfigSpec(string behavior, string loadBalanceInterval)
        {
            StorageDrsConfigSpec    sdrsConfigSpec = new StorageDrsConfigSpec();
            StorageDrsPodConfigSpec podConfigSpec  = new StorageDrsPodConfigSpec();

            if (behavior.Equals("true"))
            {
                podConfigSpec.defaultVmBehavior = "automated";
            }
            else
            {
                podConfigSpec.defaultVmBehavior = "manual";
            }
            podConfigSpec.defaultIntraVmAffinity          = true;
            podConfigSpec.defaultIntraVmAffinitySpecified = true;
            podConfigSpec.enabled          = true;
            podConfigSpec.enabledSpecified = true;
            StorageDrsIoLoadBalanceConfig sdrsIoLoadBalanceConfig =
                new StorageDrsIoLoadBalanceConfig();

            if (ioLatencythreshold != null)
            {
                sdrsIoLoadBalanceConfig.ioLatencyThreshold          = int.Parse(ioLatencythreshold);
                sdrsIoLoadBalanceConfig.ioLatencyThresholdSpecified = true;
            }
            if (ioLoadImbalanceThreshold != null)
            {
                sdrsIoLoadBalanceConfig.ioLoadImbalanceThreshold          = int.Parse(ioLoadImbalanceThreshold);
                sdrsIoLoadBalanceConfig.ioLoadImbalanceThresholdSpecified = true;
            }
            podConfigSpec.ioLoadBalanceConfig           = sdrsIoLoadBalanceConfig;
            podConfigSpec.ioLoadBalanceEnabled          = true;
            podConfigSpec.ioLoadBalanceEnabledSpecified = true;
            if (loadBalanceInterval != null)
            {
                podConfigSpec.loadBalanceInterval          = int.Parse(loadBalanceInterval);
                podConfigSpec.loadBalanceIntervalSpecified = true;
            }
            StorageDrsSpaceLoadBalanceConfig sdrsSpaceLoadBalanceConfig =
                new StorageDrsSpaceLoadBalanceConfig();

            if (spaceUtilizationThreshold != null)
            {
                sdrsSpaceLoadBalanceConfig.spaceUtilizationThreshold          = int.Parse(spaceUtilizationThreshold);
                sdrsSpaceLoadBalanceConfig.spaceUtilizationThresholdSpecified = true;
            }
            if (minSpaceUtilizationDifference != null)
            {
                sdrsSpaceLoadBalanceConfig.minSpaceUtilizationDifference          = int.Parse(minSpaceUtilizationDifference);
                sdrsSpaceLoadBalanceConfig.minSpaceUtilizationDifferenceSpecified = true;
            }
            podConfigSpec.spaceLoadBalanceConfig = sdrsSpaceLoadBalanceConfig;
            sdrsConfigSpec.podConfigSpec         = podConfigSpec;
            return(sdrsConfigSpec);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create Object of StorageDrsConfigSpec
        /// </summary>
        /// <param name="behavior">string</param>
        /// <param name="loadBalanceInterval">string</param>
        /// <returns></returns>
        private StorageDrsConfigSpec GetStorageDrsConfigSpec(string behavior, string loadBalanceInterval)
        {

            StorageDrsConfigSpec sdrsConfigSpec = new StorageDrsConfigSpec();
            StorageDrsPodConfigSpec podConfigSpec = new StorageDrsPodConfigSpec();
            if (behavior.Equals("true"))
            {
                podConfigSpec.defaultVmBehavior = "automated";
            }
            else
            {
                podConfigSpec.defaultVmBehavior = "manual";
            }
            podConfigSpec.defaultIntraVmAffinity = true;
            podConfigSpec.defaultIntraVmAffinitySpecified = true;
            podConfigSpec.enabled = true;
            podConfigSpec.enabledSpecified = true;
            StorageDrsIoLoadBalanceConfig sdrsIoLoadBalanceConfig =
            new StorageDrsIoLoadBalanceConfig();
            if (ioLatencythreshold != null)
            {
                sdrsIoLoadBalanceConfig.ioLatencyThreshold = int.Parse(ioLatencythreshold);
                sdrsIoLoadBalanceConfig.ioLatencyThresholdSpecified = true;
            }
            if (ioLoadImbalanceThreshold != null)
            {
                sdrsIoLoadBalanceConfig.ioLoadImbalanceThreshold = int.Parse(ioLoadImbalanceThreshold);
                sdrsIoLoadBalanceConfig.ioLoadImbalanceThresholdSpecified = true;
            }
            podConfigSpec.ioLoadBalanceConfig = sdrsIoLoadBalanceConfig;
            podConfigSpec.ioLoadBalanceEnabled = true;
            podConfigSpec.ioLoadBalanceEnabledSpecified = true;
            if (loadBalanceInterval != null)
            {
                podConfigSpec.loadBalanceInterval = int.Parse(loadBalanceInterval);
                podConfigSpec.loadBalanceIntervalSpecified = true;
            }
            StorageDrsSpaceLoadBalanceConfig sdrsSpaceLoadBalanceConfig =
                             new StorageDrsSpaceLoadBalanceConfig();
            if (spaceUtilizationThreshold != null)
            {
                sdrsSpaceLoadBalanceConfig.spaceUtilizationThreshold = int.Parse(spaceUtilizationThreshold);
                sdrsSpaceLoadBalanceConfig.spaceUtilizationThresholdSpecified = true;
            }
            if (minSpaceUtilizationDifference != null)
            {
                sdrsSpaceLoadBalanceConfig.minSpaceUtilizationDifference = int.Parse(minSpaceUtilizationDifference);
                sdrsSpaceLoadBalanceConfig.minSpaceUtilizationDifferenceSpecified = true;
            }
            podConfigSpec.spaceLoadBalanceConfig = sdrsSpaceLoadBalanceConfig;
            sdrsConfigSpec.podConfigSpec = podConfigSpec;
            return sdrsConfigSpec;

        }
Ejemplo n.º 4
0
        /// <summary>
        /// Method to add VmAntiAffinityRule
        /// </summary>
        /// <param name="podName">string</param>
        /// <param name="ruleName">string</param>
        /// <param name="enabled">string</param>
        /// <param name="vm">string array</param>
        private void AddVmAntiAffinityRule(string podName,
                                           string ruleName, string enabled,
                                           string[] vm)
        {
            ManagedObjectReference srmRef  = cb._connection._sic.storageResourceManager;
            ManagedObjectReference sdrsMor = cb._svcUtil.getEntityByName("StoragePod", podName);

            if (sdrsMor != null)
            {
                ManagedObjectReference      vmMoref                = null;
                StorageDrsConfigSpec        sdrsConfigSpec         = new StorageDrsConfigSpec();
                StorageDrsPodConfigSpec     podConfigSpec          = new StorageDrsPodConfigSpec();
                ClusterAntiAffinityRuleSpec vmAntiAffinityRuleSpec =
                    new ClusterAntiAffinityRuleSpec();
                ClusterRuleSpec ruleSpec = new ClusterRuleSpec();
                vmAntiAffinityRuleSpec.name = ruleName;
                List <ManagedObjectReference> mor = new List <ManagedObjectReference>();
                if (enabled.Equals("true"))
                {
                    vmAntiAffinityRuleSpec.enabled          = true;
                    vmAntiAffinityRuleSpec.enabledSpecified = true;
                }
                else
                {
                    vmAntiAffinityRuleSpec.enabled          = false;
                    vmAntiAffinityRuleSpec.enabledSpecified = false;
                }
                foreach (string vmname in vm)
                {
                    vmMoref = cb._svcUtil.getEntityByName("VirtualMachine", vmname);
                    if (vmMoref != null)
                    {
                        mor.Add(vmMoref);
                    }
                    else
                    {
                        string message = "Failure: " + vmname + "VM not found";
                        throw new Exception(message);
                    }
                }
                vmAntiAffinityRuleSpec.vm                   = mor.ToArray();
                vmAntiAffinityRuleSpec.userCreated          = true;
                vmAntiAffinityRuleSpec.userCreatedSpecified = true;
                ruleSpec.info                = vmAntiAffinityRuleSpec;
                ruleSpec.operation           = ArrayUpdateOperation.add;
                podConfigSpec.rule           = new ClusterRuleSpec[] { ruleSpec };
                sdrsConfigSpec.podConfigSpec = podConfigSpec;
                ManagedObjectReference taskmor =
                    cb._connection._service.ConfigureStorageDrsForPod_Task(srmRef,
                                                                           sdrsMor, sdrsConfigSpec, true);
                if (taskmor != null)
                {
                    String status = cb.getServiceUtil().WaitForTask(
                        taskmor);
                    if (status.Equals("sucess"))
                    {
                        Console.WriteLine("Success: Adding VmAntiAffinity Rule.");
                    }
                    else
                    {
                        Console.WriteLine("Failure: Adding VmAntiAffinity Rule.");
                        throw new Exception(status);
                    }
                }
            }
            else
            {
                throw new Exception("Storage Pod " + podName + "not found");
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Method to modify VM Anti Affinity Rule
        /// </summary>
        /// <param name="podName">string</param>
        /// <param name="ruleName">string</param>
        /// <param name="newRuleName">string</param>
        /// <param name="enabled">string</param>
        /// <param name="vmList">string array</param>
        private void ModifyVmAntiAffinityRule(string podName, string ruleName,
                                              string newRuleName, string enabled,
                                              string[] vmList)
        {
            ManagedObjectReference srmRef  = cb._connection._sic.storageResourceManager;
            ManagedObjectReference sdrsMor = cb._svcUtil.getEntityByName("StoragePod", podName);

            if (sdrsMor != null)
            {
                PodStorageDrsEntry            podStorageDrsEntry     = (PodStorageDrsEntry)cb._svcUtil.GetDynamicProperty(sdrsMor, "podStorageDrsEntry");
                ClusterRuleInfo[]             clusterRuleInfo        = podStorageDrsEntry.storageDrsConfig.podConfig.rule;
                ClusterRuleSpec               ruleSpec               = new ClusterRuleSpec();
                List <ManagedObjectReference> vmMorefList            = new List <ManagedObjectReference>();
                ManagedObjectReference        vmMoref                = null;
                StorageDrsConfigSpec          sdrsConfigSpec         = new StorageDrsConfigSpec();
                StorageDrsPodConfigSpec       podConfigSpec          = new StorageDrsPodConfigSpec();
                ClusterAntiAffinityRuleSpec   vmAntiAffinityRuleSpec = null;
                foreach (ClusterRuleInfo vmRule in clusterRuleInfo)
                {
                    if (vmRule.name.Equals(ruleName))
                    {
                        vmAntiAffinityRuleSpec = (ClusterAntiAffinityRuleSpec)vmRule;
                    }
                }

                if (vmAntiAffinityRuleSpec != null)
                {
                    if (newRuleName != null)
                    {
                        vmAntiAffinityRuleSpec.name = newRuleName;
                    }

                    if (enabled.Equals("true"))
                    {
                        vmAntiAffinityRuleSpec.enabled          = true;
                        vmAntiAffinityRuleSpec.enabledSpecified = true;
                    }
                    else
                    {
                        vmAntiAffinityRuleSpec.enabled          = false;
                        vmAntiAffinityRuleSpec.enabledSpecified = false;
                    }

                    foreach (string vmname in vmList)
                    {
                        vmMoref = cb._svcUtil.getEntityByName("VirtualMachine", vmname);
                        if (vmMoref != null)
                        {
                            vmMorefList.Add(vmMoref);
                        }
                        else
                        {
                            string message = "Failure: " + vmname + "VM not found";
                            throw new Exception(message);
                        }
                    }
                    vmAntiAffinityRuleSpec.vm = vmMorefList.ToArray();

                    vmAntiAffinityRuleSpec.userCreated          = true;
                    vmAntiAffinityRuleSpec.userCreatedSpecified = true;
                    ruleSpec.info                = vmAntiAffinityRuleSpec;
                    ruleSpec.operation           = ArrayUpdateOperation.edit;
                    podConfigSpec.rule           = new ClusterRuleSpec[] { ruleSpec };
                    sdrsConfigSpec.podConfigSpec = podConfigSpec;
                    ManagedObjectReference taskmor =
                        cb._connection._service.ConfigureStorageDrsForPod_Task(srmRef,
                                                                               sdrsMor, sdrsConfigSpec, true);

                    if (taskmor != null)
                    {
                        String status = cb.getServiceUtil().WaitForTask(
                            taskmor);
                        if (status.Equals("sucess"))
                        {
                            Console.WriteLine("Success: Modifying VmAntiAffinity Rule.");
                        }
                        else
                        {
                            Console.WriteLine("Failure: Modifying VmAntiAffinity Rule.");
                            throw new Exception(status);
                        }
                    }
                }
                else
                {
                    string msg = "\nFailure: Rule " + ruleName + " not found.";
                    throw new Exception(msg);
                }
            }
            else
            {
                throw new Exception("Storage Pod " + podName + "not found");
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Method to add VmAntiAffinityRule
        /// </summary>
        /// <param name="podName">string</param>
        /// <param name="ruleName">string</param>
        /// <param name="enabled">string</param>
        /// <param name="vm">string array</param>
        private void AddVmAntiAffinityRule(string podName,
                                           string ruleName, string enabled,
                                           string[] vm)
        {
            ManagedObjectReference srmRef = cb._connection._sic.storageResourceManager;
            ManagedObjectReference sdrsMor = cb._svcUtil.getEntityByName("StoragePod", podName);
            if (sdrsMor != null)
            {
                ManagedObjectReference vmMoref = null;
                StorageDrsConfigSpec sdrsConfigSpec = new StorageDrsConfigSpec();
                StorageDrsPodConfigSpec podConfigSpec = new StorageDrsPodConfigSpec();
                ClusterAntiAffinityRuleSpec vmAntiAffinityRuleSpec =
               new ClusterAntiAffinityRuleSpec();
                ClusterRuleSpec ruleSpec = new ClusterRuleSpec();
                vmAntiAffinityRuleSpec.name = ruleName;
                List<ManagedObjectReference> mor = new List<ManagedObjectReference>();
                if (enabled.Equals("true"))
                {
                    vmAntiAffinityRuleSpec.enabled = true;
                    vmAntiAffinityRuleSpec.enabledSpecified = true;
                }
                else
                {
                    vmAntiAffinityRuleSpec.enabled = false;
                    vmAntiAffinityRuleSpec.enabledSpecified = false;
                }
                foreach (string vmname in vm)
                {
                    vmMoref = cb._svcUtil.getEntityByName("VirtualMachine", vmname);
                    if (vmMoref != null)
                    {
                        mor.Add(vmMoref);
                    }
                    else
                    {
                        string message = "Failure: " + vmname + "VM not found";
                        throw new Exception(message);
                    }
                }
                vmAntiAffinityRuleSpec.vm = mor.ToArray();
                vmAntiAffinityRuleSpec.userCreated = true;
                vmAntiAffinityRuleSpec.userCreatedSpecified = true;
                ruleSpec.info = vmAntiAffinityRuleSpec;
                ruleSpec.operation = ArrayUpdateOperation.add;
                podConfigSpec.rule = new ClusterRuleSpec[] { ruleSpec };
                sdrsConfigSpec.podConfigSpec = podConfigSpec;
                ManagedObjectReference taskmor =
                       cb._connection._service.ConfigureStorageDrsForPod_Task(srmRef,
                       sdrsMor, sdrsConfigSpec, true);
                if (taskmor != null)
                {
                    String status = cb.getServiceUtil().WaitForTask(
                          taskmor);
                    if (status.Equals("sucess"))
                    {
                        Console.WriteLine("Success: Adding VmAntiAffinity Rule.");
                    }
                    else
                    {
                        Console.WriteLine("Failure: Adding VmAntiAffinity Rule.");
                        throw new Exception(status);
                    }
                }

            }
            else
            {
                throw new Exception("Storage Pod " + podName + "not found");
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Method to delete VM Anti AffinityRule
 /// </summary>
 /// <param name="podName">string</param>
 /// <param name="ruleName">string</param>
 private void DeleteVmAntiAffinityRule(string podName, string ruleName)
 {
     ManagedObjectReference srmRef = cb._connection._sic.storageResourceManager;
     ManagedObjectReference sdrsMor = cb._svcUtil.getEntityByName("StoragePod", podName);
     if (sdrsMor != null)
     {
         PodStorageDrsEntry podStorageDrsEntry = (PodStorageDrsEntry)cb._svcUtil.GetDynamicProperty(sdrsMor, "podStorageDrsEntry");
         ClusterRuleSpec ruleSpec = new ClusterRuleSpec();
         ClusterRuleInfo[] clusterRuleInfo = podStorageDrsEntry.storageDrsConfig.podConfig.rule;
         StorageDrsConfigSpec sdrsConfigSpec = new StorageDrsConfigSpec();
         StorageDrsPodConfigSpec podConfigSpec = new StorageDrsPodConfigSpec();
         ClusterAntiAffinityRuleSpec vmAntiAffinityRuleSpec = null;
         if (clusterRuleInfo != null)
         {
             foreach (ClusterRuleInfo vmRule in clusterRuleInfo)
             {
                 if (vmRule.name.Equals(ruleName))
                 {
                     vmAntiAffinityRuleSpec = (ClusterAntiAffinityRuleSpec)vmRule;
                 }
             }
             if (vmAntiAffinityRuleSpec != null)
             {
                 ruleSpec.operation = ArrayUpdateOperation.remove;
                 ruleSpec.info = vmAntiAffinityRuleSpec;
                 ruleSpec.removeKey = vmAntiAffinityRuleSpec.key;
                 podConfigSpec.rule = new ClusterRuleSpec[] { ruleSpec };
                 sdrsConfigSpec.podConfigSpec = podConfigSpec;
                 ManagedObjectReference taskmor =
                        cb._connection._service.ConfigureStorageDrsForPod_Task(srmRef,
                  sdrsMor, sdrsConfigSpec, true);
                 if (taskmor != null)
                 {
                     String status = cb.getServiceUtil().WaitForTask(taskmor);
                     if (status.Equals("sucess"))
                     {
                         Console.WriteLine("Success: Delete VmAntiAffinity Rule.");
                     }
                     else
                     {
                         Console.WriteLine("Failure: Delete VmAntiAffinity Rule.");
                         throw new Exception(status);
                     }
                 }
             }
             else
             {
                 string msg = "\nFailure: Rule " + ruleName + " not found.";
                 throw new Exception(msg);
             }
         }
     }
     else
     {
         throw new Exception("Storage Pod " + podName + "not found");
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Method to modify VM Anti Affinity Rule
        /// </summary>
        /// <param name="podName">string</param>
        /// <param name="ruleName">string</param>
        /// <param name="newRuleName">string</param>
        /// <param name="enabled">string</param>
        /// <param name="vmList">string array</param>
        private void ModifyVmAntiAffinityRule(string podName, string ruleName,
                                              string newRuleName, string enabled,
                                              string[] vmList)
        {
            ManagedObjectReference srmRef = cb._connection._sic.storageResourceManager;
            ManagedObjectReference sdrsMor = cb._svcUtil.getEntityByName("StoragePod", podName);
            if (sdrsMor != null)
            {
                PodStorageDrsEntry podStorageDrsEntry = (PodStorageDrsEntry)cb._svcUtil.GetDynamicProperty(sdrsMor, "podStorageDrsEntry");
                ClusterRuleInfo[] clusterRuleInfo = podStorageDrsEntry.storageDrsConfig.podConfig.rule;
                ClusterRuleSpec ruleSpec = new ClusterRuleSpec();
                List<ManagedObjectReference> vmMorefList = new List<ManagedObjectReference>();
                ManagedObjectReference vmMoref = null;
                StorageDrsConfigSpec sdrsConfigSpec = new StorageDrsConfigSpec();
                StorageDrsPodConfigSpec podConfigSpec = new StorageDrsPodConfigSpec();
                ClusterAntiAffinityRuleSpec vmAntiAffinityRuleSpec = null;
                foreach (ClusterRuleInfo vmRule in clusterRuleInfo)
                {
                    if (vmRule.name.Equals(ruleName))
                    {
                        vmAntiAffinityRuleSpec = (ClusterAntiAffinityRuleSpec)vmRule;
                    }
                }

                if (vmAntiAffinityRuleSpec != null)
                {
                    if (newRuleName != null)
                    {
                        vmAntiAffinityRuleSpec.name = newRuleName;
                    }

                    if (enabled.Equals("true"))
                    {
                        vmAntiAffinityRuleSpec.enabled = true;
                        vmAntiAffinityRuleSpec.enabledSpecified = true;
                    }
                    else
                    {
                        vmAntiAffinityRuleSpec.enabled = false;
                        vmAntiAffinityRuleSpec.enabledSpecified = false;
                    }

                    foreach (string vmname in vmList)
                    {
                        vmMoref = cb._svcUtil.getEntityByName("VirtualMachine", vmname);
                        if (vmMoref != null)
                        {
                            vmMorefList.Add(vmMoref);
                        }
                        else
                        {
                            string message = "Failure: " + vmname + "VM not found";
                            throw new Exception(message);
                        }
                    }
                    vmAntiAffinityRuleSpec.vm = vmMorefList.ToArray();

                    vmAntiAffinityRuleSpec.userCreated = true;
                    vmAntiAffinityRuleSpec.userCreatedSpecified = true;
                    ruleSpec.info = vmAntiAffinityRuleSpec;
                    ruleSpec.operation = ArrayUpdateOperation.edit;
                    podConfigSpec.rule = new ClusterRuleSpec[] { ruleSpec };
                    sdrsConfigSpec.podConfigSpec = podConfigSpec;
                    ManagedObjectReference taskmor =
                   cb._connection._service.ConfigureStorageDrsForPod_Task(srmRef,
                         sdrsMor, sdrsConfigSpec, true);

                    if (taskmor != null)
                    {
                        String status = cb.getServiceUtil().WaitForTask(
                              taskmor);
                        if (status.Equals("sucess"))
                        {
                            Console.WriteLine("Success: Modifying VmAntiAffinity Rule.");
                        }
                        else
                        {
                            Console.WriteLine("Failure: Modifying VmAntiAffinity Rule.");
                            throw new Exception(status);
                        }
                    }
                }
                else
                {
                    string msg = "\nFailure: Rule " + ruleName + " not found.";
                    throw new Exception(msg);
                }
            }
            else
            {
                throw new Exception("Storage Pod " + podName + "not found");
            }
        }