Change worker-multiplier to float
Change the worker-multiplier to a floating point config option type instead of integer. This allows users to specify workers to be less than the number of CPUs, which is useful in deployments with multiple services deployed into containers on top of bare metal. The fix is to simply change the config option type and to sync in the necessary update from lp:charm-helpers. Partial-Bug: #1602444 Change-Id: I2c846832d24f709a3d019b766f5f23c28c4371f4 Signed-off-by: Billy Olsen <billy.olsen@gmail.com>
This commit is contained in:
parent
01148cc7a9
commit
8d35070586
|
@ -335,8 +335,8 @@ options:
|
|||
default:
|
||||
description: SSL key to use with certificate specified as console-ssl-cert.
|
||||
worker-multiplier:
|
||||
type: int
|
||||
default: 2
|
||||
type: float
|
||||
default: 2.0
|
||||
description: |
|
||||
The CPU core multiplier to use when configuring worker processes for
|
||||
Nova and Neutron. By default, the number of workers for each daemon
|
||||
|
|
|
@ -71,7 +71,7 @@ class OpenStackAmuletDeployment(AmuletDeployment):
|
|||
base_charms = {
|
||||
'mysql': ['precise', 'trusty'],
|
||||
'mongodb': ['precise', 'trusty'],
|
||||
'nrpe': ['precise', 'trusty'],
|
||||
'nrpe': ['precise', 'trusty', 'wily', 'xenial'],
|
||||
}
|
||||
|
||||
for svc in other_services:
|
||||
|
@ -112,7 +112,7 @@ class OpenStackAmuletDeployment(AmuletDeployment):
|
|||
|
||||
# Charms which should use the source config option
|
||||
use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
|
||||
'ceph-osd', 'ceph-radosgw', 'ceph-mon']
|
||||
'ceph-osd', 'ceph-radosgw', 'ceph-mon', 'ceph-proxy']
|
||||
|
||||
# Charms which can not use openstack-origin, ie. many subordinates
|
||||
no_origin = ['cinder-ceph', 'hacluster', 'neutron-openvswitch', 'nrpe',
|
||||
|
|
|
@ -57,6 +57,7 @@ from charmhelpers.core.host import (
|
|||
mkdir,
|
||||
write_file,
|
||||
pwgen,
|
||||
lsb_release,
|
||||
)
|
||||
from charmhelpers.contrib.hahelpers.cluster import (
|
||||
determine_apache_port,
|
||||
|
@ -1195,7 +1196,10 @@ class WorkerConfigContext(OSContextGenerator):
|
|||
|
||||
def __call__(self):
|
||||
multiplier = config('worker-multiplier') or 0
|
||||
ctxt = {"workers": self.num_cpus * multiplier}
|
||||
count = int(self.num_cpus * multiplier)
|
||||
if multiplier > 0 and count == 0:
|
||||
count = 1
|
||||
ctxt = {"workers": count}
|
||||
return ctxt
|
||||
|
||||
|
||||
|
@ -1436,7 +1440,8 @@ class AppArmorContext(OSContextGenerator):
|
|||
:return ctxt: Dictionary of the apparmor profile or None
|
||||
"""
|
||||
if config('aa-profile-mode') in ['disable', 'enforce', 'complain']:
|
||||
ctxt = {'aa_profile_mode': config('aa-profile-mode')}
|
||||
ctxt = {'aa_profile_mode': config('aa-profile-mode'),
|
||||
'ubuntu_release': lsb_release()['DISTRIB_RELEASE']}
|
||||
else:
|
||||
ctxt = None
|
||||
return ctxt
|
||||
|
|
|
@ -174,7 +174,7 @@ def init_is_systemd():
|
|||
|
||||
|
||||
def adduser(username, password=None, shell='/bin/bash', system_user=False,
|
||||
primary_group=None, secondary_groups=None, uid=None):
|
||||
primary_group=None, secondary_groups=None, uid=None, home_dir=None):
|
||||
"""Add a user to the system.
|
||||
|
||||
Will log but otherwise succeed if the user already exists.
|
||||
|
@ -186,6 +186,7 @@ def adduser(username, password=None, shell='/bin/bash', system_user=False,
|
|||
:param str primary_group: Primary group for user; defaults to username
|
||||
:param list secondary_groups: Optional list of additional groups
|
||||
:param int uid: UID for user being created
|
||||
:param str home_dir: Home directory for user
|
||||
|
||||
:returns: The password database entry struct, as returned by `pwd.getpwnam`
|
||||
"""
|
||||
|
@ -200,6 +201,8 @@ def adduser(username, password=None, shell='/bin/bash', system_user=False,
|
|||
cmd = ['useradd']
|
||||
if uid:
|
||||
cmd.extend(['--uid', str(uid)])
|
||||
if home_dir:
|
||||
cmd.extend(['--home', str(home_dir)])
|
||||
if system_user or password is None:
|
||||
cmd.append('--system')
|
||||
else:
|
||||
|
|
|
@ -71,7 +71,7 @@ class OpenStackAmuletDeployment(AmuletDeployment):
|
|||
base_charms = {
|
||||
'mysql': ['precise', 'trusty'],
|
||||
'mongodb': ['precise', 'trusty'],
|
||||
'nrpe': ['precise', 'trusty'],
|
||||
'nrpe': ['precise', 'trusty', 'wily', 'xenial'],
|
||||
}
|
||||
|
||||
for svc in other_services:
|
||||
|
@ -112,7 +112,7 @@ class OpenStackAmuletDeployment(AmuletDeployment):
|
|||
|
||||
# Charms which should use the source config option
|
||||
use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
|
||||
'ceph-osd', 'ceph-radosgw', 'ceph-mon']
|
||||
'ceph-osd', 'ceph-radosgw', 'ceph-mon', 'ceph-proxy']
|
||||
|
||||
# Charms which can not use openstack-origin, ie. many subordinates
|
||||
no_origin = ['cinder-ceph', 'hacluster', 'neutron-openvswitch', 'nrpe',
|
||||
|
|
|
@ -293,8 +293,10 @@ class NovaComputeContextTests(CharmTestCase):
|
|||
'https://10.5.0.1:6082/spice_auto.html')
|
||||
|
||||
@mock.patch('charmhelpers.core.hookenv.local_unit')
|
||||
def test_nova_config_context(self, local_unit):
|
||||
@mock.patch('charmhelpers.contrib.openstack.context.config')
|
||||
def test_nova_config_context(self, mock_config, local_unit):
|
||||
local_unit.return_value = 'nova-cloud-controller/0'
|
||||
mock_config.side_effect = self.test_config.get
|
||||
ctxt = context.NovaConfigContext()()
|
||||
self.assertEqual(ctxt['scheduler_default_filters'],
|
||||
self.config('scheduler-default-filters'))
|
||||
|
|
Loading…
Reference in New Issue