mirror of https://github.com/docker/docs.git
remove useless function generateIfaceName()
generateIfaceName() is useless as libnetwork has done the job. Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
This commit is contained in:
parent
e7ef8633d5
commit
a1620084c5
|
@ -3,9 +3,7 @@
|
||||||
package native
|
package native
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
@ -13,7 +11,6 @@ import (
|
||||||
"github.com/opencontainers/runc/libcontainer/apparmor"
|
"github.com/opencontainers/runc/libcontainer/apparmor"
|
||||||
"github.com/opencontainers/runc/libcontainer/configs"
|
"github.com/opencontainers/runc/libcontainer/configs"
|
||||||
"github.com/opencontainers/runc/libcontainer/devices"
|
"github.com/opencontainers/runc/libcontainer/devices"
|
||||||
"github.com/opencontainers/runc/libcontainer/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// createContainer populates and configures the container type with the
|
// 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
|
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 {
|
func (d *Driver) createNetwork(container *configs.Config, c *execdriver.Command, hooks execdriver.Hooks) error {
|
||||||
if c.Network == nil {
|
if c.Network == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue