mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-01 01:33:20 +00:00
Merge pull request #1921 from Ace-Tang/fix-remove-network
network: fix failed to remove network
This commit is contained in:
commit
14474a49a2
@ -65,12 +65,10 @@ func CreateSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Fac
|
|||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func createSandboxFromConfig(ctx context.Context, sandboxConfig SandboxConfig, factory Factory) (*Sandbox, error) {
|
func createSandboxFromConfig(ctx context.Context, sandboxConfig SandboxConfig, factory Factory) (_ *Sandbox, err error) {
|
||||||
span, ctx := trace(ctx, "createSandboxFromConfig")
|
span, ctx := trace(ctx, "createSandboxFromConfig")
|
||||||
defer span.Finish()
|
defer span.Finish()
|
||||||
|
|
||||||
var err error
|
|
||||||
|
|
||||||
// Create the sandbox.
|
// Create the sandbox.
|
||||||
s, err := createSandbox(ctx, sandboxConfig, factory)
|
s, err := createSandbox(ctx, sandboxConfig, factory)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -91,7 +89,7 @@ func createSandboxFromConfig(ctx context.Context, sandboxConfig SandboxConfig, f
|
|||||||
|
|
||||||
// network rollback
|
// network rollback
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil && s.networkNS.NetNsCreated {
|
if err != nil {
|
||||||
s.removeNetwork()
|
s.removeNetwork()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user