From 22c5561df310389f66181fc02a3cbaa8b92e49ed Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 28 Jan 2020 20:57:08 +1100 Subject: [PATCH] openafs-client: add option for OpenAFS cache location Our control plane servers generally have large ephemeral storage attached at /opt; for many uses this is enough space that we don't need to add extra cinder volumes for a reasonable cache (as we usually do on mirror nodes; but there we create large caches for both openafs and httpd reverse proxy whose needs exceed even what we get from ephemeral storage). Add an option to set the cache location, and use /opt for our new static01.opendev.org server. Change-Id: I16eed1734a0a7e855e27105931a131ce4dbd0793 --- playbooks/service-static.yaml | 1 + roles/openafs-client/README.rst | 9 +++++++-- roles/openafs-client/defaults/main.yaml | 1 + roles/openafs-client/tasks/main.yaml | 9 +++++++++ roles/openafs-client/templates/cacheinfo.j2 | 2 +- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/playbooks/service-static.yaml b/playbooks/service-static.yaml index a1274ca7b6..5a739cdfa7 100644 --- a/playbooks/service-static.yaml +++ b/playbooks/service-static.yaml @@ -9,4 +9,5 @@ - kdc04.openstack.org - role: openafs-client openafs_client_cache_size: "{{ afs_client_cache_size | default(50000000) }}" # 50GiB + openafs_client_cache_directory: '/opt/cache/openafs' - role: static diff --git a/roles/openafs-client/README.rst b/roles/openafs-client/README.rst index e985cf6851..de2c9a63b9 100644 --- a/roles/openafs-client/README.rst +++ b/roles/openafs-client/README.rst @@ -20,12 +20,17 @@ role has limited platform support. Currently supported are .. zuul:rolevar:: openafs_client_cell :default: openstack.org - The default cell + The default cell. .. zuul:rolevar:: openafs_client_cache_size :default: 500000 - The AFS client cache size, in kilobytes + The OpenAFS client cache size, in kilobytes. + +.. zuul:rolevar:: openafs_client_cache_directory + :default: /var/cache/openafs + + The directory to store the OpenAFS cache files. .. zuul:rolevar:: openafs_client_yum_repo_url :default: ``https://tarballs.openstack.org/project-config/package-afs-centos7`` diff --git a/roles/openafs-client/defaults/main.yaml b/roles/openafs-client/defaults/main.yaml index f94eb9e4ae..248bfcf8f5 100644 --- a/roles/openafs-client/defaults/main.yaml +++ b/roles/openafs-client/defaults/main.yaml @@ -1,2 +1,3 @@ openafs_client_cell: 'openstack.org' +openafs_client_cache_directory: '/var/cache/openafs' openafs_client_cache_size: 500000 \ No newline at end of file diff --git a/roles/openafs-client/tasks/main.yaml b/roles/openafs-client/tasks/main.yaml index d7e050325c..04bc4ab819 100644 --- a/roles/openafs-client/tasks/main.yaml +++ b/roles/openafs-client/tasks/main.yaml @@ -45,6 +45,15 @@ - ThisCell become: yes +- name: Ensure cache location directory + file: + path: '{{ openafs_client_cache_directory }}' + state: directory + owner: root + group: root + mode: 0700 + become: yes + - name: Setup OS specific openafs-client environment include_tasks: "{{ lookup('first_found', params) }}" vars: diff --git a/roles/openafs-client/templates/cacheinfo.j2 b/roles/openafs-client/templates/cacheinfo.j2 index fdba008445..ee0152a3ff 100644 --- a/roles/openafs-client/templates/cacheinfo.j2 +++ b/roles/openafs-client/templates/cacheinfo.j2 @@ -1 +1 @@ -/afs:/var/cache/openafs:{{ openafs_client_cache_size }} +/afs:{{ openafs_client_cache_directory }}:{{ openafs_client_cache_size }}