@@ -351,34 +351,39 @@ func (p *OVSPlugin) SetupInterface(podName, podInfraContainerID string, port *po
351
351
return nil
352
352
}
353
353
354
- func (p * OVSPlugin ) destroyOVSInterface (podName , podInfraContainerID string , port * ports. Port ) error {
355
- _ , qvo := p .buildVethName (port . ID )
356
- _ , err := exec .RunCommand ("ip" , "link" , "delete " , qvo )
354
+ func (p * OVSPlugin ) destroyOVSInterface (podName , podInfraContainerID , portID string ) error {
355
+ _ , qvo := p .buildVethName (portID )
356
+ output , err := exec .RunCommand ("ip" , "link" , "set " , "dev" , qvo , "down" )
357
357
if err != nil {
358
- glog .V ( 5 ). Infof ( "Warning: DestroyInterface failed: %v" , err )
358
+ glog .Warningf ( "Warning: DestroyInterface failed: %v, %v" , output , err )
359
359
}
360
360
361
- _ , err = exec .RunCommand ("ovs-vsctl " , "-vconsole:off " , "--if-exists " , "del-port " , qvo )
361
+ output , err = exec .RunCommand ("ip " , "link " , "delete " , "dev " , qvo )
362
362
if err != nil {
363
- glog .V ( 5 ). Infof ( "Warning: DestroyInterface failed: %v" , err )
363
+ glog .Warningf ( "Warning: DestroyInterface failed: %v, %v" , output , err )
364
364
}
365
365
366
- bridge := p .buildBridgeName (port .ID )
367
- _ , err = exec .RunCommand ("ip" , "link" , "set" , bridge , "down" )
366
+ output , err = exec .RunCommand ("ovs-vsctl" , "-vconsole:off" , "--if-exists" , "del-port" , qvo )
368
367
if err != nil {
369
- glog .V ( 5 ). Infof ( "Warning: DestroyInterface failed: %v" , err )
368
+ glog .Warningf ( "Warning: DestroyInterface failed: %v, %v" , output , err )
370
369
}
371
370
372
- _ , err = exec .RunCommand ("brctl" , "delbr" , bridge )
371
+ bridge := p .buildBridgeName (portID )
372
+ output , err = exec .RunCommand ("ip" , "link" , "set" , "dev" , bridge , "down" )
373
373
if err != nil {
374
- glog .V (5 ).Infof ("Warning: DestroyInterface failed: %v" , err )
374
+ glog .Warningf ("Warning: DestroyInterface failed: %v, %v" , output , err )
375
+ }
376
+
377
+ output , err = exec .RunCommand ("brctl" , "delbr" , bridge )
378
+ if err != nil {
379
+ glog .Warningf ("Warning: DestroyInterface failed: %v, %v" , output , err )
375
380
}
376
381
377
382
return nil
378
383
}
379
384
380
- func (p * OVSPlugin ) destroyDockerInterface (podName , podInfraContainerID string , port * ports. Port ) error {
381
- tapName , _ := p .buildTapName (port . ID )
385
+ func (p * OVSPlugin ) destroyDockerInterface (podName , podInfraContainerID , portID string ) error {
386
+ tapName , _ := p .buildTapName (portID )
382
387
_ , err := exec .RunCommand ("ip" , "link" , "delete" , tapName )
383
388
if err != nil {
384
389
glog .V (5 ).Infof ("Warning: DestroyInterface failed: %v" , err )
@@ -401,11 +406,11 @@ func (p *OVSPlugin) destroyDockerInterface(podName, podInfraContainerID string,
401
406
}
402
407
403
408
func (p * OVSPlugin ) DestroyInterface (podName , podInfraContainerID string , port * ports.Port , containerRuntime string ) error {
404
- p .destroyOVSInterface (podName , podInfraContainerID , port )
409
+ p .destroyOVSInterface (podName , podInfraContainerID , port . ID )
405
410
406
411
switch containerRuntime {
407
412
case runtimeTypeDocker :
408
- p .destroyDockerInterface (podName , podInfraContainerID , port )
413
+ p .destroyDockerInterface (podName , podInfraContainerID , port . ID )
409
414
default :
410
415
glog .V (4 ).Infof ("DestroyInterface for %s done" , containerRuntime )
411
416
}
0 commit comments