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: I31d7652e7ad5db0185b78e2c4c2c1d2ddba05be2 Signed-off-by: Billy Olsen <billy.olsen@gmail.com>
This commit is contained in:
parent
264b0885e8
commit
97180d7100
@ -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:
|
||||
|
@ -60,8 +60,8 @@ options:
|
||||
type: int
|
||||
description: Listening port of the swift-account-server.
|
||||
worker-multiplier:
|
||||
default: 1
|
||||
type: int
|
||||
default: 1.0
|
||||
type: float
|
||||
description: |
|
||||
The CPU multiplier to use when configuring worker processes for the
|
||||
account, container and object server processes.
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user