From ae6f54976649a58d33401a41011dcf036af78434 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 30 Nov 2021 13:46:01 +0200 Subject: [PATCH] Refactor definition of lock path Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/819300 Depends-On: https://review.opendev.org/c/openstack/ansible-role-systemd_service/+/819298 Change-Id: I0fb662cc3fe241bf3934306b7ee8a3c8fdbcf747 --- defaults/main.yml | 5 ++--- tasks/main.yml | 4 ++-- tasks/zun_pre_install.yml | 4 +--- templates/zun-docker-cleanup.j2 | 2 +- templates/zun.conf.j2 | 6 +++--- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index d88bc96..772ec7c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -68,9 +68,10 @@ zun_system_group_name: zun zun_system_shell: /bin/false zun_system_comment: zun system user zun_system_home_folder: "/var/lib/{{ zun_system_user_name }}" +zun_system_slice_name: zun zun_log_dir: "/var/log/zun" -zun_lock_path: "/var/lock/zun" +zun_lock_dir: "{{ openstack_lock_dir | default('/run/lock') }}" ## Kuryr user information zun_kuryr_system_user_name: kuryr @@ -80,8 +81,6 @@ zun_kuryr_system_comment: kuryr system user zun_kuryr_system_home_folder: "/var/lib/{{ zun_kuryr_system_user_name }}" zun_kuryr_log_dir: "/var/log/kuryr" -zun_kuryr_lock_path: "/var/lock/kuryr" - ## Docker setup information zun_docker_package_version: "{{ _zun_docker_package_version }}" zun_containerd_package_version: "{{ _zun_containerd_package_version }}" diff --git a/tasks/main.yml b/tasks/main.yml index 67450c2..c1a5ed9 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -156,8 +156,8 @@ systemd_user_name: "{{ zun_system_user_name }}" systemd_group_name: "{{ zun_system_group_name }}" systemd_tempd_prefix: openstack - systemd_slice_name: zun - systemd_lock_path: "{{ zun_lock_path }}" + systemd_slice_name: "{{ zun_system_slice_name }}" + systemd_lock_dir: "{{ zun_lock_dir }}" systemd_CPUAccounting: true systemd_BlockIOAccounting: true systemd_MemoryAccounting: true diff --git a/tasks/zun_pre_install.yml b/tasks/zun_pre_install.yml index f1e5e7a..29baa9b 100644 --- a/tasks/zun_pre_install.yml +++ b/tasks/zun_pre_install.yml @@ -64,14 +64,12 @@ - { path: "/etc/zun", mode: "0750" } - { path: "/etc/zun/rootwrap.d", owner: "root", group: "root" } - { path: "/etc/sudoers.d", mode: "0750", owner: "root", group: "root" } - - { path: "/var/cache/zun" } - { path: "{{ zun_system_home_folder }}" } - { path: "{{ zun_system_home_folder }}/.ssh", mode: "0700" } - { path: "{{ zun_system_home_folder }}/cache/api" } - { path: "{{ zun_system_home_folder }}/instances" } - { path: "{{ zun_system_home_folder }}/volumes" } - - { path: "{{ zun_lock_path }}" } - - { path: "/var/run/zun" } + - { path: "{{ zun_system_home_folder }}/images" } tags: - zun-dirs diff --git a/templates/zun-docker-cleanup.j2 b/templates/zun-docker-cleanup.j2 index 42cce24..743561b 100644 --- a/templates/zun-docker-cleanup.j2 +++ b/templates/zun-docker-cleanup.j2 @@ -12,4 +12,4 @@ fi docker image prune -f # Clear old images from Zun cache directory -find /var/cache/zun -amin +1440 -type f -exec rm -fv {} \; +find {{ zun_system_home_folder }}/images -amin +1440 -type f -exec rm -fv {} \; diff --git a/templates/zun.conf.j2 b/templates/zun.conf.j2 index b4be27b..be5f498 100644 --- a/templates/zun.conf.j2 +++ b/templates/zun.conf.j2 @@ -36,7 +36,7 @@ docker_remote_api_version = {{ zun_docker_api_version }} {% endif %} [glance] -images_directory = /var/cache/zun/images +images_directory = {{ zun_system_home_folder }}/images [glance_client] @@ -80,7 +80,7 @@ insecure = {{ keystone_service_adminuri_insecure | bool }} [oslo_concurrency] -lock_path = /var/lib/zun/tmp +lock_path = {{ zun_lock_dir }}/{{ zun_system_slice_name }} [oslo_messaging_notifications] @@ -116,7 +116,7 @@ enabled_filters = {{ zun_scheduler_default_filters }} [volume] use_multipath = true driver_list = cinder,local -volume_dir = /var/lib/{{ zun_system_user_name }}/volumes +volume_dir = {{ zun_system_home_folder }}/volumes [compute]