github.com/openshift/installer@v1.4.17/pkg/types/ovirt/defaults/machinepools.go (about)

     1  package defaults
     2  
     3  import (
     4  	"github.com/openshift/installer/pkg/types"
     5  	"github.com/openshift/installer/pkg/types/ovirt"
     6  )
     7  
     8  func setMachinePool(p *types.MachinePool) {
     9  	if p.Platform.Ovirt == nil {
    10  		p.Platform.Ovirt = &ovirt.MachinePool{}
    11  	}
    12  }
    13  
    14  func setDefaultAffinityGroups(p *ovirt.Platform, mp *types.MachinePool, agName string) {
    15  	if mp.Platform.Ovirt.AffinityGroupsNames == nil {
    16  		for _, ag := range p.AffinityGroups {
    17  			if ag.Name == agName {
    18  				mp.Platform.Ovirt.AffinityGroupsNames = []string{agName}
    19  			}
    20  		}
    21  	}
    22  }
    23  
    24  func setDefaultThreads(mp *types.MachinePool) {
    25  	// Workaround for buggy threads behavior in previous versions.
    26  	if mp.Platform.Ovirt.CPU != nil && mp.Platform.Ovirt.CPU.Threads == 0 {
    27  		mp.Platform.Ovirt.CPU.Threads = 1
    28  	}
    29  }
    30  
    31  // SetControlPlaneDefaults sets the defaults for the ControlPlane Machines.
    32  func SetControlPlaneDefaults(p *ovirt.Platform, mp *types.MachinePool) {
    33  	setMachinePool(mp)
    34  	setDefaultAffinityGroups(p, mp, DefaultControlPlaneAffinityGroupName)
    35  	setDefaultThreads(mp)
    36  }
    37  
    38  // SetComputeDefaults sets the defaults for the Compute Machines.
    39  func SetComputeDefaults(p *ovirt.Platform, mp *types.MachinePool) {
    40  	setMachinePool(mp)
    41  	setDefaultAffinityGroups(p, mp, DefaultComputeAffinityGroupName)
    42  	setDefaultThreads(mp)
    43  }