@@ -352,31 +352,37 @@ func (p *OVSPlugin) SetupInterface(podName, podInfraContainerID string, port *po
352
352
}
353
353
354
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" )
355
+ qvb , qvo := p .buildVethName (portID )
356
+ bridge := p .buildBridgeName (portID )
357
+
358
+ output , err := exec .RunCommand ("brctl" , "delif" , bridge , qvb )
357
359
if err != nil {
358
- glog .Warningf ("Warning: DestroyInterface failed: %v, %v" , output , err )
360
+ glog .Warningf ("Warning: brctl delif %s failed: %v, %v" , qvb , output , err )
359
361
}
360
362
361
- output , err = exec .RunCommand ("ip" , "link" , "delete" , "dev" , qvo )
363
+ output , err = exec .RunCommand ("ip" , "link" , "set" , "dev" , bridge , "down" )
364
+ if err != nil {
365
+ glog .Warningf ("Warning: set bridge %s down failed: %v, %v" , bridge , output , err )
366
+ }
367
+
368
+ output , err = exec .RunCommand ("brctl" , "delbr" , bridge )
362
369
if err != nil {
363
- glog .Warningf ("Warning: DestroyInterface failed: %v, %v" , output , err )
370
+ glog .Warningf ("Warning: delete bridge %s failed: %v, %v" , bridge , output , err )
364
371
}
365
372
366
373
output , err = exec .RunCommand ("ovs-vsctl" , "-vconsole:off" , "--if-exists" , "del-port" , qvo )
367
374
if err != nil {
368
- glog .Warningf ("Warning: DestroyInterface failed: %v, %v" , output , err )
375
+ glog .Warningf ("Warning: ovs del-port %s failed: %v, %v" , qvo , output , err )
369
376
}
370
377
371
- bridge := p .buildBridgeName (portID )
372
- output , err = exec .RunCommand ("ip" , "link" , "set" , "dev" , bridge , "down" )
378
+ output , err = exec .RunCommand ("ip" , "link" , "set" , "dev" , qvo , "down" )
373
379
if err != nil {
374
- glog .Warningf ("Warning: DestroyInterface failed: %v, %v" , output , err )
380
+ glog .Warningf ("Warning: set dev %s down failed: %v, %v" , qvo , output , err )
375
381
}
376
382
377
- output , err = exec .RunCommand ("brctl " , "delbr " , bridge )
383
+ output , err = exec .RunCommand ("ip " , "link " , "delete" , "dev" , qvo )
378
384
if err != nil {
379
- glog .Warningf ("Warning: DestroyInterface failed: %v, %v" , output , err )
385
+ glog .Warningf ("Warning: delete dev %s failed: %v, %v" , qvo , output , err )
380
386
}
381
387
382
388
return nil
0 commit comments