@@ -805,10 +805,12 @@ func (plugin *netPlugin) Delete(args *cniSkel.CmdArgs) error {
805805 // Query the network.
806806 if nwInfo , err = plugin .nm .GetNetworkInfo (networkId ); err != nil {
807807
808- // attempt to release address associated with this Endpoint id
809- // This is to ensure clean up is done even in failure cases
810- if err = plugin .DelegateDel (nwCfg .Ipam .Type , nwCfg ); err != nil {
811- log .Printf ("Network not found, attempted to release address with error: %v" , err )
808+ if ! nwCfg .MultiTenancy {
809+ // attempt to release address associated with this Endpoint id
810+ // This is to ensure clean up is done even in failure cases
811+ if err = plugin .DelegateDel (nwCfg .Ipam .Type , nwCfg ); err != nil {
812+ log .Printf ("Network not found, attempted to release address with error: %v" , err )
813+ }
812814 }
813815
814816 // Log the error but return success if the endpoint being deleted is not found.
@@ -820,10 +822,12 @@ func (plugin *netPlugin) Delete(args *cniSkel.CmdArgs) error {
820822 // Query the endpoint.
821823 if epInfo , err = plugin .nm .GetEndpointInfo (networkId , endpointId ); err != nil {
822824
823- // attempt to release address associated with this Endpoint id
824- // This is to ensure clean up is done even in failure cases
825- if err = plugin .DelegateDel (nwCfg .Ipam .Type , nwCfg ); err != nil {
826- log .Printf ("Endpoint not found, attempted to release address with error: %v" , err )
825+ if ! nwCfg .MultiTenancy {
826+ // attempt to release address associated with this Endpoint id
827+ // This is to ensure clean up is done even in failure cases
828+ if err = plugin .DelegateDel (nwCfg .Ipam .Type , nwCfg ); err != nil {
829+ log .Printf ("Endpoint not found, attempted to release address with error: %v" , err )
830+ }
827831 }
828832
829833 // Log the error but return success if the endpoint being deleted is not found.
0 commit comments