Expose *_allocation_ratio config

This commit exposes allocation ratio configuration via the cloud-compute
relation for backwards compatiable behaviour of the charms when
configuration of allocation ratios is delegated to nova-compute.

Closes-Bug: #1677223
Change-Id: I5a6bd1fa06d06dfd3e49182cc72ad83025429b13
This commit is contained in:
Brett Milford 2021-05-24 14:09:20 +10:00 committed by Aurelien Lourot
parent 27df75e61a
commit eeac5fca96
1 changed files with 9 additions and 0 deletions

View File

@ -404,6 +404,15 @@ class NovaConfigContext(ch_context.WorkerConfigContext):
ctxt['disk_allocation_ratio'] = hookenv.config('disk-allocation-ratio')
ctxt['cpu_allocation_ratio'] = hookenv.config('cpu-allocation-ratio')
ctxt['ram_allocation_ratio'] = hookenv.config('ram-allocation-ratio')
for rid in hookenv.relation_ids('cloud-compute'):
rdata = {
'disk_allocation_ratio': ctxt['disk_allocation_ratio'],
'cpu_allocation_ratio': ctxt['cpu_allocation_ratio'],
'ram_allocation_ratio': ctxt['ram_allocation_ratio'],
}
hookenv.relation_set(relation_settings=rdata, relation_id=rid)
ctxt['enable_new_services'] = hookenv.config('enable-new-services')
addr = ch_ip.resolve_address(ch_ip.INTERNAL)
ctxt['host_ip'] = ch_network_ip.format_ipv6_addr(addr) or addr