mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 08:17:37 +00:00
network: Drop mounted parameter in call to deleteNetNS
All calls to deleteNetNS were passing the "mounted" parameter as true. So drop this parameter. Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
parent
f2d9632bc0
commit
0806dcc19c
@ -165,7 +165,7 @@ func (n *cni) remove(sandbox *Sandbox, networkNS NetworkNamespace, netNsCreated
|
||||
}
|
||||
|
||||
if netNsCreated {
|
||||
return deleteNetNS(networkNS.NetNsPath, true)
|
||||
return deleteNetNS(networkNS.NetNsPath)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -55,7 +55,7 @@ func (n *cnm) remove(sandbox *Sandbox, networkNS NetworkNamespace, netNsCreated
|
||||
}
|
||||
|
||||
if netNsCreated {
|
||||
return deleteNetNS(networkNS.NetNsPath, true)
|
||||
return deleteNetNS(networkNS.NetNsPath)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -1112,7 +1112,7 @@ func doNetNS(netNSPath string, cb func(ns.NetNS) error) error {
|
||||
return cb(targetNS)
|
||||
}
|
||||
|
||||
func deleteNetNS(netNSPath string, mounted bool) error {
|
||||
func deleteNetNS(netNSPath string) error {
|
||||
n, err := ns.GetNS(netNSPath)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -1123,15 +1123,11 @@ func deleteNetNS(netNSPath string, mounted bool) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// This unmount part is supposed to be done in the cni/ns package, but the "mounted"
|
||||
// flag is not updated when retrieving NetNs handler from GetNS().
|
||||
if mounted {
|
||||
if err = unix.Unmount(netNSPath, unix.MNT_DETACH); err != nil {
|
||||
return fmt.Errorf("Failed to unmount namespace %s: %v", netNSPath, err)
|
||||
}
|
||||
if err := os.RemoveAll(netNSPath); err != nil {
|
||||
return fmt.Errorf("Failed to clean up namespace %s: %v", netNSPath, err)
|
||||
}
|
||||
if err = unix.Unmount(netNSPath, unix.MNT_DETACH); err != nil {
|
||||
return fmt.Errorf("Failed to unmount namespace %s: %v", netNSPath, err)
|
||||
}
|
||||
if err := os.RemoveAll(netNSPath); err != nil {
|
||||
return fmt.Errorf("Failed to clean up namespace %s: %v", netNSPath, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -123,7 +123,7 @@ func TestCreateDeleteNetNS(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = deleteNetNS(netNSPath, true)
|
||||
err = deleteNetNS(netNSPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user