1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #16879 from x1022as/network

remove useless function generateIfaceName()
This commit is contained in:
Vincent Demeester 2015-10-09 13:25:03 +02:00
commit 04e883c22b

View file

@ -3,9 +3,7 @@
package native
import (
"errors"
"fmt"
"net"
"strings"
"syscall"
@ -13,7 +11,6 @@ import (
"github.com/opencontainers/runc/libcontainer/apparmor"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/opencontainers/runc/libcontainer/devices"
"github.com/opencontainers/runc/libcontainer/utils"
)
// createContainer populates and configures the container type with the
@ -103,22 +100,6 @@ func (d *Driver) createContainer(c *execdriver.Command, hooks execdriver.Hooks)
return container, nil
}
func generateIfaceName() (string, error) {
for i := 0; i < 10; i++ {
name, err := utils.GenerateRandomName("veth", 7)
if err != nil {
continue
}
if _, err := net.InterfaceByName(name); err != nil {
if strings.Contains(err.Error(), "no such") {
return name, nil
}
return "", err
}
}
return "", errors.New("Failed to find name for new interface")
}
func (d *Driver) createNetwork(container *configs.Config, c *execdriver.Command, hooks execdriver.Hooks) error {
if c.Network == nil {
return nil