Hi,
I am trying to use reconfigureCluster_Task() to modify to enable/disable DRS. At the moment, in order to change this boolean setting without affecting others, I have to recreate the entire ClusterConfigSpec from ClusterConfigInfo by setting the properties of ClusterConfigSpec one by one even though I do not need to touch other settings at all. Here is the code.
ClusterOrginazation aCluster = ....,
ClusterConfigInfo existConfig = aCluster.getClusterConfig();
ClusterConfigSpec newSpec = new ClusterConfigSpec();
existConfig.getDrsConfig().setEnabled(true);
newSpec.setRulesSpec(...); <== have to create rule specs based on the rule info
newSpec.setDasConfig(existConfig.getDasConfig());
newSpec.setDrsConfig(existConfig.getDrsConfig());
newSpec.setDasVMConfig(....); <== have to create DasVMSpec based on DasVMConfigInfo
newSpec.setDrsVMConfig(....); <== have to create DrsVMSpec based on DrsVMConfigInfo
...
Just wondered is there a way to just set the property that I'd like to change in the new spec?
Thanks in advance!
Wei
Can't you just use reconfigureCluster_Task with "modify" set to "true"? (http://pubs.vmware.com/vi301/sdk/ReferenceGuide/vim.ClusterComputeResource.html#reconfigure)
I haven't done it before, but the documentation says pretty straightforwardly that if modify==true, a partial set of changes may be applied incrementally. The documentation surrounding ClusterConfigInfo indicates "All fields are defined as optional. In case of a reconfiguration, unset fields are unchanged.".
i.e. make a new ClusterDrsConfigInfo with enabled==true, assign that to a new ClusterConfigSpec.drsInfo, and pass that in to the reconfigureCluster_Task with modify=true. I've done this exact thing with VMs, would stand to reason it behaves in the same manner for Clusters.
That's the first thing I tried. Didn't work. Got an exception saying something like "invalid operation".
Same problem here : got an exception saying "non nillable element 'operation' is null."
@wzhou : did you find a solution to your problem ?
Ok, found message here :
http://www.vmware.com/community/thread.jspa?messageID=635107򛃣
Solves the problem.