Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

virtconainers: rollback the NetNs when createNetwork failed#509

Merged
egernst merged 1 commit intokata-containers:masterfrom
hyperhq:kata-integration
Jul 24, 2018
Merged

virtconainers: rollback the NetNs when createNetwork failed#509
egernst merged 1 commit intokata-containers:masterfrom
hyperhq:kata-integration

Conversation

@lifupan
Copy link
Member

@lifupan lifupan commented Jul 24, 2018

When createNetwork failed, cleanup the NetNs if it created.

Fixes: #508

Signed-off-by: fupan lifupan@gmail.com

@katacontainersbot
Copy link
Contributor

PSS Measurement:
Qemu: 162657 KB
Proxy: 4923 KB
Shim: 8927 KB

Memory inside container:
Total Memory: 2045968 KB
Free Memory: 2007220 KB


//rollback the NetNs when createNetwork failed
defer func() {
if err != nil && netNsPath != "" && netNsCreated {
Copy link
Member

Choose a reason for hiding this comment

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

To make the check work in a defer closure, you need to make sure err is never redefined in this function.

Also the error from the last line return s.storage.storeSandboxNetwork(s.id, networkNS) should also be checked.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I had cleanup the err redefined lines and checked the last return code.

Thanks

Fupan

@opendev-zuul
Copy link

opendev-zuul bot commented Jul 24, 2018

Build succeeded (third-party-check pipeline).

When createNetwork failed, cleanup the NetNs if it created.

Fixes: kata-containers#508

Signed-off-by: fupan <lifupan@gmail.com>
@lifupan lifupan force-pushed the kata-integration branch from 26d8348 to c6fda44 Compare July 24, 2018 04:09
@codecov
Copy link

codecov bot commented Jul 24, 2018

Codecov Report

Merging #509 into master will increase coverage by <.01%.
The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #509      +/-   ##
==========================================
+ Coverage   65.98%   65.99%   +<.01%     
==========================================
  Files          93       93              
  Lines        9484     9492       +8     
==========================================
+ Hits         6258     6264       +6     
- Misses       2554     2555       +1     
- Partials      672      673       +1
Impacted Files Coverage Δ
virtcontainers/sandbox.go 64.9% <81.81%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b244410...c6fda44. Read the comment docs.

@katacontainersbot
Copy link
Contributor

PSS Measurement:
Qemu: 150936 KB
Proxy: 5075 KB
Shim: 8905 KB

Memory inside container:
Total Memory: 2045968 KB
Free Memory: 2007384 KB

@opendev-zuul
Copy link

opendev-zuul bot commented Jul 24, 2018

Build succeeded (third-party-check pipeline).

@egernst egernst merged commit cd133dc into kata-containers:master Jul 24, 2018
@sboeuf sboeuf added enhancement Improvement to an existing feature stable-candidate labels Sep 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement Improvement to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants