Skip to content

Commit

Permalink
macvlan cmdDel: replace the loadConf function with json.unmarshal
Browse files Browse the repository at this point in the history
When the master interface on the node has deleted, and loadConf tries to
get the MTU, This causes cmdDel to return a linkNotFound error to the
runtime. The cmdDel only needs to unmarshall the net config. No need to
get the MTU. So we just replace the loadConf function with
json.unmarshal in cmdDel.

Signed-off-by: cyclinder <qifeng.guo@daocloud.io>
  • Loading branch information
cyclinder committed Oct 13, 2023
1 parent 6ff8e5e commit dc1c5ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/main/macvlan/macvlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,13 @@ func cmdAdd(args *skel.CmdArgs) error {
}

func cmdDel(args *skel.CmdArgs) error {
n, _, err := loadConf(args, args.Args)
var n NetConf
err := json.Unmarshal(args.StdinData, &n)
if err != nil {
return err
return fmt.Errorf("failed to load netConf: %v", err)
}

isLayer3 := n.IPAM.Type != ""

if isLayer3 {
err = ipam.ExecDel(n.IPAM.Type, args.StdinData)
if err != nil {
Expand Down

0 comments on commit dc1c5ec

Please sign in to comment.