0

Error while creating VMware HA cluster using pyvmomi library. I'm following the official documentation (https://vdc-download.vmware.com/vmwb-repository/dcr-public/6b586ed2-655c-49d9-9029-bc416323cb22/fa0b429a-a695-4c11-b7d2-2cbc284049dc/doc/index.html) of pyvmomi for it.

I'm able to create a normal cluster without HA enabled if i don't set the ha_spec i.e. if i comment out line 2,3,4,5 in the following code.

Here is my piece of code:

cluster_spec = vim.cluster.ConfigSpecEx()
ha_spec = vim.cluster.DasConfigInfo()
ha_spec.enabled = True
ha_spec.hostMonitoring = vim.cluster.DasConfigInfo.ServiceState.enabled
cluster_spec.dasConfig = ha_spec
cluster = host_folder.CreateClusterEx(name=cluster_name, spec=cluster_spec)

The error it throws is:

InvalidArgument: (vmodl.fault.InvalidArgument) {

   dynamicType = <unset>,

   dynamicProperty = (vmodl.DynamicProperty) [],

   msg = 'A specified parameter was not correct: ',

   faultCause = <unset>,

   faultMessage = (vmodl.LocalizableMessage) [],

   invalidProperty = <unset>

}

I'm using Python 3.7, Pyvmomi 6.7.3 any ESX 6.5.

Does anybody know if that's the right way of doing it? Thank you.

bharatk
  • 4,202
  • 5
  • 16
  • 30
iAmHani
  • 1
  • 1

1 Answers1

0

I have same issue.this is my solusion:

    cluster_spec = vim.cluster.ConfigSpecEx()
    ha_spec = vim.cluster.DasConfigInfo()
    ha_spec.enabled = True
    ha_spec.hostMonitoring = vim.cluster.DasConfigInfo.ServiceState.enabled
    # this field is not optional, but the docs say it's optional.
    ha_spec.failoverLevel = 1
    cluster_spec.dasConfig = ha_spec
    cluster = host_folder.CreateClusterEx(name=cluster_name, spec=cluster_spec)
0x55aa
  • 61
  • 3