diff --git a/go.mod b/go.mod index 770cf9c6d..9100313ec 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 1df50dfdd..6d1272cb8 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/nodes/default_node.go b/nodes/default_node.go index 1a30e32e8..d8e267f36 100644 --- a/nodes/default_node.go +++ b/nodes/default_node.go @@ -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 } @@ -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 := "" @@ -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 @@ -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 } @@ -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 } diff --git a/types/host_requirements.go b/types/host_requirements.go index ebab99e94..6151c2295 100644 --- a/types/host_requirements.go +++ b/types/host_requirements.go @@ -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 { diff --git a/virt/virt.go b/virt/virt.go index c8b10e04f..d904def38 100644 --- a/virt/virt.go +++ b/virt/virt.go @@ -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