From 562d330484871bd4d5e5f8cba403dfd8ba407177 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Tue, 28 Mar 2017 18:08:08 -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: I7f6d634eafeb47450127eed1e59f3e00ee3075a5 Signed-off-by: Kevin Carter --- defaults/main.yml | 4 ++++ .../magnum-init-config-overrides-ffce7e419061c4da.yaml | 9 +++++++++ tasks/magnum_init.yml | 2 ++ tasks/magnum_init_systemd.yml | 4 +++- templates/magnum-systemd-init.j2 | 9 +++++++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/magnum-init-config-overrides-ffce7e419061c4da.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 1f1b4ea..7e25f08 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -122,3 +122,7 @@ magnum_role_project_group: magnum_all # Store certificates in DB by default (x509keypair) # Other valid values are: barbican, local magnum_cert_manager_type: x509keypair + +magnum_api_init_config_overrides: {} +magnum_conductor_init_config_overrides: {} + diff --git a/releasenotes/notes/magnum-init-config-overrides-ffce7e419061c4da.yaml b/releasenotes/notes/magnum-init-config-overrides-ffce7e419061c4da.yaml new file mode 100644 index 0000000..744d69b --- /dev/null +++ b/releasenotes/notes/magnum-init-config-overrides-ffce7e419061c4da.yaml @@ -0,0 +1,9 @@ +--- +features: + - New variables have been added to allow a deployer to customize + a magnum systemd unit file to their liking. + - The task dropping the magnum 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/magnum_init.yml b/tasks/magnum_init.yml index 3b61ba9..c57dced 100644 --- a/tasks/magnum_init.yml +++ b/tasks/magnum_init.yml @@ -21,6 +21,7 @@ system_group: "{{ magnum_system_group_name }}" service_home: "{{ magnum_system_user_home }}" log_directory: "{{ magnum_log_directory }}" + init_config_overrides: "{{ magnum_api_init_config_overrides }}" - include: magnum_init_common.yml vars: @@ -30,3 +31,4 @@ system_group: "{{ magnum_system_group_name }}" service_home: "{{ magnum_system_user_home }}" log_directory: "{{ magnum_log_directory }}" + init_config_overrides: "{{ magnum_conductor_init_config_overrides }}" diff --git a/tasks/magnum_init_systemd.yml b/tasks/magnum_init_systemd.yml index 434d111..3fc9dd7 100644 --- a/tasks/magnum_init_systemd.yml +++ b/tasks/magnum_init_systemd.yml @@ -38,12 +38,14 @@ group: "root" - name: Place the systemd init script - template: + config_template: src: "magnum-systemd-init.j2" dest: "/etc/systemd/system/{{ program_name }}.service" mode: "0644" owner: "root" group: "root" + config_overrides: "{{ init_config_overrides }}" + config_type: "ini" register: systemd_init - name: Reload the systemd daemon diff --git a/templates/magnum-systemd-init.j2 b/templates/magnum-systemd-init.j2 index 222cec7..fadb8e3 100644 --- a/templates/magnum-systemd-init.j2 +++ b/templates/magnum-systemd-init.j2 @@ -22,5 +22,14 @@ TimeoutSec=300 Restart=on-failure RestartSec=150 +# This creates a specific slice which all will operate from +# The accounting options give us the ability to see resource usage through +# the `systemd-cgtop` command. +Slice=magnum.slice +CPUAccounting=true +BlockIOAccounting=true +MemoryAccounting=false +TasksAccounting=true + [Install] WantedBy=multi-user.target