From 57e8a0eaaa2159f33e64a1b037180383196919d1 Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Thu, 9 Mar 2017 09:37:35 -0800 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: Id82169f2f500045e0ff7dc348748400a4b116fe0 Signed-off-by: Kevin Carter --- defaults/main.yml | 3 +++ .../ironic-init-config-overrides-ffce7e419061c4da.yaml | 10 ++++++++++ tasks/ironic_init.yml | 1 + tasks/ironic_init_systemd.yml | 4 +++- tasks/ironic_oneview_setup.yml | 1 + templates/ironic-systemd-init.j2 | 9 +++++++++ 6 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/ironic-init-config-overrides-ffce7e419061c4da.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 6eb46d8e..1fbbd2eb 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -249,3 +249,6 @@ ironic_policy_overrides: {} # pxe boot ironic_pxe_append_params: "ipa-debug=1 systemd.journald.forward_to_console=yes" + +ironic_conductor_init_config_overrides: {} +ironic_oneviewd_init_config_overrides: {} diff --git a/releasenotes/notes/ironic-init-config-overrides-ffce7e419061c4da.yaml b/releasenotes/notes/ironic-init-config-overrides-ffce7e419061c4da.yaml new file mode 100644 index 00000000..15893d73 --- /dev/null +++ b/releasenotes/notes/ironic-init-config-overrides-ffce7e419061c4da.yaml @@ -0,0 +1,10 @@ +--- +features: + - New variables have been added to allow a deployer to customize + a ironic systemd unit file to their liking. + - The task dropping the ironic 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/ironic_init.yml b/tasks/ironic_init.yml index af1e8b40..20e577bb 100644 --- a/tasks/ironic_init.yml +++ b/tasks/ironic_init.yml @@ -20,4 +20,5 @@ system_user: "{{ ironic_system_user_name }}" system_group: "{{ ironic_system_group_name }}" service_home: "{{ ironic_system_home_folder }}" + init_config_overrides: "{{ ironic_conductor_init_config_overrides }}" when: inventory_hostname in groups['ironic_conductor'] diff --git a/tasks/ironic_init_systemd.yml b/tasks/ironic_init_systemd.yml index f02137d1..47662137 100644 --- a/tasks/ironic_init_systemd.yml +++ b/tasks/ironic_init_systemd.yml @@ -46,12 +46,14 @@ group: "root" - name: Place the systemd init script - template: + config_template: src: "ironic-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/tasks/ironic_oneview_setup.yml b/tasks/ironic_oneview_setup.yml index c174ead9..cc0a7f4a 100644 --- a/tasks/ironic_oneview_setup.yml +++ b/tasks/ironic_oneview_setup.yml @@ -45,6 +45,7 @@ system_user: "{{ ironic_system_user_name }}" system_group: "{{ ironic_system_group_name }}" service_home: "{{ ironic_system_home_folder }}" + init_config_overrides: "{{ ironic_oneviewd_init_config_overrides }}" - name: Generate ironic-oneviewd config config_template: diff --git a/templates/ironic-systemd-init.j2 b/templates/ironic-systemd-init.j2 index f1c2618b..f747db43 100644 --- a/templates/ironic-systemd-init.j2 +++ b/templates/ironic-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=ironic.slice +CPUAccounting=true +BlockIOAccounting=true +MemoryAccounting=false +TasksAccounting=true + [Install] WantedBy=multi-user.target