1- #!/usr/bin/env python  
1+ #!/usr/bin/env python3  
22import  argparse 
33import  threading 
44import  logging 
@@ -106,7 +106,7 @@ def _inject_with_connection_state_check(self):
106106        t .join (self .vif_connected_timeout )
107107        if  watcher .watches :
108108            log .warning ('Wait vif state change timeout' )
109-             for  vif  in  watcher .watches .itervalues ():
109+             for  vif  in  watcher .watches .values ():
110110                log .warning ("Vif:%s state did not change to '%s', don't inject IGMP query to mac: %s"  % 
111111                            (vif , VIF_CONNECTED_STATE , get_vif_mac (vif )))
112112
@@ -142,11 +142,11 @@ def get_vif_state_path(vif):
142142
143143
144144def  get_parent_bridge (bridge ):
145-     return  subprocess .check_output (['/usr/bin/ovs-vsctl' , 'br-to-parent' , bridge ]).strip ()
145+     return  subprocess .check_output (['/usr/bin/ovs-vsctl' , 'br-to-parent' , bridge ],  universal_newlines = True ).strip ()
146146
147147
148148def  network_backend_is_openvswitch ():
149-     bridge_type  =  subprocess .check_output (['/opt/xensource/bin/xe-get-network-backend' ]).strip ()
149+     bridge_type  =  subprocess .check_output (['/opt/xensource/bin/xe-get-network-backend' ],  universal_newlines = True ).strip ()
150150    return  bridge_type  ==  'openvswitch' 
151151
152152
@@ -161,7 +161,7 @@ def __missing__(self, key):
161161
162162@memodict  
163163def  igmp_snooping_is_enabled_on_bridge (bridge ):
164-     vlan  =  subprocess .check_output (['/usr/bin/ovs-vsctl' , 'br-to-vlan' , bridge ]).strip ()
164+     vlan  =  subprocess .check_output (['/usr/bin/ovs-vsctl' , 'br-to-vlan' , bridge ],  universal_newlines = True ).strip ()
165165    if  vlan  !=  '0' :
166166        # this br is a fake br, should get its parent 
167167        bridge  =  get_parent_bridge (bridge )
@@ -170,12 +170,12 @@ def igmp_snooping_is_enabled_on_bridge(bridge):
170170
171171@memodict  
172172def  _igmp_snooping_is_enabled_on_bridge (bridge ):
173-     enabled  =  subprocess .check_output (['/usr/bin/ovs-vsctl' , 'get' , 'bridge' , bridge , 'mcast_snooping_enable' ]).strip ()
173+     enabled  =  subprocess .check_output (['/usr/bin/ovs-vsctl' , 'get' , 'bridge' , bridge , 'mcast_snooping_enable' ],  universal_newlines = True ).strip ()
174174    return  enabled  ==  'true' 
175175
176176
177177def  igmp_snooping_is_enabled_on_bridge_of_vif (vif ):
178-     bridge  =  subprocess .check_output (['/usr/bin/ovs-vsctl' , 'iface-to-br' , vif ]).strip ()
178+     bridge  =  subprocess .check_output (['/usr/bin/ovs-vsctl' , 'iface-to-br' , vif ],  universal_newlines = True ).strip ()
179179    return  igmp_snooping_is_enabled_on_bridge (bridge )
180180
181181
0 commit comments