TA2650 scripts – Part 2 – Using the profile XML file for SDK programming
The XML file that can be created with the script from TA2650 scripts – Part 1 – Profiling your vSphere environment can also be used to assist you when you need to use the SDK.
As an example let’s take the “Enable VM Monitoring” option for a cluster.
This option belongs to the HA settings of a cluster. The only fact you have to know, is that the HA settings of a cluster are stored under the DAS properties in the SDK. And that is most probably the case for historical reasons.
In the XML file that contains the cluster’s profile we can easily find the property.
The next step is to find out how we can change the property.A method I use regularly, and which works in most cases, is the following.
The VmMonitoring property belongs to the ClusterDasConfigInfo object as can be seen in the Type attribute..
In the vSphere API Reference Documentation we go, via the Data Object Types, to the ClusterDasConfigInfo object. At the top of the right panel we see that the object is a property of the ClusterConfigSpec.
The ReconfigureCluster_Task page contains a message that states we should use the ReconfigureComputeResource_Task since API 2.5. Since we are working in a vSphere environment, which is API 4.0, we go for the new method.
On the reference page for the ReconfigureComputeResource_Task method we see which parameters we will need.
How to call _Task methods from the SDK will be the subject of another post.