From 6b6ae966ba7880787d0584d7e8304e5d6c9c0093 Mon Sep 17 00:00:00 2001 From: Rajesh Tailor Date: Tue, 24 Apr 2018 18:24:27 +0530 Subject: [PATCH] Allow configuration of NFS backend for Nova Allow NFS configuration of storage backend for Nova. This way the instances files will be stored on a shared NFS storage. Implements: bp tripleo-nova-nfs Depends-On: Id15aec6324814a871e87f19f24999b0e3b8a8f05 Change-Id: Ie4fe217bd119b638f42c682d21572547f02f17b2 --- docker/services/nova-compute.yaml | 1 + environments/storage-environment.yaml | 10 +++++++ environments/storage/nova-nfs.yaml | 30 +++++++++++++++++++ puppet/services/nova-compute.yaml | 21 +++++++++++++ .../tripleo-nova-nfs-ead2827338aa9519.yaml | 5 ++++ sample-env-generator/storage.yaml | 16 ++++++++++ 6 files changed, 83 insertions(+) create mode 100644 environments/storage/nova-nfs.yaml create mode 100644 releasenotes/notes/tripleo-nova-nfs-ead2827338aa9519.yaml diff --git a/docker/services/nova-compute.yaml b/docker/services/nova-compute.yaml index 009164050a..26f8f7f8f2 100644 --- a/docker/services/nova-compute.yaml +++ b/docker/services/nova-compute.yaml @@ -204,6 +204,7 @@ outputs: host_prep_tasks: list_concat: - {get_attr: [NovaLogging, host_prep_tasks]} + - {get_attr: [NovaComputeBase, role_data, host_prep_tasks]} - - name: create persistent directories file: path: "{{ item }}" diff --git a/environments/storage-environment.yaml b/environments/storage-environment.yaml index 264bf48def..da64c0dc95 100644 --- a/environments/storage-environment.yaml +++ b/environments/storage-environment.yaml @@ -54,6 +54,16 @@ parameter_defaults: # GlanceNfsOptions: 'intr,context=system_u:object_r:glance_var_lib_t:s0' + #### NOVA NFS SETTINGS #### + # NovaNfsEnabled: false + ## NFS share for nova instance file storage, e.g. '192.168.122.1:/export/nova' + ## (If using IPv6, use both double and single-quotes, + ## e.g. "'[fdd0::1]:/export/nova'") + # NovaNfsShare: '' + ## Mount options for the NFS instance file storage mount point + # NovaNfsOptions: 'context=system_u:object_r:nova_var_lib_t:s0' + + #### CEPH SETTINGS #### ## When deploying Ceph Nodes through the oscplugin CLI, the following diff --git a/environments/storage/nova-nfs.yaml b/environments/storage/nova-nfs.yaml new file mode 100644 index 0000000000..b31ddd3f7f --- /dev/null +++ b/environments/storage/nova-nfs.yaml @@ -0,0 +1,30 @@ +# ******************************************************************* +# This file was created automatically by the sample environment +# generator. Developers should use `tox -e genconfig` to update it. +# Users are recommended to make changes to a copy of the file instead +# of the original, if any customizations are needed. +# ******************************************************************* +# title: Enable Nova NFS Backend +# description: | +# Configure and include this environment to enable the use of an NFS +# share as the backend for Nova. +parameter_defaults: + # NFS mount options for nova storage (when NovaNfsEnabled is true) + # Type: string + NovaNfsOptions: context=system_u:object_r:nova_var_lib_t:s0 + + # NFS share to mount for nova storage (when NovaNfsEnabled is true) + # Type: string + NovaNfsShare: '' + + # ****************************************************** + # Static parameters - these are values that must be + # included in the environment but should not be changed. + # ****************************************************** + # Whether to enable or not the NFS backend for Nova + # Type: boolean + NovaNfsEnabled: True + + # ********************* + # End static parameters + # ********************* diff --git a/puppet/services/nova-compute.yaml b/puppet/services/nova-compute.yaml index 52c688c3e4..2b2e67468f 100644 --- a/puppet/services/nova-compute.yaml +++ b/puppet/services/nova-compute.yaml @@ -56,6 +56,18 @@ parameters: default: false description: Whether to enable or not the NFS backend for Cinder type: boolean + NovaNfsEnabled: + default: false + description: Whether to enable or not the NFS backend for Nova + type: boolean + NovaNfsShare: + default: '' + description: NFS share to mount for nova storage (when NovaNfsEnabled is true) + type: string + NovaNfsOptions: + default: 'context=system_u:object_r:nova_var_lib_t:s0' + description: NFS mount options for nova storage (when NovaNfsEnabled is true) + type: string CinderEnableRbdBackend: default: false description: Whether to enable or not the Rbd backend for Cinder @@ -201,6 +213,7 @@ outputs: - - 'client' - {get_param: CephClientUserName} tripleo::profile::base::nova::compute::cinder_nfs_backend: {get_param: CinderEnableNfsBackend} + tripleo::profile::base::nova::compute::nova_nfs_enabled: {get_param: NovaNfsEnabled} rbd_persistent_storage: {get_param: CinderEnableRbdBackend} nova::compute::rbd::libvirt_rbd_secret_key: {get_param: CephClientKey} nova::compute::rbd::libvirt_rbd_secret_uuid: {get_param: CephClusterFSID} @@ -249,6 +262,14 @@ outputs: tripleo.collectd.plugins.nova_compute: - virt collectd::plugin::virt::connection: 'qemu:///system' + host_prep_tasks: + - name: Mount Nova NFS Share + vars: + nfs_backend_enable: {get_param: NovaNfsEnabled} + nfs_share: {get_param: NovaNfsShare} + nfs_options: {get_param: NovaNfsOptions} + mount: name=/var/lib/nova/instances src="{{nfs_share}}" fstype=nfs4 opts="_netdev,bg,{{nfs_options}},vers=4,nfsvers=4" state=mounted + when: nfs_backend_enable|bool upgrade_tasks: - name: Stop nova-compute service when: step|int == 1 diff --git a/releasenotes/notes/tripleo-nova-nfs-ead2827338aa9519.yaml b/releasenotes/notes/tripleo-nova-nfs-ead2827338aa9519.yaml new file mode 100644 index 0000000000..f84e988204 --- /dev/null +++ b/releasenotes/notes/tripleo-nova-nfs-ead2827338aa9519.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Allow NFS configuration of storage backend for Nova. This way + the instance files will be stored on a shared NFS storage. diff --git a/sample-env-generator/storage.yaml b/sample-env-generator/storage.yaml index ec0d070e37..81bdcd155f 100644 --- a/sample-env-generator/storage.yaml +++ b/sample-env-generator/storage.yaml @@ -71,6 +71,22 @@ environments: description: | Configure and include this environment to enable the use of an NFS share as the backend for Glance. + - + name: storage/nova-nfs + title: Enable Nova NFS Backend + files: + puppet/services/nova-compute.yaml: + parameters: + - NovaNfsEnabled + - NovaNfsShare + - NovaNfsOptions + sample_values: + NovaNfsEnabled: True + static: + - NovaNfsEnabled + description: | + Configure and include this environment to enable the use of an NFS + share as the backend for Nova. - name: storage/external-ceph title: Deploy Using an External Ceph Cluster