Merge "Update for newer OpenStack releases"
This commit is contained in:
commit
d4c32a1965
|
@ -27,6 +27,7 @@ from charmhelpers.core.hookenv import (
|
|||
is_relation_made,
|
||||
relation_set,
|
||||
status_set,
|
||||
relation_ids,
|
||||
)
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
configure_installation_source,
|
||||
|
@ -69,8 +70,9 @@ def install():
|
|||
|
||||
|
||||
@hooks.hook('nova-ceilometer-relation-joined')
|
||||
def nova_ceilometer_joined():
|
||||
relation_set(subordinate_configuration=json.dumps(NOVA_SETTINGS))
|
||||
def nova_ceilometer_joined(relation_id=None):
|
||||
relation_set(relation_id=relation_id,
|
||||
subordinate_configuration=json.dumps(NOVA_SETTINGS))
|
||||
|
||||
|
||||
@hooks.hook("ceilometer-service-relation-changed")
|
||||
|
@ -86,6 +88,10 @@ def upgrade_charm():
|
|||
apt_install(
|
||||
filter_installed_packages(get_packages()),
|
||||
fatal=True)
|
||||
# NOTE(jamespage): Ensure any changes to nova presented data are made
|
||||
# during charm upgrades.
|
||||
for rid in relation_ids('nova-ceilometer'):
|
||||
nova_ceilometer_joined(rid)
|
||||
|
||||
|
||||
@hooks.hook('config-changed')
|
||||
|
|
|
@ -60,10 +60,6 @@ NOVA_SETTINGS = {
|
|||
('instance_usage_audit', 'True'),
|
||||
('instance_usage_audit_period', 'hour'),
|
||||
('notify_on_state_change', 'vm_and_task_state'),
|
||||
('notification_driver',
|
||||
'ceilometer.compute.nova_notifier'),
|
||||
('notification_driver',
|
||||
'nova.openstack.common.notifier.rpc_notifier')
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -458,10 +458,7 @@ class CeiloAgentBasicDeployment(OpenStackAmuletDeployment):
|
|||
sub = ('{"nova": {"/etc/nova/nova.conf": {"sections": {"DEFAULT": '
|
||||
'[["instance_usage_audit", "True"], '
|
||||
'["instance_usage_audit_period", "hour"], '
|
||||
'["notify_on_state_change", "vm_and_task_state"], '
|
||||
'["notification_driver", "ceilometer.compute.nova_notifier"], '
|
||||
'["notification_driver", '
|
||||
'"nova.openstack.common.notifier.rpc_notifier"]]}}}}')
|
||||
'["notify_on_state_change", "vm_and_task_state"]]}}}}')
|
||||
expected = {
|
||||
'subordinate_configuration': sub,
|
||||
'private-address': u.valid_ip
|
||||
|
@ -559,33 +556,12 @@ class CeiloAgentBasicDeployment(OpenStackAmuletDeployment):
|
|||
}
|
||||
}
|
||||
|
||||
# NOTE(beisner): notification_driver is not checked like the
|
||||
# others, as configparser does not support duplicate config
|
||||
# options, and dicts cant have duplicate keys.
|
||||
# Ex. from conf file:
|
||||
# notification_driver = ceilometer.compute.nova_notifier
|
||||
# notification_driver = nova.openstack.common.notifier.rpc_notifier
|
||||
for section, pairs in expected.iteritems():
|
||||
ret = u.validate_config_data(unit, conf, section, pairs)
|
||||
if ret:
|
||||
message = "ceilometer config error: {}".format(ret)
|
||||
amulet.raise_status(amulet.FAIL, msg=message)
|
||||
|
||||
# Check notification_driver existence via simple grep cmd
|
||||
lines = [('notification_driver = '
|
||||
'ceilometer.compute.nova_notifier'),
|
||||
('notification_driver = '
|
||||
'nova.openstack.common.notifier.rpc_notifier')]
|
||||
|
||||
sentry_units = [unit]
|
||||
cmds = []
|
||||
for line in lines:
|
||||
cmds.append('grep "{}" {}'.format(line, conf))
|
||||
|
||||
ret = u.check_commands_on_units(cmds, sentry_units)
|
||||
if ret:
|
||||
amulet.raise_status(amulet.FAIL, msg=ret)
|
||||
|
||||
u.log.debug('OK')
|
||||
|
||||
def test_302_nova_ceilometer_config(self):
|
||||
|
|
|
@ -83,6 +83,7 @@ class CeilometerHooksTest(CharmTestCase):
|
|||
def test_nova_ceilometer_joined(self, mock_config):
|
||||
hooks.hooks.execute(['hooks/nova-ceilometer-relation-joined'])
|
||||
self.relation_set.assert_called_with(
|
||||
relation_id=None,
|
||||
subordinate_configuration=json.dumps(
|
||||
ceilometer_utils.NOVA_SETTINGS))
|
||||
|
||||
|
|
Loading…
Reference in New Issue