func resourceVSphereHAVMOverrideFindEntry(
	cluster *object.ClusterComputeResource,
	vm *object.VirtualMachine,
) (*types.ClusterDasVmConfigInfo, error) {
	props, err := clustercomputeresource.Properties(cluster)
	if err != nil {
		return nil, fmt.Errorf("error fetching cluster properties: %s", err)
	}

	for _, info := range props.ConfigurationEx.(*types.ClusterConfigInfoEx).DasVmConfig {
		if info.Key == vm.Reference() {
			log.Printf("[DEBUG] Found HA config info for VM %q in cluster %q", vm.Name(), cluster.Name())
			return &info, nil
		}
	}

	log.Printf("[DEBUG] No HA config info found for VM %q in cluster %q", vm.Name(), cluster.Name())
	return nil, nil
}
func resourceVSphereHAVMOverrideFindEntry(
	cluster *object.ClusterComputeResource,
	vm *object.VirtualMachine,
) (*types.ClusterDasVmConfigInfo, error) {
	props, err := clustercomputeresource.Properties(cluster)
	if err != nil {
		return nil, fmt.Errorf("error fetching cluster properties: %s", err)
	}

	for _, info := range props.ConfigurationEx.(*types.ClusterConfigInfoEx).DasVmConfig {
		if info.Key == vm.Reference() {
			log.Printf("[DEBUG] Found HA config info for VM %q in cluster %q", vm.Name(), cluster.Name())
			return &info, nil
		}
	}

	log.Printf("[DEBUG] No HA config info found for VM %q in cluster %q", vm.Name(), cluster.Name())
	return nil, nil
}
func resourceVSphereHAVMOverrideFindEntry ( cluster * object . ClusterComputeResource , vm * object . VirtualMachine , ) ( * types . ClusterDasVmConfigInfo , error ) { props , err := clustercomputeresource . Properties ( cluster ) if err != nil { return nil , fmt . Errorf ( " " , err ) } for _ , info := range props . ConfigurationEx . ( * types . ClusterConfigInfoEx ) . DasVmConfig { if info . Key == vm . Reference ( ) { log . Printf ( " " , vm . Name ( ) , cluster . Name ( ) ) return & info , nil } } log . Printf ( " " , vm . Name ( ) , cluster . Name ( ) ) return nil , nil }
// resourceVSphereHAVMOverrideFindEntry attempts to locate an existing
// VM-specific HA config in a cluster's configuration. It's used by the
// resource's read functionality and tests. nil is returned if the entry cannot
// be found.
resourceVSphereHAVMOverrideFindEntry attempts to locate an existing VM - specific HA config in a cluster s configuration . It s used by the resource s read functionality and tests . nil is returned if the entry cannot be found .