Skip to content

Commit

Permalink
Merge pull request #3426 from openshift-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…3396-to-release-4.4

Bug 1820219: libvirt: Bump bootstrap memory to 5G for ppc64le
  • Loading branch information
openshift-merge-robot committed Apr 9, 2020
2 parents 895e762 + 021e159 commit f482baf
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 16 deletions.
2 changes: 1 addition & 1 deletion data/data/libvirt/bootstrap/main.tf
Expand Up @@ -13,7 +13,7 @@ resource "libvirt_ignition" "bootstrap" {
resource "libvirt_domain" "bootstrap" {
name = "${var.cluster_id}-bootstrap"

memory = "2048"
memory = var.bootstrap_memory

vcpu = "2"

Expand Down
5 changes: 5 additions & 0 deletions data/data/libvirt/bootstrap/variables.tf
Expand Up @@ -33,3 +33,8 @@ variable "pool" {
type = string
description = "The name of the storage pool."
}

variable "bootstrap_memory" {
type = number
description = "RAM in MiB allocated to the bootstrap node"
}
15 changes: 8 additions & 7 deletions data/data/libvirt/main.tf
Expand Up @@ -19,13 +19,14 @@ module "volume" {
module "bootstrap" {
source = "./bootstrap"

cluster_domain = var.cluster_domain
addresses = [var.libvirt_bootstrap_ip]
base_volume_id = module.volume.coreos_base_volume_id
cluster_id = var.cluster_id
ignition = var.ignition_bootstrap
network_id = libvirt_network.net.id
pool = libvirt_pool.storage_pool.name
cluster_domain = var.cluster_domain
addresses = [var.libvirt_bootstrap_ip]
base_volume_id = module.volume.coreos_base_volume_id
cluster_id = var.cluster_id
ignition = var.ignition_bootstrap
network_id = libvirt_network.net.id
pool = libvirt_pool.storage_pool.name
bootstrap_memory = var.libvirt_bootstrap_memory
}

resource "libvirt_volume" "master" {
Expand Down
6 changes: 6 additions & 0 deletions data/data/libvirt/variables-libvirt.tf
Expand Up @@ -44,3 +44,9 @@ variable "libvirt_master_vcpu" {
default = "4"
}

variable "libvirt_bootstrap_memory" {
type = number
description = "RAM in MiB allocated to the bootstrap node"
default = 2048
}

1 change: 1 addition & 0 deletions pkg/asset/cluster/tfvars.go
Expand Up @@ -329,6 +329,7 @@ func (t *TerraformVariables) Generate(parents asset.Parents) error {
&installConfig.Config.Networking.MachineNetwork[0].CIDR.IPNet,
installConfig.Config.Platform.Libvirt.Network.IfName,
masterCount,
installConfig.Config.ControlPlane.Architecture,
)
if err != nil {
return errors.Wrapf(err, "failed to get %s Terraform variables", platform)
Expand Down
24 changes: 16 additions & 8 deletions pkg/tfvars/libvirt/libvirt.go
Expand Up @@ -10,21 +10,23 @@ import (
"github.com/apparentlymart/go-cidr/cidr"
"github.com/openshift/cluster-api-provider-libvirt/pkg/apis/libvirtproviderconfig/v1beta1"
"github.com/openshift/installer/pkg/tfvars/internal/cache"
"github.com/openshift/installer/pkg/types"
"github.com/pkg/errors"
)

type config struct {
URI string `json:"libvirt_uri,omitempty"`
Image string `json:"os_image,omitempty"`
IfName string `json:"libvirt_network_if"`
MasterIPs []string `json:"libvirt_master_ips,omitempty"`
BootstrapIP string `json:"libvirt_bootstrap_ip,omitempty"`
MasterMemory string `json:"libvirt_master_memory,omitempty"`
MasterVcpu string `json:"libvirt_master_vcpu,omitempty"`
URI string `json:"libvirt_uri,omitempty"`
Image string `json:"os_image,omitempty"`
IfName string `json:"libvirt_network_if"`
MasterIPs []string `json:"libvirt_master_ips,omitempty"`
BootstrapIP string `json:"libvirt_bootstrap_ip,omitempty"`
MasterMemory string `json:"libvirt_master_memory,omitempty"`
MasterVcpu string `json:"libvirt_master_vcpu,omitempty"`
BootstrapMemory int `json:"libvirt_bootstrap_memory,omitempty"`
}

// TFVars generates libvirt-specific Terraform variables.
func TFVars(masterConfig *v1beta1.LibvirtMachineProviderConfig, osImage string, machineCIDR *net.IPNet, bridge string, masterCount int) ([]byte, error) {
func TFVars(masterConfig *v1beta1.LibvirtMachineProviderConfig, osImage string, machineCIDR *net.IPNet, bridge string, masterCount int, architecture types.Architecture) ([]byte, error) {
bootstrapIP, err := cidr.Host(machineCIDR, 10)
if err != nil {
return nil, errors.Errorf("failed to generate bootstrap IP: %v", err)
Expand All @@ -50,6 +52,12 @@ func TFVars(masterConfig *v1beta1.LibvirtMachineProviderConfig, osImage string,
MasterVcpu: strconv.Itoa(masterConfig.DomainVcpu),
}

// Power PC systems typically require more memory because the page size is 64K and not the default 4K
// TODO: need to make ppc64le a supported architecture - https://bugzilla.redhat.com/show_bug.cgi?id=1821392
if architecture == "ppc64le" {
cfg.BootstrapMemory = 5120
}

return json.MarshalIndent(cfg, "", " ")
}

Expand Down

0 comments on commit f482baf

Please sign in to comment.