dhcp_meta/rpc: cleaned up greenthread.sleep(0) calls
Those are (probably) artifacts from times when neutron was using eventlet-incompatible sqlalchemy adaptors for mysql. I don't see a reason why we may need those explicit yields otherwise. Change-Id: Ibf89387b7c8a2e7f08b11da058aaabf78e21daaa
This commit is contained in:
parent
7c3bcb2959
commit
fa628e3f71
@ -14,7 +14,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
from eventlet import greenthread
|
|
||||||
from neutron_lib import constants as const
|
from neutron_lib import constants as const
|
||||||
from neutron_lib import exceptions as ntn_exc
|
from neutron_lib import exceptions as ntn_exc
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
@ -185,9 +184,7 @@ def _create_metadata_access_network(plugin, context, router_id):
|
|||||||
'status': const.NET_STATUS_ACTIVE}
|
'status': const.NET_STATUS_ACTIVE}
|
||||||
meta_net = plugin.create_network(context,
|
meta_net = plugin.create_network(context,
|
||||||
{'network': net_data})
|
{'network': net_data})
|
||||||
greenthread.sleep(0) # yield
|
|
||||||
plugin.schedule_network(context, meta_net)
|
plugin.schedule_network(context, meta_net)
|
||||||
greenthread.sleep(0) # yield
|
|
||||||
# From this point on there will be resources to garbage-collect
|
# From this point on there will be resources to garbage-collect
|
||||||
# in case of failures
|
# in case of failures
|
||||||
meta_sub = None
|
meta_sub = None
|
||||||
@ -207,10 +204,8 @@ def _create_metadata_access_network(plugin, context, router_id):
|
|||||||
'host_routes': []}
|
'host_routes': []}
|
||||||
meta_sub = plugin.create_subnet(context,
|
meta_sub = plugin.create_subnet(context,
|
||||||
{'subnet': subnet_data})
|
{'subnet': subnet_data})
|
||||||
greenthread.sleep(0) # yield
|
|
||||||
plugin.add_router_interface(context, router_id,
|
plugin.add_router_interface(context, router_id,
|
||||||
{'subnet_id': meta_sub['id']})
|
{'subnet_id': meta_sub['id']})
|
||||||
greenthread.sleep(0) # yield
|
|
||||||
# Tell to start the metadata agent proxy, only if we had success
|
# Tell to start the metadata agent proxy, only if we had success
|
||||||
_notify_rpc_agent(context, {'subnet': meta_sub}, 'subnet.create.end')
|
_notify_rpc_agent(context, {'subnet': meta_sub}, 'subnet.create.end')
|
||||||
except (ntn_exc.NeutronException,
|
except (ntn_exc.NeutronException,
|
||||||
@ -231,12 +226,10 @@ def _destroy_metadata_access_network(plugin, context, router_id, ports):
|
|||||||
meta_sub_id = meta_port['fixed_ips'][0]['subnet_id']
|
meta_sub_id = meta_port['fixed_ips'][0]['subnet_id']
|
||||||
plugin.remove_router_interface(
|
plugin.remove_router_interface(
|
||||||
context, router_id, {'port_id': meta_port['id']})
|
context, router_id, {'port_id': meta_port['id']})
|
||||||
greenthread.sleep(0) # yield
|
|
||||||
context.session.expunge_all()
|
context.session.expunge_all()
|
||||||
try:
|
try:
|
||||||
# Remove network (this will remove the subnet too)
|
# Remove network (this will remove the subnet too)
|
||||||
plugin.delete_network(context, meta_net_id)
|
plugin.delete_network(context, meta_net_id)
|
||||||
greenthread.sleep(0) # yield
|
|
||||||
except (ntn_exc.NeutronException, nsx_exc.NsxPluginException,
|
except (ntn_exc.NeutronException, nsx_exc.NsxPluginException,
|
||||||
api_exc.NsxApiException):
|
api_exc.NsxApiException):
|
||||||
# must re-add the router interface
|
# must re-add the router interface
|
||||||
|
Loading…
x
Reference in New Issue
Block a user