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.

DRS-VM-monitoring

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.

DAS-VM-monitoring-1

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.

DAS-VM-monitoring-2

Via the hyperlink we go to the description of that object. On the reference page we see that the ClusterConfigSpec object is a parameter to the ReconfigureCluster_Task method.

DAS-VM-monitoring-3

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.

DAS-VM-monitoring-4On the reference page for the ReconfigureComputeResource_Task method we see which parameters we will need.

DAS-VM-monitoring-5

How to call _Task methods from the SDK will be the subject of another post.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.