Skip to content

Commit 8ce77f8

Browse files
zbb88888hongzhen-ma
authored andcommitted
fix ifname start with pod (#3038)
1 parent a29d00c commit 8ce77f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/daemon/ovs_linux.go

+5
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ func generateNicName(containerID, ifname string) (string, string) {
185185
if ifname == "eth0" {
186186
return fmt.Sprintf("%s_h", containerID[0:12]), fmt.Sprintf("%s_c", containerID[0:12])
187187
}
188+
// The nic name is 14 length and have prefix pod in the Kubevirt v1.0.0
189+
if strings.HasPrefix(ifname, "pod") && len(ifname) == 14 {
190+
ifname = ifname[3 : len(ifname)-4]
191+
return fmt.Sprintf("%s_%s_h", containerID[0:12-len(ifname)], ifname), fmt.Sprintf("%s_%s_c", containerID[0:12-len(ifname)], ifname)
192+
}
188193
return fmt.Sprintf("%s_%s_h", containerID[0:12-len(ifname)], ifname), fmt.Sprintf("%s_%s_c", containerID[0:12-len(ifname)], ifname)
189194
}
190195

0 commit comments

Comments
 (0)