diff --git a/validate/validate.go b/validate/validate.go index bce44d974..c0b161b9e 100644 --- a/validate/validate.go +++ b/validate/validate.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io/ioutil" + "net" "os" "path/filepath" "reflect" @@ -411,6 +412,26 @@ func (v *Validator) CheckLinuxResources() (msgs []string) { msgs = append(msgs, fmt.Sprintf("Minimum memory limit should be larger than memory reservation")) } } + if r.Network != nil && v.HostSpecific { + var exist bool + interfaces, err := net.Interfaces() + if err != nil { + msgs = append(msgs, err.Error()) + return + } + for _, prio := range r.Network.Priorities { + exist = false + for _, ni := range interfaces { + if prio.Name == ni.Name { + exist = true + break + } + } + if !exist { + msgs = append(msgs, fmt.Sprintf("Interface %s does not exist currently", prio.Name)) + } + } + } return }