Skip to content

Commit

Permalink
fix for IPAM leak issue
Browse files Browse the repository at this point in the history
  • Loading branch information
g1rana authored and unclejack committed Jun 4, 2018
1 parent 53da09d commit 319ae51
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
13 changes: 13 additions & 0 deletions mgmtfn/dockplugin/ipamDriver.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,19 @@ func releaseAddress(w http.ResponseWriter, r *http.Request) {

log.Infof("Received ReleaseAddressRequest: %+v", areq)

//Build an release request to be sent to master
releaseReq := master.AddressReleaseRequest{
NetworkID: areq.PoolID,
IPv4Address: areq.Address,
}
var releaseResp master.AddressReleaseResponse
err := cluster.MasterPostReq("/plugin/releaseAddress",
&releaseReq, &releaseRsp)
if err != nil {
httpError(w, "master failed to release request:%v address",
releaseReq, err)
return
}
// response
relResp := api.ReleaseAddressResponse{}

Expand Down
4 changes: 3 additions & 1 deletion mgmtfn/dockplugin/netDriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func createEndpoint(hostname string) func(http.ResponseWriter, *http.Request) {
return
}

log.Infof("CreateEndpointRequest: %+v. Interface: %+v", cereq, cereq.Interface)
//log.Infof("CreateEndpointRequest: %+v. Interface: %+v", cereq, cereq.Interface)

tenantName, netName, serviceName, err := GetDockerNetworkName(cereq.NetworkID)
if err != nil {
Expand All @@ -213,6 +213,8 @@ func createEndpoint(hostname string) func(http.ResponseWriter, *http.Request) {
},
}

log.Infof("CreateEndpointRequest: %+v. Interface: %+v", mreq, cereq.Interface)

var mresp master.CreateEndpointResponse
err = cluster.MasterPostReq("/plugin/createEndpoint", &mreq, &mresp)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions netmaster/master/api.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ type AddressReleaseRequest struct {
NetworkID string // Unique identifier for the network
IPv4Address string // Allocated address
}
type AddressReleaseResponse struct {
Status string
}

// CreateEndpointRequest has the endpoint create request from netplugin
type CreateEndpointRequest struct {
Expand Down
3 changes: 2 additions & 1 deletion netplugin/cluster/cluster.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ func masterReq(path string, req interface{}, resp interface{}, isDel bool) error
time.Sleep(time.Second)
continue
} else if err != nil {
log.Errorf("Error making %s request: Err: %v", reqType, err)
log.Errorf("Error making %s request: Err: %v"+
"with resp:%+v", reqType, err, resp)
return err
}

Expand Down

0 comments on commit 319ae51

Please sign in to comment.