return the primary network interface for discoverd
close #775 Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
committed by
Jonathon Anderson
parent
03d94322cd
commit
84d2389aaf
@@ -98,6 +98,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
or "runtime") rather than a concatenated list of individual overlays. This
|
||||
removes a limit on the number of overlays that could be included in a node or
|
||||
profile. #852, #876, #883, #896, #903
|
||||
- During node discovery, prefer the primary network interface, if defined. #775
|
||||
|
||||
## [4.4.0] 2023-01-18
|
||||
|
||||
|
||||
@@ -309,6 +309,14 @@ func (config *NodeYaml) ListAllProfiles() []string {
|
||||
return ret
|
||||
}
|
||||
|
||||
/*
|
||||
FindDiscoverableNode returns the first discoverable node and an
|
||||
interface to associate with the discovered interface. If the node has
|
||||
a primary interface, it is returned; otherwise, the first interface
|
||||
without a hardware address is returned.
|
||||
|
||||
If no unconfigured nodes are found, an error is returned.
|
||||
*/
|
||||
func (config *NodeYaml) FindDiscoverableNode() (NodeInfo, string, error) {
|
||||
var ret NodeInfo
|
||||
|
||||
@@ -318,6 +326,9 @@ func (config *NodeYaml) FindDiscoverableNode() (NodeInfo, string, error) {
|
||||
if !node.Discoverable.GetB() {
|
||||
continue
|
||||
}
|
||||
if _, ok := node.NetDevs[node.PrimaryNetDev.Get()]; ok {
|
||||
return node, node.PrimaryNetDev.Get(), nil
|
||||
}
|
||||
for netdev, dev := range node.NetDevs {
|
||||
if !dev.Hwaddr.Defined() {
|
||||
return node, netdev, nil
|
||||
|
||||
Reference in New Issue
Block a user