From b7098a6bdea73c869f45a86e0cc78d21b032161e Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Tue, 28 Mar 2017 20:46:52 -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: I5885643199db3ef618fc86f0cd80c14f1d7c89c4 Signed-off-by: Kevin Carter --- defaults/main.yml | 14 ++++++++++++++ ...ova-init-config-overrides-ffce7e419061c4da.yaml | 10 ++++++++++ tasks/designate_init_systemd.yml | 4 +++- templates/designate-systemd-init.j2 | 9 +++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/nova-init-config-overrides-ffce7e419061c4da.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 8efd984..cae65e4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -148,26 +148,40 @@ designate_pip_packages: - pycrypto - warlock +designate_central_init_overrides: {} +designate_worker_init_overrides: {} +designate_producer_init_overrides: {} +designate_mdns_init_overrides: {} +designate_sink_init_overrides: {} +designate_api_init_overrides: {} + + ## Service Name-Group Mapping designate_services: designate-central: group: designate_central service_name: designate-central + init_config_overrides: "{{ designate_central_init_overrides }}" designate-worker: group: designate_worker service_name: designate-worker + init_config_overrides: "{{ designate_worker_init_overrides }}" designate-producer: group: designate_producer service_name: designate-producer + init_config_overrides: "{{ designate_producer_init_overrides }}" designate-mdns: group: designate_mdns service_name: designate-mdns + init_config_overrides: "{{ designate_mdns_init_overrides }}" designate-sink: group: designate_sink service_name: designate-sink + init_config_overrides: "{{ designate_sink_init_overrides }}" designate-api: group: designate_api service_name: designate-api + init_config_overrides: "{{ designate_api_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/nova-init-config-overrides-ffce7e419061c4da.yaml b/releasenotes/notes/nova-init-config-overrides-ffce7e419061c4da.yaml new file mode 100644 index 0000000..216cbc6 --- /dev/null +++ b/releasenotes/notes/nova-init-config-overrides-ffce7e419061c4da.yaml @@ -0,0 +1,10 @@ +--- +features: + - New variables have been added to allow a deployer to customize + a designate systemd unit file to their liking. + - The task dropping the designate 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/designate_init_systemd.yml b/tasks/designate_init_systemd.yml index e842339..ac35185 100644 --- a/tasks/designate_init_systemd.yml +++ b/tasks/designate_init_systemd.yml @@ -44,12 +44,14 @@ when: inventory_hostname in groups[item.value.group] - name: Place the systemd init script - template: + config_template: src: "designate-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: "{{ designate_services }}" when: inventory_hostname in groups[item.value.group] notify: diff --git a/templates/designate-systemd-init.j2 b/templates/designate-systemd-init.j2 index 44650eb..a9eb455 100644 --- a/templates/designate-systemd-init.j2 +++ b/templates/designate-systemd-init.j2 @@ -21,5 +21,14 @@ TimeoutSec=300 Restart=on-failure RestartSec=150 +# This creates a specific slice which all designate services will operate from +# The accounting options give us the ability to see resource usage through +# the `systemd-cgtop` command. +Slice=designate.slice +CPUAccounting=true +BlockIOAccounting=true +MemoryAccounting=false +TasksAccounting=true + [Install] WantedBy=multi-user.target