Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free'ing address space on scope delete #6106

Merged
merged 1 commit into from
Aug 25, 2017

Conversation

hmahmood
Copy link
Contributor

Fixes #4157

}

if p.Parent != nil {
p.Parent.ReleaseIP4Range(p)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here has a check for if Parent is nil:
https://github.com/vmware/vic/blob/master/lib/portlayer/network/ipam.go#L334
Does that create problem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never mind


var parentSpace *AddressSpace
if len(s.spaces) == 1 {
parentSpace = s.spaces[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious why don't get parent space here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the case where len(s.spaces) == 1, the only space in the slice is the parent. See this case here: https://github.com/vmware/vic/blob/master/lib/portlayer/network/context.go#L443

@@ -1258,6 +1258,35 @@ func (c *Context) DeleteScope(ctx context.Context, name string) error {
return fmt.Errorf("%s has active endpoints", s.Name())
}

var allzeros, allones net.IP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: allZeros, allOnes.


log "github.com/Sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

"math/rand"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should put this in the top import group.

@hmahmood hmahmood force-pushed the network-rm-fix branch 2 times, most recently from 179de54 to 8417a05 Compare August 25, 2017 15:33
@@ -69,3 +69,17 @@ Remove network with running container
${rc} ${output}= Run And Return Rc And Output docker %{VCH-PARAMS} network ls
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} test-network

Add and remove network multiple times
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer naming this - Verify user can create and delete many networks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its creating and deleting the same network over and over again, not creating a new network each time.

Copy link
Contributor

@mhagen-vmware mhagen-vmware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@hmahmood hmahmood merged commit b7f2a88 into vmware:master Aug 25, 2017
AngieCris pushed a commit to AngieCris/vic that referenced this pull request Nov 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants