Fix for not restarting subordinate services on managed upgrade
This fixes the referenced bug by ensuring that the action does initiate remote restarts for container scoped related units. Change-Id: I149b753355b64113adfd8fd4eea972978b7ed20b Closes-Bug:#1835557
This commit is contained in:
parent
f9c03c68c4
commit
dc8a6d0056
@ -32,12 +32,15 @@ _add_path(_hooks)
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
do_action_openstack_upgrade,
|
||||
)
|
||||
|
||||
from charmhelpers.core.hookenv import (
|
||||
relation_ids,
|
||||
)
|
||||
from nova_compute_utils import do_openstack_upgrade
|
||||
|
||||
from nova_compute_hooks import (
|
||||
config_changed,
|
||||
CONFIGS
|
||||
CONFIGS,
|
||||
neutron_plugin_joined,
|
||||
nova_ceilometer_joined,
|
||||
)
|
||||
|
||||
|
||||
@ -52,6 +55,14 @@ def openstack_upgrade():
|
||||
if (do_action_openstack_upgrade('nova-common',
|
||||
do_openstack_upgrade,
|
||||
CONFIGS)):
|
||||
# we should restart the container scoped (subordinate) plugins after a
|
||||
# managed openstack upgrade see: BUG#1835557
|
||||
for rid in relation_ids('neutron-plugin'):
|
||||
neutron_plugin_joined(rid, remote_restart=True)
|
||||
for rid in relation_ids('nova-ceilometer'):
|
||||
nova_ceilometer_joined(rid, remote_restart=True)
|
||||
# NOTE(ajkavanagh) - if unit is paused (usually true for managed
|
||||
# upgrade) then the config_changed() function is a no-op
|
||||
config_changed()
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -232,7 +232,8 @@ def config_changed():
|
||||
fp = config('instances-path')
|
||||
fix_path_ownership(fp, user='nova')
|
||||
|
||||
[compute_joined(rid) for rid in relation_ids('cloud-compute')]
|
||||
for rid in relation_ids('cloud-compute'):
|
||||
compute_joined(rid)
|
||||
|
||||
for rid in relation_ids('neutron-plugin'):
|
||||
neutron_plugin_joined(rid, remote_restart=send_remote_restart)
|
||||
|
@ -41,20 +41,34 @@ class TestNovaComputeUpgradeActions(CharmTestCase):
|
||||
super(TestNovaComputeUpgradeActions, self).setUp(openstack_upgrade,
|
||||
TO_PATCH)
|
||||
|
||||
@patch.object(openstack_upgrade, 'nova_ceilometer_joined')
|
||||
@patch.object(openstack_upgrade, 'neutron_plugin_joined')
|
||||
@patch.object(openstack_upgrade, 'relation_ids')
|
||||
@patch('charmhelpers.contrib.openstack.utils.config')
|
||||
@patch('charmhelpers.contrib.openstack.utils.action_set')
|
||||
@patch('charmhelpers.contrib.openstack.utils.openstack_upgrade_available')
|
||||
@patch('charmhelpers.contrib.openstack.utils.juju_log')
|
||||
def test_openstack_upgrade_true(self, log, upgrade_avail,
|
||||
action_set, config):
|
||||
action_set, config, relation_ids,
|
||||
neutron_plugin_joined,
|
||||
nova_ceilometer_joined):
|
||||
|
||||
upgrade_avail.return_value = True
|
||||
config.return_value = True
|
||||
|
||||
def fake_relation_ids(thing):
|
||||
return {'neutron-plugin': ['1'],
|
||||
'nova-ceilometer': ['2']}[thing]
|
||||
|
||||
relation_ids.side_effect = fake_relation_ids
|
||||
|
||||
openstack_upgrade.openstack_upgrade()
|
||||
|
||||
self.assertTrue(self.do_openstack_upgrade.called)
|
||||
self.assertTrue(self.config_changed.called)
|
||||
neutron_plugin_joined.assert_called_once_with("1", remote_restart=True)
|
||||
nova_ceilometer_joined.assert_called_once_with(
|
||||
"2", remote_restart=True)
|
||||
|
||||
@patch('charmhelpers.contrib.openstack.utils.config')
|
||||
@patch('charmhelpers.contrib.openstack.utils.action_set')
|
||||
|
Loading…
x
Reference in New Issue
Block a user