-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix issue 2513 #3148
Fix issue 2513 #3148
Conversation
…e the network if it is in use
…e the network if it is in use
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mheese If they are not already assigned, you can assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Can one of the admins verify this patch? |
I signed it |
@minikube-bot OK to test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks great. A few nits.
pkg/drivers/kvm/network.go
Outdated
return errors.Wrapf(err, "defining network from xml: %s", networkXML.String()) | ||
// fail if there are 0 domains | ||
if len(doms) == 0 { | ||
return fmt.Errorf("list of domains is 0 lenght") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo. What's the correct fix here? It would be good to include some steps the user could take to create the domain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah ... good point to think about what this error means to the user ... it's one of those statements that will/should never happen ... I think there is two things we could do to address this:
- turn this into a
panic()
- simply remove the check: at the end of the day, it would just mean that something else deleted even our own minikube domain while we're trying to delete this network, and then there is no point of further iteration through the domains.
I'd personally opt for (2), but I let you make that decision @dlorenc. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not panic: https://github.com/golang/go/wiki/CodeReviewComments#dont-panic
I like your #2 option, since this is just at the deletion stage, but just in case it helps a future debugger, do you mind putting a log.Warningf in about the unexpected case?
Thanks again for your contribution.
pkg/drivers/kvm/kvm.go
Outdated
network, err := conn.LookupNetworkByName(d.PrivateNetwork) | ||
// Tear down network if it exists and is not in use by another minikube instance | ||
log.Debug("Trying to delete the networks (if possible)") | ||
err = d.deleteNetwork() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: inline the if statement here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough, inlining this statement right now
pkg/drivers/kvm/network.go
Outdated
return errors.Wrapf(err, "defining network from xml: %s", networkXML.String()) | ||
// fail if there are 0 domains | ||
if len(doms) == 0 { | ||
return fmt.Errorf("list of domains is 0 lenght") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spelling of length.
pkg/drivers/kvm/network.go
Outdated
return errors.Wrapf(err, "defining network from xml: %s", networkXML.String()) | ||
// fail if there are 0 domains | ||
if len(doms) == 0 { | ||
return fmt.Errorf("list of domains is 0 lenght") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not panic: https://github.com/golang/go/wiki/CodeReviewComments#dont-panic
I like your #2 option, since this is just at the deletion stage, but just in case it helps a future debugger, do you mind putting a log.Warningf in about the unexpected case?
Thanks again for your contribution.
v0.30.0: Specifically call out the fixed CVE and omitted #3148
This fixes issue #2513, and also effectively does the following:
It's been a while that I've written these fixes, and because of the big delay on our company's side with signing the CNCF CLA, this PR comes rather late. I'm happy it's sorted out though, and I can create the PR. Looking over the code again though, it looks like everything is in place.
@tstromberg, fyi, as you wanted to be referenced