Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions pkg/asset/machines/machineconfig/hyperthreading.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,13 @@ package machineconfig
import (
"fmt"

igntypes "github.com/coreos/ignition/v2/config/v3_1/types"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/openshift/installer/pkg/asset/ignition"
)

// ForHyperthreadingDisabled creates the MachineConfig to disable hyperthreading.
// RHCOS ships with pivot.service that uses the `/etc/pivot/kernel-args` to override the kernel arguments for hosts.
// See https://github.com/openshift/machine-config-operator/blob/master/docs/MachineConfiguration.md#kernelarguments
func ForHyperthreadingDisabled(role string) (*mcfgv1.MachineConfig, error) {
ignConfig := igntypes.Config{
Ignition: igntypes.Ignition{
Version: igntypes.MaxVersion.String(),
},
Storage: igntypes.Storage{
Files: []igntypes.File{
ignition.FileFromString("/etc/pivot/kernel-args", "root", 0600, "ADD nosmt"),
},
},
}

rawExt, err := ignition.ConvertToRawExtension(ignConfig)
if err != nil {
return nil, err
}

return &mcfgv1.MachineConfig{
TypeMeta: metav1.TypeMeta{
APIVersion: "machineconfiguration.openshift.io/v1",
Expand All @@ -41,7 +22,8 @@ func ForHyperthreadingDisabled(role string) (*mcfgv1.MachineConfig, error) {
},
},
Spec: mcfgv1.MachineConfigSpec{
Config: rawExt,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm possibly, I didn't test this locally; we also don't have CI coverage for this which probably needs to happen as a prerequisite. (It is IMO kind of a bug if the ignition section is really required becuase in exactly this case we're just using the "high level" MC section and not Ignition)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of today, at least this has to be passed:

ignConfig := igntypes.Config{
    Ignition: igntypes.Ignition{
	Version: igntypes.MaxVersion.String(),
    },
}

// See https://access.redhat.com/solutions/rhel-smt
KernelArguments: []string{"nosmt"},
},
}, nil
}