Example #1
0
func getInodeCurNetNS() (uint64, error) {
	curNS, err := ns.GetCurrentNS()
	if err != nil {
		return 0, err
	}
	defer curNS.Close()
	return getInodeNS(curNS)
}
Example #2
0
func ReleaseVF(conf *NetConf) error {
	netns, err := ns.GetNS(conf.NetNs)
	if err != nil {
		return fmt.Errorf("failed to open netns %q: %v", netns, err)
	}
	defer netns.Close()

	initns, err := ns.GetCurrentNS()
	if err != nil {
		return fmt.Errorf("failed to open init ns: %v", err)
	}
	defer initns.Close()

	err = netns.Do(func(_ ns.NetNS) error {
		return releaseVF(conf, conf.IfName, initns)
	})

	return nil
}