Skip to content

Commit

Permalink
libvirt: Bump bootstrap memory to 5G for ppc64le
Browse files Browse the repository at this point in the history
On ppc64le there were OOM kills being observed during the bootstrap process
because of insufficient memory and bumping the memory seemed to solve the problem.
The libvirt defaults for the master and worker memory are 7G and 5G respectively,
so setting the boostrap default to 5G for ppc64le. ppc64le uses 64K pages rather than
the default 4K page size and thus requires more memory.
  • Loading branch information
Prashanth684 committed Apr 6, 2020
1 parent e023f63 commit 7494900
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 = string
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 = string
description = "RAM in MiB allocated to the bootstrap node"
default = "2048"
}

1 change: 1 addition & 0 deletions pkg/asset/cluster/tfvars.go
Expand Up @@ -336,6 +336,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 string `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: FIXME: need to make ppc64le a supported architecture - need to do this when adding support for multi-arch images. Until then use this
if architecture == "ppc64le" {
cfg.BootstrapMemory = strconv.Itoa(5120)
}

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

Expand Down

0 comments on commit 7494900

Please sign in to comment.