reubenur-rahman / vmware-pyvmomi-examples

The example codes are written using the VMware official python library pyvmomi
Apache License 2.0
89 stars 60 forks source link

How to edit cluster properties , basically add/remove HA and DRS #13

Open shashi2713 opened 7 years ago

shashi2713 commented 7 years ago

I would like to enable / disable HA and DRS on my cluster, can anyone send me the code?

CharmingYang0 commented 4 years ago

Sample codes to disable cluster vSphere HA/das as below.

from pyVmomi import vim
from pyVim.task import WaitForTask

das_enabled = cluster.configuration.dasConfig.enabled
if das_enabled:
    cluster_spec = vim.cluster.ConfigSpecEx()
    das_info = vim.cluster.DasConfigInfo()
    das_info.enabled = False
    cluster_spec.dasConfig = das_info
    task = cluster.ReconfigureComputeResource_Task(cluster_spec, True)
    res = WaitForTask(task, si=vcenter._server)