pythonvcenterpyvmomivmware-toolsvmware-sdk

How to get data deduplication and data compression status for vSAN cluster using pyVmomi?


I want to fetch data deduplication and data compression status of vSAN cluster for running precheck disk format version upgrade. enter image description here


Solution

  • def get_compression_deduplication_status(si, cluster_ref):
      vcMos = vsanapiutils.GetVsanVcMos(si._stub, context=context)
      vsanClusterSystem = vcMos['vsan-cluster-config-system']
      vsan_config_info = vsanClusterSystem.GetConfigInfoEx(cluster_ref)
      dedupEnabled = vsan_config_info.dataEfficiencyConfig.dedupEnabled
      compressionEnabled = vsan_config_info.dataEfficiencyConfig.compressionEnabled
      return {'dedupEnabled': bool(dedupEnabled), 'compressionEnabled': bool(compressionEnabled)}