From 55724c6e932a8835cd9e4e6365759115947071ca Mon Sep 17 00:00:00 2001 From: Ali Maredia Date: Mon, 21 Aug 2017 08:38:21 -0400 Subject: [PATCH 1/4] nfs-ganesha: add dev, stable, and rhcs nfs-ganesha's for ceph-nfs role Signed-off-by: Ali Maredia --- group_vars/all.yml.sample | 18 ++++++++- group_vars/nfss.yml.sample | 28 ++++---------- group_vars/rhcs.yml.sample | 18 ++++++++- .../installs/debian_community_repository.yml | 11 ++---- .../tasks/installs/debian_dev_repository.yml | 21 ++++++++++ .../install_debian_enterprise_packages.yml | 18 ++++++++- .../installs/install_debian_packages.yml | 19 +++++++--- .../installs/install_redhat_packages.yml | 12 ++---- .../installs/redhat_community_repository.yml | 13 +++++++ .../tasks/installs/redhat_dev_repository.yml | 21 ++++++++++ roles/ceph-defaults/defaults/main.yml | 18 ++++++++- roles/ceph-nfs/defaults/main.yml | 27 ++++--------- roles/ceph-nfs/tasks/pre_requisite.yml | 38 +++++++++++-------- 13 files changed, 179 insertions(+), 83 deletions(-) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 17bcda687..22529125d 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -138,6 +138,11 @@ dummy: #ceph_stable_release: dummy #ceph_stable_repo: "{{ ceph_mirror }}/debian-{{ ceph_stable_release }}" +#nfs_ganesha_stable: true # use stable repos for nfs-ganesha +#nfs_ganesha_stable_branch: V2.5-stable +#nfs_ganesha_stable_deb_repo: "{{ ceph_mirror }}/nfs-ganesha/deb-{{ nfs_ganesha_stable_branch }}/{{ ceph_stable_release }}" + + # Use the option below to specify your applicable package tree, eg. when using non-LTS Ubuntu versions # # for a list of available Debian distributions, visit http://download.ceph.com/debian-{{ ceph_stable_release }}/dists/ # for more info read: https://github.com/ceph/ceph-ansible/issues/305 @@ -194,6 +199,11 @@ dummy: #ceph_dev_branch: master # development branch you would like to use e.g: master, wip-hack #ceph_dev_sha1: latest # distinct sha1 to use, defaults to 'latest' (as in latest built) +#nfs_ganesha_dev: false # use development repos for nfs-ganesha + +# Set this to choose the version of ceph dev libraries used in the nfs-ganesha packages from shaman +# flavors so far include: ceph_master, ceph_jewel, ceph_kraken, ceph_luminous +#nfs_ganesha_flavor: "ceph_master" # REPOSITORY: CUSTOM @@ -383,13 +393,17 @@ dummy: #handler_health_rgw_check_retries: 5 #handler_health_rgw_check_delay: 10 +############### +# NFS-GANESHA # +############### + # Confiure the type of NFS gatway access. At least one must be enabled for an # NFS role to be useful # # Set this to true to enable File access via NFS. Requires an MDS role. -#nfs_file_gw: true +#nfs_file_gw: false # Set this to true to enable Object access via NFS. Requires an RGW role. -#nfs_obj_gw: false +#nfs_obj_gw: true ################### # CONFIG OVERRIDE # diff --git a/group_vars/nfss.yml.sample b/group_vars/nfss.yml.sample index 011f0cc25..6f98a0c54 100644 --- a/group_vars/nfss.yml.sample +++ b/group_vars/nfss.yml.sample @@ -15,14 +15,20 @@ dummy: #fetch_directory: fetch/ +# Even though NFS nodes should not have the admin key +# at their disposal, some people might want to have it +# distributed on RGW nodes. Setting 'copy_admin_key' to 'true' +# will copy the admin key to the /etc/ceph/ directory +#copy_admin_key: false + ####################### # Access type options # ####################### # These are currently in ceph-common defaults because nfs_obj_gw shared with ceph-rgw # Enable NFS File access -#nfs_file_gw: true +#nfs_file_gw: false # Enable NFS Object access -#nfs_obj_gw: false +#nfs_obj_gw: true ###################### # NFS Ganesha Config # @@ -54,24 +60,6 @@ dummy: #ceph_nfs_rgw_access_key: "QFAMEDSJP5DEKJO0DDXY" #ceph_nfs_rgw_secret_key: "iaSFLDVvDdQt6lkNzHyW4fPLZugBAI1g17LO0+87[MAC[M#C" - -################### -# CONFIG OVERRIDE # -################### - -# Ganesha configuration file override. -# This allows you to specify more configuration options -# using an INI style format. -# The following sections are supported: [global], [mon], [osd], [mds], [rgw] -# -# Example: -# ceph_conf_overrides: -# global: -# foo: 1234 -# bar: 5678 -# -#ganesha_conf_overrides: {} - ########## # DOCKER # ########## diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index 24093b9c0..ee92c71df 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -138,6 +138,11 @@ ceph_repository: rhcs #ceph_stable_release: dummy #ceph_stable_repo: "{{ ceph_mirror }}/debian-{{ ceph_stable_release }}" +#nfs_ganesha_stable: true # use stable repos for nfs-ganesha +#nfs_ganesha_stable_branch: V2.5-stable +#nfs_ganesha_stable_deb_repo: "{{ ceph_mirror }}/nfs-ganesha/deb-{{ nfs_ganesha_stable_branch }}/{{ ceph_stable_release }}" + + # Use the option below to specify your applicable package tree, eg. when using non-LTS Ubuntu versions # # for a list of available Debian distributions, visit http://download.ceph.com/debian-{{ ceph_stable_release }}/dists/ # for more info read: https://github.com/ceph/ceph-ansible/issues/305 @@ -194,6 +199,11 @@ ceph_repository: rhcs #ceph_dev_branch: master # development branch you would like to use e.g: master, wip-hack #ceph_dev_sha1: latest # distinct sha1 to use, defaults to 'latest' (as in latest built) +#nfs_ganesha_dev: false # use development repos for nfs-ganesha + +# Set this to choose the version of ceph dev libraries used in the nfs-ganesha packages from shaman +# flavors so far include: ceph_master, ceph_jewel, ceph_kraken, ceph_luminous +#nfs_ganesha_flavor: "ceph_master" # REPOSITORY: CUSTOM @@ -383,13 +393,17 @@ ceph_repository: rhcs #handler_health_rgw_check_retries: 5 #handler_health_rgw_check_delay: 10 +############### +# NFS-GANESHA # +############### + # Confiure the type of NFS gatway access. At least one must be enabled for an # NFS role to be useful # # Set this to true to enable File access via NFS. Requires an MDS role. -#nfs_file_gw: true +#nfs_file_gw: false # Set this to true to enable Object access via NFS. Requires an RGW role. -#nfs_obj_gw: false +#nfs_obj_gw: true ################### # CONFIG OVERRIDE # diff --git a/roles/ceph-common/tasks/installs/debian_community_repository.yml b/roles/ceph-common/tasks/installs/debian_community_repository.yml index 3996416a4..10e60dc6d 100644 --- a/roles/ceph-common/tasks/installs/debian_community_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_community_repository.yml @@ -10,14 +10,11 @@ state: present changed_when: false -- name: configure debian gluster nfs ganesha community repository for rgw nfs +- name: add nfs-ganesha stable repository apt_repository: - repo: "{{ item }}" + repo: "deb {{ nfs_ganesha_stable_deb_repo }} {{ ceph_stable_distro_source | default(ansible_lsb.codename) }} main" state: present - with_items: - - ppa:gluster/libntirpc - - ppa:gluster/nfs-ganesha changed_when: false when: - - (nfs_obj_gw or nfs_file_gw) - - not ansible_distribution == "Debian" + - nfs_group_name in group_names + - nfs_ganesha_stable diff --git a/roles/ceph-common/tasks/installs/debian_dev_repository.yml b/roles/ceph-common/tasks/installs/debian_dev_repository.yml index e37e2ffe3..b19501e3a 100644 --- a/roles/ceph-common/tasks/installs/debian_dev_repository.yml +++ b/roles/ceph-common/tasks/installs/debian_dev_repository.yml @@ -10,3 +10,24 @@ repo: "{{ ceph_dev_deb_repo.content }}" state: present changed_when: false + +- name: fetch nfs-ganesha development repository + uri: + url: https://shaman.ceph.com/api/repos/nfs-ganesha/next/latest/{{ ansible_distribution | lower }}/{{ ansible_distribution_release }}/flavors/{{ nfs_ganesha_flavor }}/repo + return_content: yes + register: nfs_ganesha_apt_repo + when: + - nfs_group_name in group_names + - nfs_ganesha_dev + +- name: add nfs-ganesha development repository + copy: + content: "{{ nfs_ganesha_dev_apt_repo.content }}" + dest: /etc/apt/sources.list.d/nfs-ganesha-dev.list + owner: root + group: root + backup: yes + when: + - nfs_group_name in group_names + - nfs_ganesha_dev + diff --git a/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml b/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml index 1aa67ea2b..5dd37863c 100644 --- a/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml +++ b/roles/ceph-common/tasks/installs/install_debian_enterprise_packages.yml @@ -43,10 +43,26 @@ - name: install red hat storage nfs gateway for debian apt: - name: nfs-ganesha-fsal + name: nfs-ganesha state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" when: nfs_group_name in group_names +- name: install red hat storage nfs file gateway + apt: + name: nfs-ganesha-ceph + state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" + when: + - nfs_group_name in group_names + - nfs_file_gw + +- name: install red hat storage nfs obj gateway + apt: + name: nfs-ganesha-rgw + state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" + when: + - nfs_group_name in group_names + - nfs_obj_gw + - name: install ceph mgr for debian apt: pkg: ceph-mgr diff --git a/roles/ceph-common/tasks/installs/install_debian_packages.yml b/roles/ceph-common/tasks/installs/install_debian_packages.yml index 9797aaf70..076e839b4 100644 --- a/roles/ceph-common/tasks/installs/install_debian_packages.yml +++ b/roles/ceph-common/tasks/installs/install_debian_packages.yml @@ -44,13 +44,22 @@ when: - nfs_group_name in group_names -- name: install nfs gateway for debian - apt: - name: nfs-ganesha-fsal - state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}" - update_cache: yes +- name: install nfs cephfs gateway + package: + name: nfs-ganesha-ceph when: - nfs_group_name in group_names + - nfs_file_gw + +- name: install nfs rgw gateway + package: + name: "{{ item }}" + with_items: + - nfs-ganesha-rgw + - radosgw + when: + - nfs_group_name in group_names + - nfs_obj_gw - name: install ceph mgr for debian apt: diff --git a/roles/ceph-common/tasks/installs/install_redhat_packages.yml b/roles/ceph-common/tasks/installs/install_redhat_packages.yml index 51e07c3f1..0688b3db4 100644 --- a/roles/ceph-common/tasks/installs/install_redhat_packages.yml +++ b/roles/ceph-common/tasks/installs/install_redhat_packages.yml @@ -73,28 +73,22 @@ - nfs_group_name in group_names - nfs_file_gw -- name: install redhat nfs-ganesha-rgw and ceph-radosgw packages +- name: install nfs cephfs gateway package: - name: "{{ item }}" - with_items: - - nfs-ganesha-fsal - - ceph-radosgw + name: nfs-ganesha-ceph when: - nfs_group_name in group_names - - nfs_obj_gw - - ceph_rhcs_version == "2" + - nfs_file_gw - name: install redhat nfs-ganesha-rgw and ceph-radosgw packages package: name: "{{ item }}" with_items: - nfs-ganesha-rgw - - nfs-ganesha-ceph - ceph-radosgw when: - nfs_group_name in group_names - nfs_obj_gw - - ceph_rhcs_version == "3" - name: install redhat ceph-mgr package package: diff --git a/roles/ceph-common/tasks/installs/redhat_community_repository.yml b/roles/ceph-common/tasks/installs/redhat_community_repository.yml index 013f8aa7f..2928dc0d0 100644 --- a/roles/ceph-common/tasks/installs/redhat_community_repository.yml +++ b/roles/ceph-common/tasks/installs/redhat_community_repository.yml @@ -12,3 +12,16 @@ state: present gpgkey: "{{ ceph_stable_key }}" baseurl: "{{ ceph_mirror }}/rpm-{{ ceph_stable_release }}/{{ ceph_stable_redhat_distro }}/$basearch" + +- name: add nfs-ganesha stable repository + yum_repository: + name: nfs_ganesha_stable + description: nfs-ganesha stable repo + gpgcheck: yes + state: present + gpgkey: "{{ ceph_stable_key }}" + baseurl: "{{ ceph_mirror }}/nfs-ganesha/rpm-{{ nfs_ganesha_stable_branch }}/{{ ceph_stable_release }}/$basearch" + when: + - nfs_group_name in group_names + - nfs_ganesha_stable + diff --git a/roles/ceph-common/tasks/installs/redhat_dev_repository.yml b/roles/ceph-common/tasks/installs/redhat_dev_repository.yml index 6bc4b065b..989a604ac 100644 --- a/roles/ceph-common/tasks/installs/redhat_dev_repository.yml +++ b/roles/ceph-common/tasks/installs/redhat_dev_repository.yml @@ -12,3 +12,24 @@ owner: root group: root backup: yes + +- name: fetch nfs-ganesha red hat development repository + uri: + url: https://shaman.ceph.com/api/repos/nfs-ganesha/next/latest/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/flavors/{{ nfs_ganesha_flavor }}/repo + return_content: yes + register: nfs_ganesha_dev_yum_repo + when: + - nfs_group_name in group_names + - nfs_ganesha_dev + +- name: add nfs-ganesha development repository + copy: + content: "{{ nfs_ganesha_dev_yum_repo.content }}" + dest: /etc/yum.repos.d/nfs-ganesha-dev.repo + owner: root + group: root + backup: yes + when: + - nfs_group_name in group_names + - nfs_ganesha_dev + diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index e34263380..6d973677b 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -130,6 +130,11 @@ ceph_stable_key: https://download.ceph.com/keys/release.asc ceph_stable_release: dummy ceph_stable_repo: "{{ ceph_mirror }}/debian-{{ ceph_stable_release }}" +nfs_ganesha_stable: true # use stable repos for nfs-ganesha +nfs_ganesha_stable_branch: V2.5-stable +nfs_ganesha_stable_deb_repo: "{{ ceph_mirror }}/nfs-ganesha/deb-{{ nfs_ganesha_stable_branch }}/{{ ceph_stable_release }}" + + # Use the option below to specify your applicable package tree, eg. when using non-LTS Ubuntu versions # # for a list of available Debian distributions, visit http://download.ceph.com/debian-{{ ceph_stable_release }}/dists/ # for more info read: https://github.com/ceph/ceph-ansible/issues/305 @@ -186,6 +191,11 @@ ceph_rhcs_repository_path: "{{ ceph_stable_rh_storage_repository_path | default( ceph_dev_branch: master # development branch you would like to use e.g: master, wip-hack ceph_dev_sha1: latest # distinct sha1 to use, defaults to 'latest' (as in latest built) +nfs_ganesha_dev: false # use development repos for nfs-ganesha + +# Set this to choose the version of ceph dev libraries used in the nfs-ganesha packages from shaman +# flavors so far include: ceph_master, ceph_jewel, ceph_kraken, ceph_luminous +nfs_ganesha_flavor: "ceph_master" # REPOSITORY: CUSTOM @@ -375,13 +385,17 @@ handler_health_mds_check_delay: 10 handler_health_rgw_check_retries: 5 handler_health_rgw_check_delay: 10 +############### +# NFS-GANESHA # +############### + # Confiure the type of NFS gatway access. At least one must be enabled for an # NFS role to be useful # # Set this to true to enable File access via NFS. Requires an MDS role. -nfs_file_gw: true +nfs_file_gw: false # Set this to true to enable Object access via NFS. Requires an RGW role. -nfs_obj_gw: false +nfs_obj_gw: true ################### # CONFIG OVERRIDE # diff --git a/roles/ceph-nfs/defaults/main.yml b/roles/ceph-nfs/defaults/main.yml index f31463d5d..831deb52a 100644 --- a/roles/ceph-nfs/defaults/main.yml +++ b/roles/ceph-nfs/defaults/main.yml @@ -7,14 +7,20 @@ fetch_directory: fetch/ +# Even though NFS nodes should not have the admin key +# at their disposal, some people might want to have it +# distributed on RGW nodes. Setting 'copy_admin_key' to 'true' +# will copy the admin key to the /etc/ceph/ directory +copy_admin_key: yes + ####################### # Access type options # ####################### # These are currently in ceph-common defaults because nfs_obj_gw shared with ceph-rgw # Enable NFS File access -#nfs_file_gw: true +nfs_file_gw: false # Enable NFS Object access -#nfs_obj_gw: false +nfs_obj_gw: true ###################### # NFS Ganesha Config # @@ -47,23 +53,6 @@ ceph_nfs_rgw_user: "cephnfs" #ceph_nfs_rgw_secret_key: "iaSFLDVvDdQt6lkNzHyW4fPLZugBAI1g17LO0+87[MAC[M#C" -################### -# CONFIG OVERRIDE # -################### - -# Ganesha configuration file override. -# This allows you to specify more configuration options -# using an INI style format. -# The following sections are supported: [global], [mon], [osd], [mds], [rgw] -# -# Example: -# ceph_conf_overrides: -# global: -# foo: 1234 -# bar: 5678 -# -ganesha_conf_overrides: {} - ########## # DOCKER # ########## diff --git a/roles/ceph-nfs/tasks/pre_requisite.yml b/roles/ceph-nfs/tasks/pre_requisite.yml index ad19b4be3..8b8722b48 100644 --- a/roles/ceph-nfs/tasks/pre_requisite.yml +++ b/roles/ceph-nfs/tasks/pre_requisite.yml @@ -1,4 +1,26 @@ --- +- name: create rgw nfs user + command: radosgw-admin --cluster {{ cluster }} user create --uid={{ ceph_nfs_rgw_user }} --display-name="RGW NFS User" + register: rgwuser + delegate_to: "{{ groups[mon_group_name][0] }}" + when: nfs_obj_gw + +- name: set access key + set_fact: + ceph_nfs_rgw_access_key: "{{ (rgwuser.stdout | from_json)['keys'][0]['access_key'] }}" + delegate_to: "{{ groups[mon_group_name][0] }}" + when: + - nfs_obj_gw + - ceph_nfs_rgw_access_key is not defined + +- name: set secret key + set_fact: + ceph_nfs_rgw_secret_key: "{{(rgwuser.stdout | from_json)['keys'][0]['secret_key']}}" + delegate_to: "{{ groups[mon_group_name][0] }}" + when: + - nfs_obj_gw + - ceph_nfs_rgw_secret_key is not defined + - name: create nfs gateway directories file: path: "{{ item }}" @@ -10,21 +32,6 @@ - /var/lib/nfs/ganesha - /var/run/ganesha -- name: create rgw nfs user - command: radosgw-admin --cluster {{ cluster }} user create --uid={{ ceph_nfs_rgw_user }} --display-name="RGW NFS User" - register: rgwuser - when: nfs_obj_gw - -- name: set access key - set_fact: - ceph_nfs_rgw_access_key: "{{ (rgwuser.stdout | from_json)['keys'][0]['access_key'] }}" - when: nfs_obj_gw - -- name: set secret key - set_fact: - ceph_nfs_rgw_secret_key: "{{(rgwuser.stdout | from_json)['keys'][0]['secret_key']}}" - when: nfs_obj_gw - - name: generate ganesha configuration file action: config_template args: @@ -33,7 +40,6 @@ owner: "root" group: "root" mode: "0644" - config_overrides: "{{ ganesha_conf_overrides }}" config_type: ini - name: start nfs gateway service From c907ec41ae0698b7627ebcbe97f1c293611d41d7 Mon Sep 17 00:00:00 2001 From: Ali Maredia Date: Mon, 21 Aug 2017 13:36:38 -0400 Subject: [PATCH 2/4] nfs: add automated testing for nfs-ganesha roles Signed-off-by: Ali Maredia --- tests/conftest.py | 2 ++ .../centos/7/cluster/group_vars/all | 4 ++++ .../centos/7/cluster/group_vars/nfss | 3 +++ tests/functional/centos/7/cluster/hosts | 3 +++ .../centos/7/cluster/vagrant_variables.yml | 2 +- tests/functional/dev_setup.yml | 11 +++++++++++ .../functional/tests/nfs/test_nfs_ganesha.py | 19 +++++++++++++++++++ .../ubuntu/16.04/cluster/group_vars/all | 5 +++++ .../ubuntu/16.04/cluster/group_vars/nfss | 3 +++ tests/functional/ubuntu/16.04/cluster/hosts | 3 +++ .../16.04/cluster/vagrant_variables.yml | 2 +- 11 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 tests/functional/centos/7/cluster/group_vars/nfss create mode 100644 tests/functional/tests/nfs/test_nfs_ganesha.py create mode 100644 tests/functional/ubuntu/16.04/cluster/group_vars/nfss diff --git a/tests/conftest.py b/tests/conftest.py index 795472815..f8b2ec92e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -103,6 +103,8 @@ def pytest_collection_modifyitems(session, config, items): item.add_marker(pytest.mark.mdss) elif "rgw" in test_path: item.add_marker(pytest.mark.rgws) + elif "nfs" in test_path: + item.add_marker(pytest.mark.nfss) else: item.add_marker(pytest.mark.all) diff --git a/tests/functional/centos/7/cluster/group_vars/all b/tests/functional/centos/7/cluster/group_vars/all index 9e552e797..1d581d847 100644 --- a/tests/functional/centos/7/cluster/group_vars/all +++ b/tests/functional/centos/7/cluster/group_vars/all @@ -22,3 +22,7 @@ ceph_conf_overrides: global: osd_pool_default_pg_num: 8 osd_pool_default_size: 1 +nfs_ganesha_stable: true +nfs_ganesha_dev: false +nfs_ganesha_stable_branch: V2.5-stable +nfs_ganesha_flavor: "ceph_master" diff --git a/tests/functional/centos/7/cluster/group_vars/nfss b/tests/functional/centos/7/cluster/group_vars/nfss new file mode 100644 index 000000000..f2f86b825 --- /dev/null +++ b/tests/functional/centos/7/cluster/group_vars/nfss @@ -0,0 +1,3 @@ +copy_admin_key: true +nfs_file_gw: false +nfs_obj_gw: true diff --git a/tests/functional/centos/7/cluster/hosts b/tests/functional/centos/7/cluster/hosts index 4aeca7b05..5e1ac46f6 100644 --- a/tests/functional/centos/7/cluster/hosts +++ b/tests/functional/centos/7/cluster/hosts @@ -17,3 +17,6 @@ ceph-client0 [mgrs] ceph-mgr0 + +[nfss] +nfs0 diff --git a/tests/functional/centos/7/cluster/vagrant_variables.yml b/tests/functional/centos/7/cluster/vagrant_variables.yml index ad1b9b2be..a711032a9 100644 --- a/tests/functional/centos/7/cluster/vagrant_variables.yml +++ b/tests/functional/centos/7/cluster/vagrant_variables.yml @@ -8,7 +8,7 @@ mon_vms: 3 osd_vms: 1 mds_vms: 1 rgw_vms: 1 -nfs_vms: 0 +nfs_vms: 1 rbd_mirror_vms: 0 client_vms: 1 iscsi_gw_vms: 0 diff --git a/tests/functional/dev_setup.yml b/tests/functional/dev_setup.yml index 1fa60cda5..92ab4b3b3 100644 --- a/tests/functional/dev_setup.yml +++ b/tests/functional/dev_setup.yml @@ -13,5 +13,16 @@ dest: "{{ change_dir }}/group_vars/all" when: change_dir is defined + - name: change nfs-ganesha repository to 'dev' + replace: + regexp: "nfs_ganesha_stable:.*" + replace: "nfs_ganesha_stable: false" + dest: "{{ change_dir }}/group_vars/all" + replace: + regexp: "nfs_ganesha_dev:.*" + replace: "nfs_ganesha_dev: true" + dest: "{{ change_dir }}/group_vars/all" + when: change_dir is defined + - name: print contents of {{ change_dir }}/group_vars/all command: "cat {{ change_dir }}/group_vars/all" diff --git a/tests/functional/tests/nfs/test_nfs_ganesha.py b/tests/functional/tests/nfs/test_nfs_ganesha.py new file mode 100644 index 000000000..58cc385d1 --- /dev/null +++ b/tests/functional/tests/nfs/test_nfs_ganesha.py @@ -0,0 +1,19 @@ +import pytest + +class TestNFSs(object): + + @pytest.mark.no_docker + def test_nfs_ganesha_is_installed(self, node, host): + assert host.package("nfs-ganesha").is_installed + + @pytest.mark.no_docker + def test_nfs_ganesha_rgw_package_is_installed(self, node, host): + assert host.package("nfs-ganesha-rgw").is_installed + + @pytest.mark.no_docker + def test_nfs_services_are_running(self, node, host): + assert host.service("nfs-ganesha").is_running + + @pytest.mark.no_docker + def test_nfs_services_are_enabled(self, node, host): + assert host.service("nfs-ganesha").is_enabled diff --git a/tests/functional/ubuntu/16.04/cluster/group_vars/all b/tests/functional/ubuntu/16.04/cluster/group_vars/all index b12fab9c9..b4326d2fe 100644 --- a/tests/functional/ubuntu/16.04/cluster/group_vars/all +++ b/tests/functional/ubuntu/16.04/cluster/group_vars/all @@ -24,3 +24,8 @@ debian_ceph_packages: - ceph - ceph-common - ceph-fuse +nfs_ganesha_stable: true +nfs_ganesha_stable_branch: V2.5-stable +nfs_ganesha_stable_deb_repo: "{{ ceph_mirror }}/nfs-ganesha/deb-{{ nfs_ganesha_stable_branch }}/{{ ceph_stable_release }}" +nfs_ganesha_dev: false +nfs_ganesha_flavor: "ceph_master" diff --git a/tests/functional/ubuntu/16.04/cluster/group_vars/nfss b/tests/functional/ubuntu/16.04/cluster/group_vars/nfss new file mode 100644 index 000000000..f2f86b825 --- /dev/null +++ b/tests/functional/ubuntu/16.04/cluster/group_vars/nfss @@ -0,0 +1,3 @@ +copy_admin_key: true +nfs_file_gw: false +nfs_obj_gw: true diff --git a/tests/functional/ubuntu/16.04/cluster/hosts b/tests/functional/ubuntu/16.04/cluster/hosts index dfe4ef817..e42554e9b 100644 --- a/tests/functional/ubuntu/16.04/cluster/hosts +++ b/tests/functional/ubuntu/16.04/cluster/hosts @@ -17,3 +17,6 @@ client0 [mgrs] mgr0 + +[nfss] +nfs0 diff --git a/tests/functional/ubuntu/16.04/cluster/vagrant_variables.yml b/tests/functional/ubuntu/16.04/cluster/vagrant_variables.yml index 40e76fefd..ff51b872d 100644 --- a/tests/functional/ubuntu/16.04/cluster/vagrant_variables.yml +++ b/tests/functional/ubuntu/16.04/cluster/vagrant_variables.yml @@ -8,7 +8,7 @@ mon_vms: 3 osd_vms: 1 mds_vms: 1 rgw_vms: 1 -nfs_vms: 0 +nfs_vms: 1 rbd_mirror_vms: 0 client_vms: 1 iscsi_gw_vms: 0 From f3e2235b3a975a8e375e339e22505659379e648e Mon Sep 17 00:00:00 2001 From: Ali Maredia Date: Sun, 3 Sep 2017 11:32:44 -0400 Subject: [PATCH 3/4] nfs-ganesha: add config overrides section Signed-off-by: Ali Maredia --- group_vars/nfss.yml.sample | 22 ++++++++++++++++++ roles/ceph-nfs/defaults/main.yml | 23 ++++++++++++++++++- roles/ceph-nfs/tasks/pre_requisite.yml | 7 +++++- .../templates/ganesha.conf.j2 | 17 ++++++++++---- .../centos/7/cluster/group_vars/nfss | 4 ++++ .../functional/tests/nfs/test_nfs_ganesha.py | 4 ++++ .../ubuntu/16.04/cluster/group_vars/nfss | 4 ++++ 7 files changed, 75 insertions(+), 6 deletions(-) rename roles/{ceph-common => ceph-nfs}/templates/ganesha.conf.j2 (71%) diff --git a/group_vars/nfss.yml.sample b/group_vars/nfss.yml.sample index 6f98a0c54..aa0b113e6 100644 --- a/group_vars/nfss.yml.sample +++ b/group_vars/nfss.yml.sample @@ -60,6 +60,28 @@ dummy: #ceph_nfs_rgw_access_key: "QFAMEDSJP5DEKJO0DDXY" #ceph_nfs_rgw_secret_key: "iaSFLDVvDdQt6lkNzHyW4fPLZugBAI1g17LO0+87[MAC[M#C" +################### +# CONFIG OVERRIDE # +################### + +# Ganesha configuration file override. +# These multiline strings will be appended to the contents of the blocks in ganesha.conf and +# must be in the correct ganesha.conf format seen here: +# https://github.com/nfs-ganesha/nfs-ganesha/blob/next/src/config_samples/ganesha.conf.example +# +# Example: +#CACHEINODE { +# #Entries_HWMark = 100000; +#} +# +#ganesha_ceph_export_overrides: +#ganesha_rgw_export_overrides: +#ganesha_log_overrides: +#ganesha_conf_overrides: | +# CACHEINODE { +# #Entries_HWMark = 100000; +# } + ########## # DOCKER # ########## diff --git a/roles/ceph-nfs/defaults/main.yml b/roles/ceph-nfs/defaults/main.yml index 831deb52a..f731e820c 100644 --- a/roles/ceph-nfs/defaults/main.yml +++ b/roles/ceph-nfs/defaults/main.yml @@ -11,7 +11,7 @@ fetch_directory: fetch/ # at their disposal, some people might want to have it # distributed on RGW nodes. Setting 'copy_admin_key' to 'true' # will copy the admin key to the /etc/ceph/ directory -copy_admin_key: yes +copy_admin_key: false ####################### # Access type options # @@ -52,6 +52,27 @@ ceph_nfs_rgw_user: "cephnfs" #ceph_nfs_rgw_access_key: "QFAMEDSJP5DEKJO0DDXY" #ceph_nfs_rgw_secret_key: "iaSFLDVvDdQt6lkNzHyW4fPLZugBAI1g17LO0+87[MAC[M#C" +################### +# CONFIG OVERRIDE # +################### + +# Ganesha configuration file override. +# These multiline strings will be appended to the contents of the blocks in ganesha.conf and +# must be in the correct ganesha.conf format seen here: +# https://github.com/nfs-ganesha/nfs-ganesha/blob/next/src/config_samples/ganesha.conf.example +# +# Example: +#CACHEINODE { + #Entries_HWMark = 100000; +#} +# +#ganesha_ceph_export_overrides: +#ganesha_rgw_export_overrides: +#ganesha_log_overrides: +#ganesha_conf_overrides: | +# CACHEINODE { + #Entries_HWMark = 100000; +# } ########## # DOCKER # diff --git a/roles/ceph-nfs/tasks/pre_requisite.yml b/roles/ceph-nfs/tasks/pre_requisite.yml index 8b8722b48..2eb1bce47 100644 --- a/roles/ceph-nfs/tasks/pre_requisite.yml +++ b/roles/ceph-nfs/tasks/pre_requisite.yml @@ -35,12 +35,17 @@ - name: generate ganesha configuration file action: config_template args: - src: "{{ lookup('env', 'ANSIBLE_ROLES_PATH') | default (playbook_dir + '/roles', true) }}/ceph-common/templates/ganesha.conf.j2" + src: "{{ lookup('env', 'ANSIBLE_ROLES_PATH') | default (playbook_dir + '/roles', true) }}/ceph-nfs/templates/ganesha.conf.j2" dest: /etc/ganesha/ganesha.conf owner: "root" group: "root" mode: "0644" config_type: ini + notify: + - restart ceph nfss + +- name: cat ganesha conf file to view overrides + command: cat /etc/ganesha/ganesha.conf - name: start nfs gateway service service: diff --git a/roles/ceph-common/templates/ganesha.conf.j2 b/roles/ceph-nfs/templates/ganesha.conf.j2 similarity index 71% rename from roles/ceph-common/templates/ganesha.conf.j2 rename to roles/ceph-nfs/templates/ganesha.conf.j2 index 0c661b3d3..dee5a3e83 100644 --- a/roles/ceph-common/templates/ganesha.conf.j2 +++ b/roles/ceph-nfs/templates/ganesha.conf.j2 @@ -12,15 +12,17 @@ EXPORT Access_Type = {{ ceph_nfs_ceph_access_type }}; - NFS_Protocols = {{ ceph_nfs_ceph_protocols }}; + Protocols = {{ ceph_nfs_ceph_protocols }}; - Transport_Protocols = TCP; + Transports = TCP; Sectype = sys,krb5,krb5i,krb5p; FSAL { Name = CEPH; } + + {{ ganesha_ceph_export_overrides | default(None) }} } {% endif %} {% if nfs_obj_gw %} @@ -34,9 +36,9 @@ EXPORT Access_Type = {{ ceph_nfs_rgw_access_type }}; - NFS_Protocols = {{ ceph_nfs_rgw_protocols }}; + Protocols = {{ ceph_nfs_rgw_protocols }}; - Transport_Protocols = TCP; + Transports = TCP; Sectype = sys,krb5,krb5i,krb5p; @@ -46,6 +48,9 @@ EXPORT Access_Key_Id ="{{ ceph_nfs_rgw_access_key }}"; Secret_Access_Key = "{{ ceph_nfs_rgw_secret_key }}"; } + + {{ ganesha_rgw_export_overrides | default(None) }} + } {% endif %} @@ -55,4 +60,8 @@ LOG { destination = "{{ ceph_nfs_log_file }}"; enable = active; } + + {{ ganesha_log_overrides | default(None) }} } + +{{ ganesha_conf_overrides | default(None) }} diff --git a/tests/functional/centos/7/cluster/group_vars/nfss b/tests/functional/centos/7/cluster/group_vars/nfss index f2f86b825..2d2f83bb6 100644 --- a/tests/functional/centos/7/cluster/group_vars/nfss +++ b/tests/functional/centos/7/cluster/group_vars/nfss @@ -1,3 +1,7 @@ copy_admin_key: true nfs_file_gw: false nfs_obj_gw: true +ganesha_conf_overrides: | + CACHEINODE { + Entries_HWMark = 100000; + } diff --git a/tests/functional/tests/nfs/test_nfs_ganesha.py b/tests/functional/tests/nfs/test_nfs_ganesha.py index 58cc385d1..c9b1310a8 100644 --- a/tests/functional/tests/nfs/test_nfs_ganesha.py +++ b/tests/functional/tests/nfs/test_nfs_ganesha.py @@ -17,3 +17,7 @@ class TestNFSs(object): @pytest.mark.no_docker def test_nfs_services_are_enabled(self, node, host): assert host.service("nfs-ganesha").is_enabled + + @pytest.mark.no_docker + def test_nfs_config_override(self, node, host): + assert host.file("/etc/ganesha/ganesha.conf").contains("Entries_HWMark") diff --git a/tests/functional/ubuntu/16.04/cluster/group_vars/nfss b/tests/functional/ubuntu/16.04/cluster/group_vars/nfss index f2f86b825..2d2f83bb6 100644 --- a/tests/functional/ubuntu/16.04/cluster/group_vars/nfss +++ b/tests/functional/ubuntu/16.04/cluster/group_vars/nfss @@ -1,3 +1,7 @@ copy_admin_key: true nfs_file_gw: false nfs_obj_gw: true +ganesha_conf_overrides: | + CACHEINODE { + Entries_HWMark = 100000; + } From f8171e8b4a2718bbbe35d7ca85e9227382359f38 Mon Sep 17 00:00:00 2001 From: Ali Maredia Date: Wed, 6 Sep 2017 12:44:19 -0400 Subject: [PATCH 4/4] nfs: rename host to have ceph- prefix Signed-off-by: Ali Maredia --- Vagrantfile | 4 ++-- roles/ceph-nfs/tasks/pre_requisite.yml | 3 --- tests/functional/centos/7/cluster/hosts | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index d6632fc82..0b09cfda0 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -293,8 +293,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end (0..NNFSS - 1).each do |i| - config.vm.define "nfs#{i}" do |nfs| - nfs.vm.hostname = "#{LABEL_PREFIX}ceph-nfs#{i}" + config.vm.define "#{LABEL_PREFIX}nfs#{i}" do |nfs| + nfs.vm.hostname = "#{LABEL_PREFIX}nfs#{i}" if ASSIGN_STATIC_IP nfs.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.6#{i}" diff --git a/roles/ceph-nfs/tasks/pre_requisite.yml b/roles/ceph-nfs/tasks/pre_requisite.yml index 2eb1bce47..32570ce5b 100644 --- a/roles/ceph-nfs/tasks/pre_requisite.yml +++ b/roles/ceph-nfs/tasks/pre_requisite.yml @@ -44,9 +44,6 @@ notify: - restart ceph nfss -- name: cat ganesha conf file to view overrides - command: cat /etc/ganesha/ganesha.conf - - name: start nfs gateway service service: name: nfs-ganesha diff --git a/tests/functional/centos/7/cluster/hosts b/tests/functional/centos/7/cluster/hosts index 5e1ac46f6..8ef58a403 100644 --- a/tests/functional/centos/7/cluster/hosts +++ b/tests/functional/centos/7/cluster/hosts @@ -19,4 +19,4 @@ ceph-client0 ceph-mgr0 [nfss] -nfs0 +ceph-nfs0