@@ -114,7 +114,7 @@ func NewTransparentVlanEndpointClient(
114
114
func (client * TransparentVlanEndpointClient ) AddEndpoints (epInfo * EndpointInfo ) error {
115
115
// VM Namespace
116
116
if err := client .ensureCleanPopulateVM (); err != nil {
117
- return errors .Wrap (err , "failed to ensure both network namespace and vlan veth were present or both absent" )
117
+ return errors .Wrap (err , "failed to ensure both network namespace and vlan interface were present or both absent" )
118
118
}
119
119
if err := client .PopulateVM (epInfo ); err != nil {
120
120
return err
@@ -131,7 +131,7 @@ func (client *TransparentVlanEndpointClient) AddEndpoints(epInfo *EndpointInfo)
131
131
// Called from AddEndpoints, Namespace: VM and Vnet
132
132
func (client * TransparentVlanEndpointClient ) ensureCleanPopulateVM () error {
133
133
// Clean up vlan interface in the VM namespace and ensure the network namespace (if it exists) has a vlan interface
134
- logger .Info ("Checking if NS and vlan veth exists..." )
134
+ logger .Info ("Checking if NS and vlan interface exists..." )
135
135
var existingErr error
136
136
client .vnetNSFileDescriptor , existingErr = client .netnsClient .GetFromName (client .vnetNSName )
137
137
if existingErr == nil {
@@ -146,7 +146,7 @@ func (client *TransparentVlanEndpointClient) ensureCleanPopulateVM() error {
146
146
logger .Info ("vlan interface doesn't exist even though network namespace exists, deleting network namespace..." , zap .String ("message" , vlanIfErr .Error ()))
147
147
delErr := client .netnsClient .DeleteNamed (client .vnetNSName )
148
148
if delErr != nil {
149
- return errors .Wrap (delErr , "failed to cleanup/delete ns after noticing vlan veth does not exist" )
149
+ return errors .Wrap (delErr , "failed to cleanup/delete ns after noticing vlan interface does not exist" )
150
150
}
151
151
}
152
152
}
@@ -215,7 +215,7 @@ func (client *TransparentVlanEndpointClient) PopulateVM(epInfo *EndpointInfo) er
215
215
var existingErr error
216
216
client .vnetNSFileDescriptor , existingErr = client .netnsClient .GetFromName (client .vnetNSName )
217
217
// If the ns does not exist, the below code will trigger to create it
218
- // This will also (we assume) mean the vlan veth does not exist
218
+ // This will also (we assume) mean the vlan interface does not exist
219
219
if existingErr != nil {
220
220
// We assume the only possible error is that the namespace doesn't exist
221
221
logger .Info ("No existing NS detected. Creating the vnet namespace and switching to it" , zap .String ("message" , existingErr .Error ()))
@@ -234,15 +234,15 @@ func (client *TransparentVlanEndpointClient) PopulateVM(epInfo *EndpointInfo) er
234
234
logger .Info ("[transparent vlan] removing vnet ns due to failure..." )
235
235
err = client .netnsClient .DeleteNamed (client .vnetNSName )
236
236
if err != nil {
237
- logger .Error ("failed to cleanup/delete ns after failing to create vlan veth " )
237
+ logger .Error ("failed to cleanup/delete ns after failing to create vlan interface " )
238
238
}
239
239
}
240
240
}()
241
241
if deleteNSIfNotNilErr != nil {
242
242
return errors .Wrap (deleteNSIfNotNilErr , "failed to set current ns to vm" )
243
243
}
244
244
245
- // Now create vlan veth
245
+ // Now create vlan interface
246
246
logger .Info ("Create the host vlan link after getting eth0" , zap .String ("primaryHostIfName" , client .primaryHostIfName ))
247
247
// Get parent interface index. Index is consistent across libraries.
248
248
eth0 , deleteNSIfNotNilErr := client .netioshim .GetNetworkInterfaceByName (client .primaryHostIfName )
@@ -258,7 +258,7 @@ func (client *TransparentVlanEndpointClient) PopulateVM(epInfo *EndpointInfo) er
258
258
VlanId : client .vlanID ,
259
259
}
260
260
logger .Info ("Attempting to create link in VM NS" , zap .String ("vlanIfName" , client .vlanIfName ))
261
- // Create vlan veth
261
+ // Create vlan interface
262
262
deleteNSIfNotNilErr = vishnetlink .LinkAdd (link )
263
263
if deleteNSIfNotNilErr != nil {
264
264
// ignore link already exists error
@@ -271,35 +271,35 @@ func (client *TransparentVlanEndpointClient) PopulateVM(epInfo *EndpointInfo) er
271
271
}
272
272
defer func () {
273
273
if deleteNSIfNotNilErr != nil {
274
- logger .Info ("removing vlan veth due to failure..." )
274
+ logger .Info ("removing vlan interface due to failure..." )
275
275
if delErr := client .netlink .DeleteLink (client .vlanIfName ); delErr != nil {
276
- logger .Error ("deleting vlan veth failed on addendpoint failure with" , zap .Any ("error:" , delErr .Error ()))
276
+ logger .Error ("deleting vlan interface failed on addendpoint failure with" , zap .Any ("error:" , delErr .Error ()))
277
277
}
278
278
}
279
279
}()
280
280
281
281
// sometimes there is slight delay in interface creation. check if it exists
282
282
err = RunWithRetries (func () error {
283
283
_ , err = client .netioshim .GetNetworkInterfaceByName (client .vlanIfName )
284
- return errors .Wrap (err , "failed to get vlan veth " )
284
+ return errors .Wrap (err , "failed to get vlan interface " )
285
285
}, numRetries , sleepInMs )
286
286
287
287
if err != nil {
288
- deleteNSIfNotNilErr = errors .Wrapf (err , "failed to get vlan veth interface:%s" , client .vlanIfName )
288
+ deleteNSIfNotNilErr = errors .Wrapf (err , "failed to get vlan interface interface:%s" , client .vlanIfName )
289
289
return deleteNSIfNotNilErr
290
290
}
291
291
292
292
deleteNSIfNotNilErr = client .netUtilsClient .DisableRAForInterface (client .vlanIfName )
293
293
if deleteNSIfNotNilErr != nil {
294
294
return errors .Wrap (deleteNSIfNotNilErr , "failed to disable router advertisements for vlan vnet link" )
295
295
}
296
- // vlan veth was created successfully, so move the vlan veth you created
296
+ // vlan interface was created successfully, so move the vlan interface you created
297
297
logger .Info ("Move vlan link to vnet NS" , zap .String ("vlanIfName" , client .vlanIfName ), zap .Any ("vnetNSFileDescriptor" , uintptr (client .vnetNSFileDescriptor )))
298
298
deleteNSIfNotNilErr = client .setLinkNetNSAndConfirm (client .vlanIfName , uintptr (client .vnetNSFileDescriptor ), client .vnetNSName )
299
299
if deleteNSIfNotNilErr != nil {
300
- return errors .Wrap (deleteNSIfNotNilErr , "failed to move or detect vlan veth inside vnet namespace" )
300
+ return errors .Wrap (deleteNSIfNotNilErr , "failed to move or detect vlan interface inside vnet namespace" )
301
301
}
302
- logger .Info ("Moving vlan veth into namespace confirmed" )
302
+ logger .Info ("Moving vlan interface into namespace confirmed" )
303
303
} else {
304
304
logger .Info ("Existing NS detected. vlan interface should exist or namespace would've been deleted." , zap .String ("vnetNSName" , client .vnetNSName ), zap .String ("vlanIfName" , client .vlanIfName ))
305
305
}
@@ -373,7 +373,7 @@ func (client *TransparentVlanEndpointClient) PopulateVM(epInfo *EndpointInfo) er
373
373
func (client * TransparentVlanEndpointClient ) PopulateVnet (epInfo * EndpointInfo ) error {
374
374
_ , err := client .netioshim .GetNetworkInterfaceByName (client .vlanIfName )
375
375
if err != nil {
376
- return errors .Wrap (err , "vlan veth doesn't exist" )
376
+ return errors .Wrap (err , "vlan interface doesn't exist" )
377
377
}
378
378
vnetVethIf , err := client .netioshim .GetNetworkInterfaceByName (client .vnetVethName )
379
379
if err != nil {
@@ -669,7 +669,7 @@ func (client *TransparentVlanEndpointClient) DeleteEndpointsImpl(ep *endpoint, _
669
669
// TODO: revist if this require in future.
670
670
//nolint gocritic
671
671
/* if routesLeft <= numDefaultRoutes {
672
- // Deletes default arp, default routes, vlan veth ; there are two default routes
672
+ // Deletes default arp, default routes, vlan interface ; there are two default routes
673
673
// so when we have <= numDefaultRoutes routes left, no containers use this namespace
674
674
log.Printf("[transparent vlan] Deleting namespace %s as no containers occupy it", client.vnetNSName)
675
675
delErr := client.netnsClient.DeleteNamed(client.vnetNSName)
0 commit comments