Trying to code module similar to vmware_cluster_drs but for specific VMs.
I am trying to instead use drsVmConfigSpec and dasVmConfigSpec which calls vim.cluster.DasVmConfigSpec / vim.cluster.DrsVmConfigSpec (info).
info for both point to DrsVmConfigInfo and have a key property with type key ManagedObjectReference ( then can pass VirtualMachine type and moid value).
Challenge is how to set the key to a ManagedObjectReference?
See below for what works in PowerCLI:
$spec.drsVmConfigSpec[0].info.key = New-Object VMware.Vim.ManagedObjectReference
How to do same in python?
These don’t work:
.info.key = vmodl.ManagedObjectReference
.info.key = VmomiSupport.GetWsdlType(‘urn:vim25’, ‘ManagedObjectReference’)
Sample snippets of what we have tried and no success yet in setting key to be the type of ManagedObjectReference.
Also tried as array etc.
cluster_config_spec = vim.cluster.ConfigSpecEx()
cluster_config_spec.drsVmConfigSpec = vim.cluster.DrsVmConfigSpec()
cluster_config_spec.drsVmConfigSpec.info = vim.cluster.DrsVmConfigInfo()
cluster_config_spec.drsVmConfigSpec.info.key = vmodl.ManagedObjectReference
cluster_config_spec.drsVmConfigSpec.info.key.type = “VirtualMachine”
cluster_config_spec.drsVmConfigSpec.info.key.value = self.params.get(‘vm_moid’)
cluster_config_spec.drsVmConfigSpec.info.enabled = self.enable_drs
cluster_config_spec.drsVmConfigSpec.info.behavior = self.params.get(‘drs_default_vm_behavior’)
Thanks for any suggestions or solution!
Patrick