github.com/openshift/installer@v1.4.17/pkg/types/vsphere/machinepool.go (about)

     1  package vsphere
     2  
     3  // MachinePool stores the configuration for a machine pool installed
     4  // on vSphere.
     5  type MachinePool struct {
     6  	// NumCPUs is the total number of virtual processor cores to assign a vm.
     7  	//
     8  	// +optional
     9  	NumCPUs int32 `json:"cpus"`
    10  
    11  	// NumCoresPerSocket is the number of cores per socket in a vm. The number
    12  	// of vCPUs on the vm will be NumCPUs/NumCoresPerSocket.
    13  	//
    14  	// +optional
    15  	NumCoresPerSocket int32 `json:"coresPerSocket"`
    16  
    17  	// Memory is the size of a VM's memory in MB.
    18  	//
    19  	// +optional
    20  	MemoryMiB int64 `json:"memoryMB"`
    21  
    22  	// OSDisk defines the storage for instance.
    23  	//
    24  	// +optional
    25  	OSDisk `json:"osDisk"`
    26  
    27  	// Zones defines available zones
    28  	// Zones is available in TechPreview.
    29  	//
    30  	// +omitempty
    31  	Zones []string `json:"zones,omitempty"`
    32  }
    33  
    34  // OSDisk defines the disk for a virtual machine.
    35  type OSDisk struct {
    36  	// DiskSizeGB defines the size of disk in GB.
    37  	//
    38  	// +optional
    39  	DiskSizeGB int32 `json:"diskSizeGB"`
    40  }
    41  
    42  // Set sets the values from `required` to `p`.
    43  func (p *MachinePool) Set(required *MachinePool) {
    44  	if required == nil || p == nil {
    45  		return
    46  	}
    47  
    48  	if required.NumCPUs != 0 {
    49  		p.NumCPUs = required.NumCPUs
    50  	}
    51  
    52  	if required.NumCoresPerSocket != 0 {
    53  		p.NumCoresPerSocket = required.NumCoresPerSocket
    54  	}
    55  
    56  	if required.MemoryMiB != 0 {
    57  		p.MemoryMiB = required.MemoryMiB
    58  	}
    59  
    60  	if required.OSDisk.DiskSizeGB != 0 {
    61  		p.OSDisk.DiskSizeGB = required.OSDisk.DiskSizeGB
    62  	}
    63  
    64  	if len(required.Zones) > 0 {
    65  		p.Zones = required.Zones
    66  	}
    67  }