From 845ef62b74d1a41335cefb211118c9f32f0166ed Mon Sep 17 00:00:00 2001 From: cyclinder Date: Wed, 11 Oct 2023 10:48:00 +0800 Subject: [PATCH] macvlan cmdDel: replace the loadConf function with json.unmarshal When the master interface on the node has been deleted, and loadConf tries to get the MTU, This causes cmdDel to return a linkNotFound error to the runtime. The cmdDel only needs to unmarshal the netConf. No need to get the MTU. So we just replaced the loadConf function with json.unmarshal in cmdDel. Signed-off-by: cyclinder --- plugins/main/macvlan/macvlan.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/main/macvlan/macvlan.go b/plugins/main/macvlan/macvlan.go index 435024c49..deac65785 100644 --- a/plugins/main/macvlan/macvlan.go +++ b/plugins/main/macvlan/macvlan.go @@ -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 {