From a51775e99ff373a1c6e14bcaa94cd51a269823e8 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Tue, 28 Mar 2017 21:05:42 -0500 Subject: [PATCH] Ensure the components are isolated from the system This creates a specific slice which all OpenStack services will operate from. By creating an independent slice these components will be governed away from the system slice allowing us to better optimise resource consumption. See the following for more information on slices: * https://www.freedesktop.org/software/systemd/man/systemd.slice.html See for following for more information on resource controls: * https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html Tools like ``systemd-cgtop`` and ``systemd-cgls`` will now give us insight into specific processes, process groups, and resouce consumption in ways that we've not had access to before. To enable some of this reporting the accounting options have been added to the [Service] section of the unit file. Change-Id: Ib19624a57063fba8f63eed5308639be224751fed Signed-off-by: Kevin Carter --- defaults/main.yml | 9 +++++++++ ...tavia-init-config-overrides-ffce7e419061c4da.yaml | 10 ++++++++++ tasks/octavia_init_systemd.yml | 4 +++- templates/octavia-systemd-init.j2 | 9 +++++++++ vars/main.yml | 12 ------------ 5 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 releasenotes/notes/octavia-init-config-overrides-ffce7e419061c4da.yaml delete mode 100644 vars/main.yml diff --git a/defaults/main.yml b/defaults/main.yml index 4853dac9..89bbfb76 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -168,20 +168,29 @@ octavia_pip_packages: - python-troveclient - octavia +octavia_api_init_overrides: {} +octavia_worker_init_overrides: {} +octavia_housekeeping_init_overrides: {} +octavia_health_manager_init_overrides: {} + ## Service Name-Group Mapping octavia_services: octavia-api: group: octavia_api service_name: octavia-api + init_config_overrides: "{{ octavia_api_init_overrides }}" octavia-worker: group: octavia_worker service_name: octavia-worker + init_config_overrides: "{{ octavia_worker_init_overrides }}" octavia-housekeeping: group: octavia_housekeeping service_name: octavia-housekeeping + init_config_overrides: "{{ octavia_housekeeping_init_overrides }}" octavia-health-manager: group: octavia_health_manager service_name: octavia-health-manager + init_config_overrides: "{{ octavia_health_manager_init_overrides }}" # Required secrets for the role octavia_required_secrets: diff --git a/releasenotes/notes/octavia-init-config-overrides-ffce7e419061c4da.yaml b/releasenotes/notes/octavia-init-config-overrides-ffce7e419061c4da.yaml new file mode 100644 index 00000000..4bfeb091 --- /dev/null +++ b/releasenotes/notes/octavia-init-config-overrides-ffce7e419061c4da.yaml @@ -0,0 +1,10 @@ +--- +features: + - New variables have been added to allow a deployer to customize + a octavia systemd unit file to their liking. + - The task dropping the octavia systemd unit files now uses the + ``config_template`` action plugin allowing deployers access to + customize the unit files as they see fit without having to + load extra options into the defaults and polute the generic + systemd unit file with jinja2 variables and conditionals. + diff --git a/tasks/octavia_init_systemd.yml b/tasks/octavia_init_systemd.yml index ef780b8e..39ea2415 100644 --- a/tasks/octavia_init_systemd.yml +++ b/tasks/octavia_init_systemd.yml @@ -50,12 +50,14 @@ with_dict: "{{ octavia_services }}" - name: Place the systemd init script - template: + config_template: src: "octavia-systemd-init.j2" dest: "/etc/systemd/system/{{ item.value.service_name }}.service" mode: "0644" owner: "root" group: "root" + config_overrides: "{{ item.value.init_config_overrides }}" + config_type: "ini" with_dict: "{{ octavia_services }}" notify: - Reload systemd daemon diff --git a/templates/octavia-systemd-init.j2 b/templates/octavia-systemd-init.j2 index 724acaac..15af05c1 100644 --- a/templates/octavia-systemd-init.j2 +++ b/templates/octavia-systemd-init.j2 @@ -21,5 +21,14 @@ TimeoutSec=300 Restart=on-failure RestartSec=150 +# This creates a specific slice which all services will operate from +# The accounting options give us the ability to see resource usage through +# the `systemd-cgtop` command. +Slice=octavia.slice +CPUAccounting=true +BlockIOAccounting=true +MemoryAccounting=false +TasksAccounting=true + [Install] WantedBy=multi-user.target diff --git a/vars/main.yml b/vars/main.yml deleted file mode 100644 index 34b06547..00000000 --- a/vars/main.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -# vars file for openstack-ansible-os_octavia - -octavia_services: - octavia_api: - service_name: octavia-api - octavia_worker: - service_name: octavia-worker - octavia_health_manager: - service_name: octavia-health-manager - octavia_housekeeping: - service_name: octavia-housekeeping \ No newline at end of file