Use systemd_mount native syntax for mounts

Currently we have bunch of limitations related to the format
of ``glance_nfs_client``. While systemd_mount role is flexible enough
to allow mount cephfs or s3fs, variable format has weird assumptions
that we want to change for better flexability.

Since keys of variable are changing, new name for it was picked to
reflect purpose of the variable better.

Change-Id: Ic0d91a3a873b4253255beac79becf01b4a304695
This commit is contained in:
Dmitriy Rabotyagov 2022-04-12 12:56:38 +02:00
parent a23f92c9c7
commit 887a59256e
7 changed files with 32 additions and 21 deletions

View File

@ -207,17 +207,16 @@ glance_policy_dirs: policy.d
# Define nfs information to enable nfs shares as mounted directories for
# glance. The ``glance_nfs_client`` value is a list of dictionaries that must
# be filled out completely to enable the persistent NFS mounts.
glance_nfs_local_directory: "images"
glance_nfs_client: []
# glance. The ``glance_remote_client`` value is a list of dictionaries that must
# be filled out completely to enable the persistent remote FS mounts (like NFS).
glance_images_local_directory: "{{ glance_nfs_local_directory | default('images') }}"
glance_remote_client: "{{ glance_nfs_client | default([]) }}"
# Example of the expected dict structure:
#
# glance_nfs_client:
# - server: "127.0.0.1" ## Hostname or IP address of NFS Server
# remote_path: "/images" ## Remote path from the NFS server's export
# local_path: "/var/lib/glance/images" ## Local path on machine
# glance_remote_client:
# - what: "127.0.0.1:/images" ## Hostname or IP address of Server and path on it
# where: "/var/lib/glance/images" ## Local path on machine
# type: "nfs" ## This can be nfs or nfs4
# options: "_netdev,auto" ## Mount options
# config_overrides: "{}" ## Override dictionary for unit file

View File

@ -0,0 +1,13 @@
---
features:
deprecations:
- |
Variable ``glance_nfs_local_directory`` has been renamed to
``glance_images_local_directory`` to better reflect purpose of
the variable. ``glance_nfs_local_directory`` remains for backwards
compatability but will be removed in Zed release.
- |
Variable ``glance_nfs_client`` has been replaced with
``glance_remote_client``. New variable has new keys for defining mounts
to cover wider range of supported filesystems.
Compatability for ``glance_nfs_client`` has been kept until Zed release.

View File

@ -101,7 +101,7 @@
- path: "{{ glance_system_user_home }}/cache/api"
mode: "0700"
- path: "{{ glance_system_user_home }}/scrubber"
- path: "{{ glance_system_user_home }}/{{ glance_nfs_local_directory }}"
- path: "{{ glance_system_user_home }}/{{ glance_images_local_directory }}"
mode: "0755"
- name: Install distro packages

View File

@ -170,8 +170,8 @@
vars:
systemd_mounts:
- config_overrides: "{{ mount_var.config_overrides | default({}) }}"
what: "{{ mount_var.server }}:{{ mount_var.remote_path }}"
where: "{{ mount_var.local_path }}"
what: "{{ mount_var.what | default(mount_var.server ~ ':' ~ mount_var.remote_path) }}"
where: "{{ mount_var.where | default(mount_var.local_path) }}"
type: "{{ mount_var.type }}"
options: "{{ mount_var.options }}"
unit:
@ -183,9 +183,9 @@
- rpcbind.service rpc-statd.service
Before:
- glance-api.service
state: 'started'
enabled: true
with_items: "{{ glance_nfs_client }}"
state: "{{ mount_var.state | default('started') }}"
enabled: "{{ mount_var.enabled | default(True) }}"
with_items: "{{ glance_remote_client }}"
loop_control:
loop_var: mount_var
tags:

View File

@ -79,7 +79,7 @@ default_backend = {{ glance_default_store }}
{% if 'file' in _glance_available_stores %}
[file]
filesystem_store_datadir = {{ glance_system_user_home }}/{{ glance_nfs_local_directory }}/
filesystem_store_datadir = {{ glance_system_user_home }}/{{ glance_images_local_directory }}/
{% endif %}
{% if 'swift' in _glance_available_stores %}

View File

@ -15,9 +15,8 @@
# Force glance to use file by default which will be an NFS mount point.
glance_default_store: file
glance_nfs_client:
- server: "10.1.0.1"
remote_path: "/srv/nfs/glance"
local_path: "/var/lib/glance/images"
glance_remote_client:
- what: "10.1.0.1:/srv/nfs/glance"
where: "/var/lib/glance/images"
type: "nfs"
options: "_netdev,auto"

View File

@ -60,8 +60,8 @@ uwsgi_glance_services: |-
# mount point task.
glance_mount_points: |-
{% set mps = [] %}
{% for mp in glance_nfs_client %}
{% set _ = mps.append(mp.local_path) %}
{% for mp in glance_remote_client %}
{% set _ = mps.append(mp.where | default(mount_var.local_path)) %}
{% endfor %}
{{ mps }}