mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-19 16:38:00 +00:00
network: Sort endpoints by name
Sort endpoints by name to control the order in which they are passed to the VM as the interface name inside the VM depends on the order in which it is passed. Long term we should come up with a more robust approach. Fixes #785 Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
parent
c3cfe8204a
commit
8f1b28da34
@ -16,6 +16,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -1670,6 +1671,12 @@ func createEndpointsFromScan(networkNSPath string, config NetworkConfig) ([]Endp
|
|||||||
idx++
|
idx++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sort.Slice(endpoints, func(i, j int) bool {
|
||||||
|
return endpoints[i].Name() < endpoints[j].Name()
|
||||||
|
})
|
||||||
|
|
||||||
|
networkLogger().WithField("endpoints", endpoints).Info("Endpoints found after scan")
|
||||||
|
|
||||||
return endpoints, nil
|
return endpoints, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user