generateIfaceName() is useless as libnetwork has done
the job.
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
| ... | ... |
@@ -3,9 +3,7 @@ |
| 3 | 3 |
package native |
| 4 | 4 |
|
| 5 | 5 |
import ( |
| 6 |
- "errors" |
|
| 7 | 6 |
"fmt" |
| 8 |
- "net" |
|
| 9 | 7 |
"strings" |
| 10 | 8 |
"syscall" |
| 11 | 9 |
|
| ... | ... |
@@ -13,7 +11,6 @@ import ( |
| 13 | 13 |
"github.com/opencontainers/runc/libcontainer/apparmor" |
| 14 | 14 |
"github.com/opencontainers/runc/libcontainer/configs" |
| 15 | 15 |
"github.com/opencontainers/runc/libcontainer/devices" |
| 16 |
- "github.com/opencontainers/runc/libcontainer/utils" |
|
| 17 | 16 |
) |
| 18 | 17 |
|
| 19 | 18 |
// createContainer populates and configures the container type with the |
| ... | ... |
@@ -103,22 +100,6 @@ func (d *Driver) createContainer(c *execdriver.Command, hooks execdriver.Hooks) |
| 103 | 103 |
return container, nil |
| 104 | 104 |
} |
| 105 | 105 |
|
| 106 |
-func generateIfaceName() (string, error) {
|
|
| 107 |
- for i := 0; i < 10; i++ {
|
|
| 108 |
- name, err := utils.GenerateRandomName("veth", 7)
|
|
| 109 |
- if err != nil {
|
|
| 110 |
- continue |
|
| 111 |
- } |
|
| 112 |
- if _, err := net.InterfaceByName(name); err != nil {
|
|
| 113 |
- if strings.Contains(err.Error(), "no such") {
|
|
| 114 |
- return name, nil |
|
| 115 |
- } |
|
| 116 |
- return "", err |
|
| 117 |
- } |
|
| 118 |
- } |
|
| 119 |
- return "", errors.New("Failed to find name for new interface")
|
|
| 120 |
-} |
|
| 121 |
- |
|
| 122 | 106 |
func (d *Driver) createNetwork(container *configs.Config, c *execdriver.Command, hooks execdriver.Hooks) error {
|
| 123 | 107 |
if c.Network == nil {
|
| 124 | 108 |
return nil |