Merge "Add support for NFS"

This commit is contained in:
Zuul 2018-10-22 15:51:56 +00:00 committed by Gerrit Code Review
commit a781cb40b1
5 changed files with 68 additions and 0 deletions

View File

@ -407,6 +407,20 @@ nova_discover_hosts_in_cells_interval: "{{ 300 if groups['nova_compute'] | lengt
# Otherwise keys will be generated on the first run and not regenerated each run.
nova_recreate_keys: False
# Define nfs information to enable nfs shares as mounted directories for
# nova. The ``nova_nfs_client`` value is a list of dictionaries that must
# be filled out completely to enable the persistent NFS mounts.
#
# Example of the expected dict structure:
# nova_nfs_client:
# - server: "127.0.0.1" ## Hostname or IP address of NFS Server
# remote_path: "/instances" ## Remote path from the NFS server's export
# local_path: "/var/lib/nova/instances" ## Local path on machine
# type: "nfs" ## This can be nfs or nfs4
# options: "_netdev,auto" ## Mount options
# config_overrides: "{}" ## Override dictionary for unit file
nova_nfs_client: []
# Nova Ceph rbd
# Enble and define nova_libvirt_images_rbd_pool to use rbd as nova backend
#nova_libvirt_images_rbd_pool: vms

View File

@ -0,0 +1,5 @@
---
features:
- It is now possible to use NFS mountpoints with the role by using the
nova_nfs_client variable, which is useful for using NFS for instance
data and saves.

View File

@ -24,3 +24,31 @@
- include_tasks: nova_compute_key_distribute.yml
tags:
- nova-config
- name: Run the systemd mount role
include_role:
name: systemd_mount
private: true
vars:
systemd_mounts:
- config_overrides: "{{ mount_var.config_overrides | default({}) }}"
what: "{{ mount_var.server }}:{{ mount_var.remote_path }}"
where: "{{ mount_var.local_path }}"
type: "{{ mount_var.type }}"
options: "{{ mount_var.options }}"
unit:
After:
- network.target rpcbind.service rpc-statd.service
Conflicts:
- umount.target
Requires:
- rpcbind.service rpc-statd.service
Before:
- nova-compute.service
state: 'started'
enabled: true
with_items: "{{ nova_nfs_client }}"
loop_control:
loop_var: mount_var
tags:
- nova-config

View File

@ -52,6 +52,15 @@
- nova-key
- nova-key-create
- name: Create Nova NFS mount point(s)
file:
path: "{{ item.local_path }}"
state: directory
mode: "0755"
with_items: "{{ nova_nfs_client }}"
tags:
- nova-dirs
- name: Create nova dir
file:
path: "{{ item.path }}"
@ -59,6 +68,8 @@
owner: "{{ item.owner|default(nova_system_user_name) }}"
group: "{{ item.group|default(nova_system_group_name) }}"
mode: "{{ item.mode|default('0755') }}"
when:
- "item.path not in nova_mount_points"
with_items:
- { path: "/openstack", owner: "root", group: "root" }
- { path: "/etc/nova", mode: "0750" }

View File

@ -28,3 +28,13 @@ filtered_nova_services: |-
{% endif %}
{% endfor %}
{{ services | sort(attribute='start_order') }}
# Define all Nova mountpoints when using NFS. If defined
# the corresponding directory will only be created by the
# mount point task.
nova_mount_points: |-
{% set mps = [] %}
{% for mp in nova_nfs_client %}
{% set _ = mps.append(mp.local_path) %}
{% endfor %}
{{ mps }}