mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 16:27:50 +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 {
|
if netNsCreated {
|
||||||
return deleteNetNS(networkNS.NetNsPath, true)
|
return deleteNetNS(networkNS.NetNsPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -55,7 +55,7 @@ func (n *cnm) remove(sandbox *Sandbox, networkNS NetworkNamespace, netNsCreated
|
|||||||
}
|
}
|
||||||
|
|
||||||
if netNsCreated {
|
if netNsCreated {
|
||||||
return deleteNetNS(networkNS.NetNsPath, true)
|
return deleteNetNS(networkNS.NetNsPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -1112,7 +1112,7 @@ func doNetNS(netNSPath string, cb func(ns.NetNS) error) error {
|
|||||||
return cb(targetNS)
|
return cb(targetNS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteNetNS(netNSPath string, mounted bool) error {
|
func deleteNetNS(netNSPath string) error {
|
||||||
n, err := ns.GetNS(netNSPath)
|
n, err := ns.GetNS(netNSPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1123,15 +1123,11 @@ func deleteNetNS(netNSPath string, mounted bool) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// This unmount part is supposed to be done in the cni/ns package, but the "mounted"
|
if err = unix.Unmount(netNSPath, unix.MNT_DETACH); err != nil {
|
||||||
// flag is not updated when retrieving NetNs handler from GetNS().
|
return fmt.Errorf("Failed to unmount namespace %s: %v", netNSPath, err)
|
||||||
if mounted {
|
}
|
||||||
if err = unix.Unmount(netNSPath, unix.MNT_DETACH); err != nil {
|
if err := os.RemoveAll(netNSPath); err != nil {
|
||||||
return fmt.Errorf("Failed to unmount namespace %s: %v", netNSPath, err)
|
return fmt.Errorf("Failed to clean up 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
|
return nil
|
||||||
|
@ -123,7 +123,7 @@ func TestCreateDeleteNetNS(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = deleteNetNS(netNSPath, true)
|
err = deleteNetNS(netNSPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user