Skip QoS update while creating network during init
Metadata initialization includes the creation of an internal network which is done only once. Yet, this breaks when QoS update is called, as QoS neutron method doesn't work before init is complete. As QoS is not really needed for the internal metadata network, it can be skipped, until init is complete. Change-Id: I057367503853df0b692098f1e170e335e7e79b9e
This commit is contained in:
parent
9e74370f6b
commit
06bfe48b6d
@ -169,6 +169,10 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
floatingip=l3_db.FloatingIP)
|
||||
def __init__(self):
|
||||
super(NsxVPluginV2, self).__init__()
|
||||
self.init_is_complete = False
|
||||
registry.subscribe(self.init_complete,
|
||||
resources.PROCESS,
|
||||
events.AFTER_CREATE)
|
||||
self.metadata_proxy_handler = None
|
||||
config.validate_nsxv_config_options()
|
||||
neutron_extensions.append_api_extensions_path(
|
||||
@ -219,6 +223,9 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
self.metadata_proxy_handler = (
|
||||
nsx_v_md_proxy.NsxVMetadataProxyHandler(self))
|
||||
|
||||
def init_complete(self, resource, event, trigger, **kwargs):
|
||||
self.init_is_complete = True
|
||||
|
||||
def _start_rpc_listeners(self):
|
||||
self.conn = n_rpc.create_connection()
|
||||
qos_topic = resources_rpc.resource_type_versioned_topic(
|
||||
@ -925,7 +932,12 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
self._delete_backend_network(net_moref)
|
||||
LOG.exception(_LE('Failed to create network'))
|
||||
|
||||
if backend_network:
|
||||
# If init is incomplete calling _update_qos_network() will result a
|
||||
# deadlock.
|
||||
# That situation happens when metadata init is creating a network
|
||||
# on its 1st execution.
|
||||
# Therefore we skip this code during init.
|
||||
if backend_network and self.init_is_complete:
|
||||
# Update the QOS restrictions of the backend network
|
||||
self._update_network_qos(context, net_data, dvs_net_ids, net_moref)
|
||||
new_net[qos_consts.QOS_POLICY_ID] = (
|
||||
|
@ -509,6 +509,9 @@ class TestNetworksV2(test_plugin.TestNetworksV2, NsxVPluginV2TestCase):
|
||||
plugin = self._get_core_plugin_with_dvs()
|
||||
ctx = context.get_admin_context()
|
||||
|
||||
# Mark init as complete, as otherwise QoS won't be called
|
||||
plugin.init_is_complete = True
|
||||
|
||||
# fake policy id
|
||||
policy_id = _uuid()
|
||||
data = {'network': {
|
||||
|
@ -46,6 +46,7 @@ class TestQosNsxVNotification(test_plugin.NsxVPluginV2TestCase,
|
||||
ext_mgr=None)
|
||||
plugin_instance = manager.NeutronManager.get_plugin()
|
||||
self._core_plugin = plugin_instance
|
||||
self._core_plugin.init_is_complete = True
|
||||
|
||||
# Setup the QoS plugin:
|
||||
# Add a dummy notification driver that calls our handler directly
|
||||
|
Loading…
Reference in New Issue
Block a user