示例#1
0
文件: ipam.go 项目: dcbw/cni
func ExecAdd(plugin string, netconf []byte) (*types.Result, error) {
	if os.Getenv("CNI_COMMAND") != "ADD" {
		return nil, fmt.Errorf("CNI_COMMAND is not ADD")
	}
	return invoke.ExecPluginWithResult(invoke.Find(plugin), netconf, invoke.ArgsFromEnv())
}
示例#2
0
文件: api.go 项目: dcbw/cni
func (c *CNIConfig) AddNetwork(net *NetworkConfig, rt *RuntimeConf) (*types.Result, error) {
	pluginPath := invoke.FindInPath(net.Network.Type, c.Path)
	return invoke.ExecPluginWithResult(pluginPath, net.Bytes, c.args("ADD", rt))
}