Restart openvswitch-vswitch when requested

Restart requests can be sent by related charms. A request to restart
services did not previously restart openvswitch. This change adds the
ability to restart it.

Closes-Bug: 1628093
Change-Id: I0f57d84e2cdaa103c18a1cdacd996f9421fba46c
This commit is contained in:
Liam Young 2016-09-27 13:29:51 +00:00
parent 7e4bd68494
commit 4463c334ca
3 changed files with 8 additions and 7 deletions

View File

@ -155,13 +155,14 @@ BASE_RESOURCE_MAP = OrderedDict([
}),
(OVS_DEFAULT, {
'services': ['openvswitch-switch'],
'contexts': [neutron_ovs_context.OVSDPDKDeviceContext()],
'contexts': [neutron_ovs_context.OVSDPDKDeviceContext(),
neutron_ovs_context.RemoteRestartContext(
['neutron-plugin', 'neutron-control'])],
}),
(DPDK_INTERFACES, {
'services': ['dpdk'],
'contexts': [neutron_ovs_context.DPDKDeviceContext()],
}),
(PHY_NIC_MTU_CONF, {
'services': ['os-charm-phy-nic-mtu'],
'contexts': [context.PhyNICMTUContext()],
@ -293,14 +294,9 @@ def resource_map():
'neutron-openvswitch-agent'
)
if not use_dpdk():
# NOTE; /etc/default/openvswitch only used for
# DPDK configuration so drop if DPDK not
# in use
del resource_map[OVS_DEFAULT]
del resource_map[DPDK_INTERFACES]
else:
del resource_map[OVS_CONF]
del resource_map[OVS_DEFAULT]
del resource_map[DPDK_INTERFACES]
return resource_map

View File

@ -3,6 +3,8 @@
# [ WARNING ]
# Configuration file maintained by Juju. Local changes may be overwritten.
# Configuration managed by neutron-openvswitch charm
# Service restart triggered by remote application: {{ restart_trigger }}
# {{ restart_trigger_ovs }}
###############################################################################
{% if dpdk_enabled -%}
DPDK_OPTS='--dpdk -c {{ cpu_mask }} -n 4 --socket-mem {{ socket_memory }} {{ device_whitelist }} --vhost-owner libvirt-qemu:kvm --vhost-perm 0660'

View File

@ -205,6 +205,7 @@ class TestNeutronOVSUtils(CharmTestCase):
_regconfs = nutils.register_configs()
confs = ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/ml2_conf.ini',
'/etc/default/openvswitch-switch',
'/etc/init/os-charm-phy-nic-mtu.conf']
self.assertItemsEqual(_regconfs.configs, confs)
@ -225,6 +226,7 @@ class TestNeutronOVSUtils(CharmTestCase):
_regconfs = nutils.register_configs()
confs = ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/ml2/openvswitch_agent.ini',
'/etc/default/openvswitch-switch',
'/etc/init/os-charm-phy-nic-mtu.conf']
self.assertItemsEqual(_regconfs.configs, confs)
@ -280,6 +282,7 @@ class TestNeutronOVSUtils(CharmTestCase):
expect = OrderedDict([
(nutils.NEUTRON_CONF, ['neutron-plugin-openvswitch-agent']),
(ML2CONF, ['neutron-plugin-openvswitch-agent']),
(nutils.OVS_DEFAULT, ['openvswitch-switch']),
(nutils.PHY_NIC_MTU_CONF, ['os-charm-phy-nic-mtu'])
])
self.assertEqual(expect, _restart_map)