Skip to content

Commit

Permalink
No ssse3 check on arm (#2123)
Browse files Browse the repository at this point in the history
* fix captitalization

* added skipped ssse3 instruction check on arm
  • Loading branch information
hellt committed Jul 4, 2024
1 parent 79e2a7e commit f33db2a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/joho/godotenv v1.5.1
github.com/jsimonetti/rtnetlink v1.4.2
github.com/kellerza/template v0.0.6
github.com/klauspost/cpuid v1.3.1
github.com/klauspost/cpuid/v2 v2.2.7
github.com/mackerelio/go-osstat v0.2.5
github.com/mitchellh/go-homedir v1.1.0
github.com/olekukonko/tablewriter v0.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -813,8 +813,8 @@ github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0N
github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s=
github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4=
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU=
github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
Expand Down
15 changes: 10 additions & 5 deletions nodes/default_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,27 @@ func (d *DefaultNode) CheckDeploymentConditions(ctx context.Context) error {
if err != nil {
return err
}

err = d.OverwriteNode.VerifyStartupConfig(d.Cfg.LabDir)
if err != nil {
return err
}

err = d.OverwriteNode.CheckInterfaceName()
if err != nil {
return err
}

err = d.OverwriteNode.VerifyLicenseFileExists(ctx)
if err != nil {
return err
}

err = d.OverwriteNode.PullImage(ctx)
if err != nil {
return err
}

return nil
}

Expand Down Expand Up @@ -153,8 +158,8 @@ func (d *DefaultNode) Deploy(ctx context.Context, _ *DeployParams) error {
return nil
}

// getNsPath retrieve the nodes nspath.
func (d *DefaultNode) getNsPath(ctx context.Context) (string, error) {
// getNSPath retrieves the nodes nspath.
func (d *DefaultNode) getNSPath(ctx context.Context) (string, error) {
var err error
nsp := ""

Expand Down Expand Up @@ -333,7 +338,7 @@ func (d *DefaultNode) GenerateConfig(dst, templ string) error {
return f.Close()
}

// NodeOverwrites is an interface that every node implementation implements.
// NodeOverwrites is an interface that every node implements.
// It is used to enable DefaultNode to get access to the particular node structs
// and is provided as an argument of the NewDefaultNode function.
// The methods defined for this interfaces are the methods that particular node has a custom
Expand Down Expand Up @@ -489,7 +494,7 @@ func (d *DefaultNode) LoadOrGenerateCertificate(certInfra *cert.Cert, topoName s

func (d *DefaultNode) AddLinkToContainer(ctx context.Context, link netlink.Link, f func(ns.NetNS) error) error {
// retrieve nodes nspath
nsp, err := d.getNsPath(ctx)
nsp, err := d.getNSPath(ctx)
if err != nil {
return err
}
Expand All @@ -513,7 +518,7 @@ func (d *DefaultNode) AddLinkToContainer(ctx context.Context, link netlink.Link,
// ExecFunction executes the given function in the nodes network namespace.
func (d *DefaultNode) ExecFunction(ctx context.Context, f func(ns.NetNS) error) error {
// retrieve nodes nspath
nspath, err := d.getNsPath(ctx)
nspath, err := d.getNSPath(ctx)
if err != nil {
return err
}
Expand Down
9 changes: 5 additions & 4 deletions types/host_requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ func NewHostRequirements() *HostRequirements {
}
}

// Verify runs verification checks against the host requirements set for a node.
func (h *HostRequirements) Verify(kindName, nodeName string) error {
// check virtualization Support
if h.VirtRequired && !virt.VerifyVirtSupport() {
return fmt.Errorf("for node %q (%s) the CPU virtualization support is required, but not available", nodeName, kindName)
return fmt.Errorf("CPU virtualization support is required for node %q (%s)", nodeName, kindName)
}
// check SSSE3 support
if h.SSSE3 && !virt.VerifySSSE3Support() {
return fmt.Errorf("for node %q (%s) the SSSE3 CPU feature is required, but not available", nodeName, kindName)
// check SSSE3 support on amd64 arch only as it is an x86_64 instruction
if runtime.GOARCH == "amd64" && h.SSSE3 && !virt.VerifySSSE3Support() {
return fmt.Errorf("SSSE3 CPU feature is required for node %q (%s)", nodeName, kindName)
}
// check minimum vCPUs
if valid, num := h.verifyMinVCpu(); !valid {
Expand Down
4 changes: 2 additions & 2 deletions virt/virt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"os"
"strings"

"github.com/klauspost/cpuid"
"github.com/klauspost/cpuid/v2"
log "github.com/sirupsen/logrus"
)

// VerifySSSE3Support check if SSSE3 is supported on the host.
func VerifySSSE3Support() bool {
return cpuid.CPU.SSSE3()
return cpuid.CPU.Has(cpuid.SSSE3)
}

// VerifyVirtSupport checks if virtualization is supported by a cpu in case topology contains VM-based nodes
Expand Down

0 comments on commit f33db2a

Please sign in to comment.