From c2d4045a23f086a18249f513d38fc0669aad0dcc Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Tue, 28 Mar 2017 18:42:39 -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: Ic49f5b8fc03789c47d180295aca6e2483071c06f Signed-off-by: Kevin Carter --- defaults/main.yml | 9 +++++++++ .../cinder-init-config-overrides-ffce7e419061c4da.yaml | 10 ++++++++++ tasks/cinder_init_systemd.yml | 4 +++- templates/cinder-systemd-init.j2 | 9 +++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/cinder-init-config-overrides-ffce7e419061c4da.yaml diff --git a/defaults/main.yml b/defaults/main.yml index d33fb107..3f80c381 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -254,21 +254,30 @@ cinder_pip_packages: - python-cinderclient - python-keystoneclient +cinder_api_init_overrides: {} +cinder_scheduler_init_overrides: {} +cinder_volume_init_overrides: {} +cinder_backup_init_overrides: {} + ## Service Name-Group Mapping cinder_services: cinder-api: group: cinder_api service_name: cinder-api + init_config_overrides: "{{ cinder_api_init_overrides }}" cinder-scheduler: group: cinder_scheduler service_name: cinder-scheduler + init_config_overrides: "{{ cinder_scheduler_init_overrides }}" cinder-volume: group: cinder_volume service_name: cinder-volume + init_config_overrides: "{{ cinder_volume_init_overrides }}" cinder-backup: group: cinder_backup service_name: cinder-backup condition: "{{ cinder_service_backup_program_enabled | bool }}" + init_config_overrides: "{{ cinder_backup_init_overrides }}" # This variable is used by the repo_build process to determine # which host group to check for members of before building the diff --git a/releasenotes/notes/cinder-init-config-overrides-ffce7e419061c4da.yaml b/releasenotes/notes/cinder-init-config-overrides-ffce7e419061c4da.yaml new file mode 100644 index 00000000..a1ea3949 --- /dev/null +++ b/releasenotes/notes/cinder-init-config-overrides-ffce7e419061c4da.yaml @@ -0,0 +1,10 @@ +--- +features: + - New variables have been added to allow a deployer to customize + a cinder systemd unit file to their liking. + - The task dropping the cinder 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/cinder_init_systemd.yml b/tasks/cinder_init_systemd.yml index 450535b1..d7355ae3 100644 --- a/tasks/cinder_init_systemd.yml +++ b/tasks/cinder_init_systemd.yml @@ -63,12 +63,14 @@ - "{{ item.value.condition | default(true) }}" - name: Place the systemd init script - template: + config_template: src: "cinder-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: "{{ cinder_services }}" when: - inventory_hostname in groups[item.value.group] diff --git a/templates/cinder-systemd-init.j2 b/templates/cinder-systemd-init.j2 index c353c120..bd35944b 100644 --- a/templates/cinder-systemd-init.j2 +++ b/templates/cinder-systemd-init.j2 @@ -21,5 +21,14 @@ TimeoutSec=300 Restart=on-failure RestartSec=150 +# This creates a specific slice which all nova services will operate from +# The accounting options give us the ability to see resource usage through +# the `systemd-cgtop` command. +Slice=cinder.slice +CPUAccounting=true +BlockIOAccounting=true +MemoryAccounting=false +TasksAccounting=true + [Install] WantedBy=multi-user.target