virtconainers: rollback the NetNs when createNetwork failed#509
virtconainers: rollback the NetNs when createNetwork failed#509egernst merged 1 commit intokata-containers:masterfrom
Conversation
|
PSS Measurement: Memory inside container: |
|
|
||
| //rollback the NetNs when createNetwork failed | ||
| defer func() { | ||
| if err != nil && netNsPath != "" && netNsCreated { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Yeah, I had cleanup the err redefined lines and checked the last return code.
Thanks
Fupan
|
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>
26d8348 to
c6fda44
Compare
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
|
PSS Measurement: Memory inside container: |
|
Build succeeded (third-party-check pipeline).
|
When createNetwork failed, cleanup the NetNs if it created.
Fixes: #508
Signed-off-by: fupan lifupan@gmail.com