Made changes in netlink code to ignore interface not found error

This commit is contained in:
Tamilmani Manoharan 2017-10-18 17:15:53 -07:00
Родитель 3c5ae5da8c
Коммит 5ba70f9092
3 изменённых файлов: 14 добавлений и 10 удалений

Просмотреть файл

@ -320,8 +320,8 @@ func (plugin *netPlugin) Delete(args *cniSkel.CmdArgs) error {
// Delete the endpoint.
err = plugin.nm.DeleteEndpoint(networkId, endpointId)
if err != nil {
// Log the error but don't return before releasing address
log.Printf("Container Namespace might have been removed. Failed to delete endpoint: %v", err)
err = plugin.Errorf("Failed to delete endpoint: %v", err)
return err
}
// Call into IPAM plugin to release the endpoint's addresses.
@ -330,7 +330,7 @@ func (plugin *netPlugin) Delete(args *cniSkel.CmdArgs) error {
nwCfg.Ipam.Address = address.IP.String()
err = plugin.DelegateDel(nwCfg.Ipam.Type, nwCfg)
if err != nil {
plugin.Errorf("Failed to release address: %v", err)
err = plugin.Errorf("Failed to release address: %v", err)
return err
}
}

Просмотреть файл

@ -7,6 +7,7 @@ import (
"fmt"
"net"
"github.com/Azure/azure-container-networking/log"
"golang.org/x/sys/unix"
)
@ -146,15 +147,17 @@ func AddLink(link Link) error {
// DeleteLink deletes a network interface.
func DeleteLink(name string) error {
if name == "" {
return fmt.Errorf("Invalid link name")
}
s, err := getSocket()
if err != nil {
return err
log.Printf("[net] Invalid link name. Not returning error")
return nil
}
iface, err := net.InterfaceByName(name)
if err != nil {
log.Printf("[net] Interface not found. Not returning error")
return nil
}
s, err := getSocket()
if err != nil {
return err
}

Просмотреть файл

@ -83,7 +83,8 @@ func (nw *network) deleteEndpoint(endpointId string) error {
// Look up the endpoint.
ep, err := nw.getEndpoint(endpointId)
if err != nil {
return err
log.Printf("[net] Endpoint %v not found. Not Returning error", endpointId)
return nil
}
// Call the platform implementation.