Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

change drs settings for a specific vm

$
0
0

I’m having an intermittent problem when deploying vms from orchestrator and it appears it may be related to vmotion happening at a bad time in the process.

 

From a few posts on the forums and with the help of Onyx, I think I have some working code but I'm afraid to try it in case I mess up my cluster settings. Can someone take a look and let me know what they think?

 

The Onyx generated code has a lot more (shown at the end for referece) options. If I don't include those options, will all my cluster settings be reset when trying to adjust one vm?

 

thanks

 

set drs settings on vm to manual:

 

var myKey = System.getModule("com.mycompany.actions").getVmIdByName("VM123") //this returns the .id property, as a string, of a VcVirtualMachine when passed the name
var spec = new VcClusterConfigSpecEx();
spec.drsVmConfigSpec = new Array(VcClusterDrsVmConfigSpec, 1);
spec.drsVmConfigSpec[0] = new VcClusterDrsVmConfigSpec();
spec.drsVmConfigSpec[0].operation = VcArrayUpdateOperation.add;
spec.drsVmConfigSpec[0].info = new VcClusterDrsVmConfigInfo();
spec.drsVmConfigSpec[0].info.key = Server.findForType("VC:VirtualMachine", managedObject.vimHost.id + "/"+myKey+"\"");;
spec.drsVmConfigSpec[0].info.behavior = VcDrsBehavior.manual;

managedObject.reconfigureComputeResource_Task(spec, true);  // ClusterComputeResource


to remove the custom setting:

 

var myKey = System.getModule("com.mycompany.actions").getVmIdByName("VM123") //this returns the .id property, as a string, of a VcVirtualMachine when passed the name
var spec = new VcClusterConfigSpecEx();
spec.drsVmConfigSpec = new Array(VcClusterDrsVmConfigSpec, 1);
spec.drsVmConfigSpec[0] = new VcClusterDrsVmConfigSpec();
spec.drsVmConfigSpec[0].operation = VcArrayUpdateOperation.remove;
spec.drsVmConfigSpec[0].removeKey = myKey;

 

code generated by onyx
var spec = new VcClusterConfigSpecEx();
spec.vmSwapPlacement = "vmDirectory";
spec.dasConfig = new VcClusterDasConfigInfo();
spec.dasConfig.vmMonitoring = "vmMonitoringDisabled";
spec.dasConfig.defaultVmSettings = new VcClusterDasVmSettings();
spec.dasConfig.defaultVmSettings.restartPriority = "medium";
spec.dasConfig.defaultVmSettings.isolationResponse = "none";
spec.dasConfig.defaultVmSettings.vmToolsMonitoringSettings = new VcClusterVmToolsMonitoringSettings();
spec.dasConfig.defaultVmSettings.vmToolsMonitoringSettings.enabled = true;
spec.dasConfig.defaultVmSettings.vmToolsMonitoringSettings.vmMonitoring = "vmMonitoringDisabled";
spec.dasConfig.defaultVmSettings.vmToolsMonitoringSettings.failureInterval = 30;
spec.dasConfig.defaultVmSettings.vmToolsMonitoringSettings.minUpTime = 120;
spec.dasConfig.defaultVmSettings.vmToolsMonitoringSettings.maxFailures = 3;
spec.dasConfig.defaultVmSettings.vmToolsMonitoringSettings.maxFailureWindow = 3600;
spec.dasConfig.option = System.getModule("com.vmware.onyx").array(VcOptionValue, 1);
spec.dasConfig.option[0] = new VcOptionValue();
spec.dasConfig.option[0].key = "das.ignoreRedundantNetWarning";
spec.dasConfig.option[0].value = true;
spec.drsConfig = new VcClusterDrsConfigInfo();
spec.drsConfig.enabled = true;
spec.drsConfig.defaultVmBehavior = VcDrsBehavior.fullyAutomated;
spec.drsConfig.vmotionRate = 2;
spec.drsVmConfigSpec = System.getModule("com.vmware.onyx").array(VcClusterDrsVmConfigSpec, 1);
spec.drsVmConfigSpec[0] = new VcClusterDrsVmConfigSpec();
spec.drsVmConfigSpec[0].operation = VcArrayUpdateOperation.add;
spec.drsVmConfigSpec[0].info = new VcClusterDrsVmConfigInfo();
spec.drsVmConfigSpec[0].info.key = Server.findForType("VC:VirtualMachine", managedObject.vimHost.id + "/vm-1598");;
spec.drsVmConfigSpec[0].info.enabled = true;
spec.drsVmConfigSpec[0].info.behavior = VcDrsBehavior.manual;
spec.dpmConfig = new VcClusterDpmConfigInfo();
spec.dpmConfig.enabled = false;
spec.dpmConfig.hostPowerActionRate = 3;

managedObject.reconfigureComputeResource_Task(spec, true);  // ClusterComputeResource


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>