Skip to content

Commit 845ef62

Browse files
committed
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 <[email protected]>
1 parent adaeedd commit 845ef62

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plugins/main/macvlan/macvlan.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,13 @@ func cmdAdd(args *skel.CmdArgs) error {
382382
}
383383

384384
func cmdDel(args *skel.CmdArgs) error {
385-
n, _, err := loadConf(args, args.Args)
385+
var n NetConf
386+
err := json.Unmarshal(args.StdinData, &n)
386387
if err != nil {
387-
return err
388+
return fmt.Errorf("failed to load netConf: %v", err)
388389
}
389390

390391
isLayer3 := n.IPAM.Type != ""
391-
392392
if isLayer3 {
393393
err = ipam.ExecDel(n.IPAM.Type, args.StdinData)
394394
if err != nil {

0 commit comments

Comments
 (0)