@@ -143,6 +143,7 @@ func (subnet *Subnet) GetRandomMac(podName, nicName string) string {
143
143
func (subnet * Subnet ) GetStaticMac (podName , nicName , mac string , checkConflict bool ) error {
144
144
if checkConflict {
145
145
if p , ok := subnet .MacToPod [mac ]; ok && p != podName {
146
+ klog .Errorf ("mac %s has been allocated to pod %s" , mac , p )
146
147
return ErrConflict
147
148
}
148
149
}
@@ -231,6 +232,7 @@ func (subnet *Subnet) getV4RandomAddress(podName, nicName string, mac string, sk
231
232
}
232
233
}
233
234
if ip == "" {
235
+ klog .Errorf ("no available ip in subnet %s, v4 free ip list %v" , subnet .Name , subnet .V4FreeIPList )
234
236
return "" , "" , "" , ErrConflict
235
237
}
236
238
@@ -292,6 +294,7 @@ func (subnet *Subnet) getV6RandomAddress(podName, nicName string, mac string, sk
292
294
}
293
295
}
294
296
if ip == "" {
297
+ klog .Errorf ("no available ip in subnet %s, v6 free ip list %v" , subnet .Name , subnet .V6FreeIPList )
295
298
return "" , "" , "" , ErrConflict
296
299
}
297
300
@@ -365,6 +368,7 @@ func (subnet *Subnet) GetStaticAddress(podName, nicName string, ip IP, mac strin
365
368
subnet .V4IPToPod [ip ] = fmt .Sprintf ("%s,%s" , subnet .V4IPToPod [ip ], podName )
366
369
return ip , mac , nil
367
370
}
371
+ klog .Errorf ("v4 ip %s has been allocated to %v" , ip , pods )
368
372
return ip , mac , ErrConflict
369
373
}
370
374
if ! force {
@@ -400,6 +404,7 @@ func (subnet *Subnet) GetStaticAddress(podName, nicName string, ip IP, mac strin
400
404
subnet .V6IPToPod [ip ] = fmt .Sprintf ("%s,%s" , subnet .V6IPToPod [ip ], podName )
401
405
return ip , mac , nil
402
406
}
407
+ klog .Errorf ("v6 ip %s has been allocated to %v" , ip , pods )
403
408
return ip , mac , ErrConflict
404
409
}
405
410
if ! force {
0 commit comments