Stop resource before deleting it.
Pacemaker will refuse to delete a resource that it's running, so it needs to be stopped always before deleting it. Change-Id: I3c6acdef401e9ec18fedc65e9c77db4719fe60ec Closes-Bug: #1838528
This commit is contained in:
parent
66d5bfb2d2
commit
666055844e
@ -354,6 +354,11 @@ def ha_relation_changed():
|
||||
pcmk.commit('crm resource cleanup %s' % res_name)
|
||||
# Daemon process may still be running after the upgrade.
|
||||
kill_legacy_ocf_daemon_process(res_name)
|
||||
|
||||
# Stop the resource before the deletion (LP: #1838528)
|
||||
log('Stopping %s' % res_name, level=INFO)
|
||||
pcmk.commit('crm -w -F resource stop %s' % res_name)
|
||||
log('Deleting %s' % res_name, level=INFO)
|
||||
pcmk.commit('crm -w -F configure delete %s' % res_name)
|
||||
|
||||
log('Configuring Resources: %s' % (resources), level=DEBUG)
|
||||
|
@ -75,7 +75,8 @@ class TestCorosyncConf(unittest.TestCase):
|
||||
|
||||
def fake_crm_opt_exists(res_name):
|
||||
# res_ubuntu will take the "update resource" route
|
||||
return res_name == "res_ubuntu"
|
||||
# res_nova_eth0_vip will take the delete resource route
|
||||
return res_name in ["res_ubuntu", "res_nova_eth0_vip"]
|
||||
|
||||
crm_opt_exists.side_effect = fake_crm_opt_exists
|
||||
commit.return_value = 0
|
||||
@ -105,7 +106,8 @@ class TestCorosyncConf(unittest.TestCase):
|
||||
'resource_params': {'res_foo': 'params bar',
|
||||
'res_ubuntu': 'params ubuntu=42'},
|
||||
'ms': {'ms_foo': 'res_foo meta notify=true'},
|
||||
'orders': {'foo_after': 'inf: res_foo ms_foo'}}
|
||||
'orders': {'foo_after': 'inf: res_foo ms_foo'},
|
||||
'delete_resources': ['res_nova_eth0_vip']}
|
||||
|
||||
def fake_parse_data(relid, unit, key):
|
||||
return rel_get_data.get(key, {})
|
||||
@ -125,6 +127,12 @@ class TestCorosyncConf(unittest.TestCase):
|
||||
configure_pacemaker_remote_resources.assert_called_with()
|
||||
write_maas_dns_address.assert_not_called()
|
||||
|
||||
# verify deletion of resources.
|
||||
crm_opt_exists.assert_any_call('res_nova_eth0_vip')
|
||||
commit.assert_any_call('crm resource cleanup res_nova_eth0_vip')
|
||||
commit.assert_any_call('crm -w -F resource stop res_nova_eth0_vip')
|
||||
commit.assert_any_call('crm -w -F configure delete res_nova_eth0_vip')
|
||||
|
||||
for kw, key in [('location', 'locations'),
|
||||
('clone', 'clones'),
|
||||
('group', 'groups'),
|
||||
|
Loading…
Reference in New Issue
Block a user