@@ -784,6 +784,19 @@ def get(cls, bridge, namespace=None, mac=None, port_id=None,
784
784
return VethPortFixture (bridge , namespace )
785
785
tools .fail ('Unexpected bridge type: %s' % type (bridge ))
786
786
787
+ def set_port_mac_address (self ):
788
+
789
+ def set_mac_address ():
790
+ self .port .link .set_address (self .mac )
791
+ return self .port .link .address .lower () == self .mac .lower ()
792
+
793
+ try :
794
+ common_utils .wait_until_true (set_mac_address , timeout = 10 )
795
+ except common_utils .WaitTimeout :
796
+ LOG .error ("MAC address of the port %s not set properly. "
797
+ "Requested MAC: %s; Actual MAC: %s" ,
798
+ self .port , self .mac , self .port .link .address )
799
+
787
800
788
801
class OVSBridgeFixture (fixtures .Fixture ):
789
802
"""Create an OVS bridge.
@@ -899,7 +912,7 @@ def hybrid_plug_port(self, port_name):
899
912
bridge_port .link .set_up ()
900
913
self .qbr .addif (bridge_port .name )
901
914
902
- self .port . link . set_address ( self . mac )
915
+ self .set_port_mac_address ( )
903
916
self .port .link .set_up ()
904
917
905
918
# NOTE(jlibosva): Methods below are taken from nova.virt.libvirt.vif
@@ -990,8 +1003,7 @@ def _setUp(self):
990
1003
self .veth_fixture = self .useFixture (VethFixture ())
991
1004
self .br_port , self .port = self .veth_fixture .ports
992
1005
993
- if self .mac :
994
- self .port .link .set_address (self .mac )
1006
+ self .set_port_mac_address ()
995
1007
996
1008
# bridge side
997
1009
br_ip_wrapper = ip_lib .IPWrapper (self .bridge .namespace )
0 commit comments