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:

<varname>.info.key = vmodl.ManagedObjectReference

<varname>.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


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/ea3c0362-71fc-43e9-9731-ca594c550f7cn%40googlegroups.com.

Reply via email to