Fix NVP plugin not notifying metadata access network to DHCP agent
Bug 1133395 Due to recent changes in notification logic between Quantum and the DHCP agent, the notifier the NVP plugin previously used for metadata access network was not working anymore and needed to be replaced Change-Id: Ifa0ea55116cf5ef6d546d28ca52e643987b3e5a0
This commit is contained in:
parent
578f7fa572
commit
2acc26f922
@ -18,12 +18,13 @@
|
||||
# @author: Salvatore Orlando, VMware
|
||||
|
||||
import netaddr
|
||||
from oslo.config import cfg
|
||||
|
||||
from quantum.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
||||
from quantum.api.v2 import attributes
|
||||
from quantum.common import constants
|
||||
from quantum.common import exceptions as q_exc
|
||||
from quantum.db import l3_db
|
||||
from quantum.openstack.common import cfg
|
||||
from quantum.openstack.common import log as logging
|
||||
from quantum.openstack.common.notifier import api as notifier_api
|
||||
from quantum.plugins.nicira.nicira_nvp_plugin.common import (exceptions
|
||||
@ -81,14 +82,13 @@ class NvpMetadataAccess(object):
|
||||
{'subnet': subnet_data})
|
||||
self.add_router_interface(ctx_elevated, router_id,
|
||||
{'subnet_id': meta_sub['id']})
|
||||
# We need to send a notification to the dhcp agent in order
|
||||
# to start the metadata agent proxy
|
||||
# Note: the publisher id is the same used in the api module
|
||||
notifier_api.notify(context,
|
||||
notifier_api.publisher_id('network'),
|
||||
'network.create.end',
|
||||
notifier_api.CONF.default_notification_level,
|
||||
{'network': meta_net})
|
||||
if cfg.CONF.dhcp_agent_notification:
|
||||
# We need to send a notification to the dhcp agent in
|
||||
# order to start the metadata agent proxy
|
||||
dhcp_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
|
||||
dhcp_notifier.notify(ctx_elevated,
|
||||
{'network': meta_net},
|
||||
'network.create.end')
|
||||
|
||||
def _destroy_metadata_access_network(self, context, router_id, ports):
|
||||
|
||||
@ -105,15 +105,13 @@ class NvpMetadataAccess(object):
|
||||
ctx_elevated, router_id, {'port_id': meta_port['id']})
|
||||
# Remove network (this will remove the subnet too)
|
||||
self.delete_network(ctx_elevated, meta_net_id)
|
||||
# We need to send a notification to the dhcp agent in order
|
||||
# to stop the metadata agent proxy
|
||||
# Note: the publisher id is the same used in the api module
|
||||
notifier_api.notify(
|
||||
context,
|
||||
notifier_api.publisher_id('network'),
|
||||
'network.delete.end',
|
||||
notifier_api.CONF.default_notification_level,
|
||||
{'network_id': meta_net_id})
|
||||
if cfg.CONF.dhcp_agent_notification:
|
||||
# We need to send a notification to the dhcp agent in
|
||||
# order to stop the metadata agent proxy
|
||||
dhcp_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
|
||||
dhcp_notifier.notify(ctx_elevated,
|
||||
{'network': {'id': meta_net_id}},
|
||||
'network.delete.end')
|
||||
|
||||
def _handle_metadata_access_network(self, context, router_id):
|
||||
if not cfg.CONF.NVP.enable_metadata_access_network:
|
||||
|
@ -274,19 +274,7 @@ class TestNiciraL3NatTestCase(test_l3_plugin.L3NatDBTestCase,
|
||||
|
||||
def test_router_add_interface_subnet_with_metadata_access(self):
|
||||
self._nvp_metadata_setup()
|
||||
notifications = ['router.create.start',
|
||||
'router.create.end',
|
||||
'network.create.start',
|
||||
'network.create.end',
|
||||
'subnet.create.start',
|
||||
'subnet.create.end',
|
||||
'router.interface.create',
|
||||
'network.create.end',
|
||||
'router.interface.create',
|
||||
'router.interface.delete',
|
||||
'router.interface.delete',
|
||||
'network.delete.end']
|
||||
self.test_router_add_interface_subnet(exp_notifications=notifications)
|
||||
self.test_router_add_interface_subnet()
|
||||
self._nvp_metadata_teardown()
|
||||
|
||||
def test_router_add_interface_port_with_metadata_access(self):
|
||||
|
@ -633,16 +633,15 @@ class L3NatDBTestCase(L3NatTestCaseBase):
|
||||
fip['floatingip']['router_id'], None,
|
||||
expected_code=exc.HTTPConflict.code)
|
||||
|
||||
def test_router_add_interface_subnet(self, exp_notifications=None):
|
||||
if not exp_notifications:
|
||||
exp_notifications = ['router.create.start',
|
||||
'router.create.end',
|
||||
'network.create.start',
|
||||
'network.create.end',
|
||||
'subnet.create.start',
|
||||
'subnet.create.end',
|
||||
'router.interface.create',
|
||||
'router.interface.delete']
|
||||
def test_router_add_interface_subnet(self):
|
||||
exp_notifications = ['router.create.start',
|
||||
'router.create.end',
|
||||
'network.create.start',
|
||||
'network.create.end',
|
||||
'subnet.create.start',
|
||||
'subnet.create.end',
|
||||
'router.interface.create',
|
||||
'router.interface.delete']
|
||||
with self.router() as r:
|
||||
with self.subnet() as s:
|
||||
body = self._router_interface_action('add',
|
||||
|
Loading…
Reference in New Issue
Block a user