From d11ba606d8bdb3422884227c980ccf3fb3b201f7 Mon Sep 17 00:00:00 2001 From: Jeffrey Zhang Date: Fri, 29 Sep 2017 00:01:03 +0800 Subject: [PATCH] Implement ceph fs Implements: blueprint cephfs Change-Id: I5bf14a668a9e8976a18aa28a5bbfe586690bbd31 --- ansible/group_vars/all.yml | 1 + ansible/inventory/all-in-one | 3 + ansible/inventory/multinode | 3 + ansible/roles/ceph/defaults/main.yml | 18 ++++++ ansible/roles/ceph/tasks/config.yml | 4 ++ ansible/roles/ceph/tasks/deploy.yml | 5 ++ ansible/roles/ceph/tasks/pull.yml | 9 +++ ansible/roles/ceph/tasks/start_mdss.yml | 58 +++++++++++++++++++ ansible/roles/ceph/tasks/upgrade.yml | 5 ++ ansible/roles/ceph/templates/ceph-mds.json.j2 | 17 ++++++ etc/kolla/globals.yml | 1 + .../implement-cephfs-a54396fd56fa1252.yaml | 4 ++ 12 files changed, 128 insertions(+) create mode 100644 ansible/roles/ceph/tasks/start_mdss.yml create mode 100644 ansible/roles/ceph/templates/ceph-mds.json.j2 create mode 100644 releasenotes/notes/implement-cephfs-a54396fd56fa1252.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 6653d1a6de..75ef0d83dc 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -374,6 +374,7 @@ enable_cadf_notifications: "no" enable_ceilometer: "no" enable_central_logging: "no" enable_ceph: "no" +enable_ceph_mds: "no" enable_ceph_rgw: "no" enable_chrony: "no" enable_cinder: "no" diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index 6ed04607e6..5beca624d9 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -290,6 +290,9 @@ neutron neutron # Ceph +[ceph-mds:children] +ceph + [ceph-mgr:children] ceph diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index a54cb3bb61..2e48dc6513 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -309,6 +309,9 @@ neutron neutron # Ceph +[ceph-mds:children] +ceph + [ceph-mgr:children] ceph diff --git a/ansible/roles/ceph/defaults/main.yml b/ansible/roles/ceph/defaults/main.yml index 6bf205e31b..abf9e7da71 100644 --- a/ansible/roles/ceph/defaults/main.yml +++ b/ansible/roles/ceph/defaults/main.yml @@ -8,6 +8,10 @@ project_name: "ceph" ceph_install_type: "{{ kolla_install_type }}" ceph_tag: "{{ openstack_release }}" +ceph_mds_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ ceph_install_type }}-ceph-mds" +ceph_mds_tag: "{{ ceph_tag }}" +ceph_mds_image_full: "{{ ceph_mds_image }}:{{ ceph_mds_tag }}" + ceph_mon_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ ceph_install_type }}-ceph-mon" ceph_mon_tag: "{{ ceph_tag }}" ceph_mon_image_full: "{{ ceph_mon_image }}:{{ ceph_mon_tag }}" @@ -43,6 +47,20 @@ ceph_rgw_keystone_user: "ceph_rgw" openstack_swift_auth: "{{ openstack_auth }}" +########## +# Ceph MDS +########## +cephfs_data_pool_name: "cephfs_data" +cephfs_data_pool_type: "{{ ceph_pool_type }}" +cephfs_data_pool_cache_mode: "{{ ceph_cache_mode }}" +cephfs_data_pool_pg_num: "{{ ceph_pool_pg_num }}" +cephfs_data_pool_pgp_num: "{{ ceph_pool_pgp_num }}" +cephfs_metadata_pool_name: "cephfs_metadata" +cephfs_metadata_pool_type: "{{ ceph_pool_type }}" +cephfs_metadata_pool_cache_mode: "{{ ceph_cache_mode }}" +cephfs_metadata_pool_pg_num: "{{ ceph_pool_pg_num }}" +cephfs_metadata_pool_pgp_num: "{{ ceph_pool_pgp_num }}" + #################### # Kolla #################### diff --git a/ansible/roles/ceph/tasks/config.yml b/ansible/roles/ceph/tasks/config.yml index 91e7b67e19..8fc724b633 100644 --- a/ansible/roles/ceph/tasks/config.yml +++ b/ansible/roles/ceph/tasks/config.yml @@ -9,6 +9,7 @@ - "ceph-osd" - "ceph-rgw" - "ceph-mgr" + - "ceph-mds" - name: Copying over config.json files for services template: @@ -25,6 +26,8 @@ group: ceph-rgw - name: "ceph-mgr" group: "ceph-mgr" + - name: "ceph-mds" + group: "ceph-mds" - name: Copying over ceph.conf vars: @@ -40,3 +43,4 @@ - "ceph-osd" - "ceph-rgw" - "ceph-mgr" + - "ceph-mds" diff --git a/ansible/roles/ceph/tasks/deploy.yml b/ansible/roles/ceph/tasks/deploy.yml index 960d221178..7026f7621b 100644 --- a/ansible/roles/ceph/tasks/deploy.yml +++ b/ansible/roles/ceph/tasks/deploy.yml @@ -27,3 +27,8 @@ when: - enable_ceph_rgw_keystone | bool - inventory_hostname in groups['ceph-rgw'] + +- include: start_mdss.yml + when: + - enable_ceph_mds | bool + - inventory_hostname in groups['ceph-mds'] diff --git a/ansible/roles/ceph/tasks/pull.yml b/ansible/roles/ceph/tasks/pull.yml index 2834f2408a..225e3d15bb 100644 --- a/ansible/roles/ceph/tasks/pull.yml +++ b/ansible/roles/ceph/tasks/pull.yml @@ -27,3 +27,12 @@ image: "{{ ceph_mgr_image_full }}" when: - inventory_hostname in groups['ceph-mgr'] + +- name: Pulling ceph-mds image + kolla_docker: + action: "pull_image" + common_options: "{{ docker_common_options }}" + image: "{{ ceph_mds_image_full }}" + when: + - enable_ceph_mds | bool + - inventory_hostname in groups['ceph-mds'] diff --git a/ansible/roles/ceph/tasks/start_mdss.yml b/ansible/roles/ceph/tasks/start_mdss.yml new file mode 100644 index 0000000000..3ec8d69549 --- /dev/null +++ b/ansible/roles/ceph/tasks/start_mdss.yml @@ -0,0 +1,58 @@ +--- +- include: ../../ceph_pools.yml + vars: + pool_name: "{{ item.pool_name }}" + pool_type: "{{ item.pool_type }}" + cache_mode: "{{ item.cache_mode }}" + pool_pg_num: "{{ item.pool_pg_num }}" + pool_pgp_num: "{{ item.pool_pgp_num }}" + with_items: + - pool_name: "{{ cephfs_data_pool_name }}" + pool_type: "{{ cephfs_data_pool_type }}" + cache_mode: "{{ cephfs_data_pool_cache_mode }}" + pool_pg_num: "{{ cephfs_data_pool_pg_num }}" + pool_pgp_num: "{{ cephfs_data_pool_pgp_num }}" + - pool_name: "{{ cephfs_metadata_pool_name }}" + pool_type: "{{ cephfs_metadata_pool_type }}" + cache_mode: "{{ cephfs_metadata_pool_cache_mode }}" + pool_pg_num: "{{ cephfs_metadata_pool_pg_num }}" + pool_pgp_num: "{{ cephfs_metadata_pool_pgp_num }}" + +- name: Geting ceph mds keyring + command: docker exec ceph_mon ceph auth get-or-create mds.{{ hostvars[item]['inventory_hostname'] }} mds 'allow ' osd 'allow *' mon 'allow rwx' + register: ceph_mds_auth + run_once: true + delegate_to: "{{ groups['ceph-mon'][0] }}" + changed_when: false + with_items: "{{ groups['ceph-mds'] }}" + +- name: Pushing ceph mds keyring to ceph-mds + copy: + content: "{{ item.stdout }}\n" + dest: "{{ node_config_directory }}/ceph-mds/ceph.mds.{{ inventory_hostname }}.keyring" + when: + - inventory_hostname == item.item + with_items: "{{ ceph_mds_auth.results }}" + +- name: Starting ceph-mds container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + image: "{{ ceph_mds_image_full }}" + name: "ceph_mds" + volumes: + - "{{ node_config_directory }}/ceph-mds/:{{ container_config_directory }}/:ro" + - "/etc/localtime:/etc/localtime:ro" + - "kolla_logs:/var/log/kolla/" + +- name: Checking whether cephfs is created + command: docker exec ceph_mon ceph fs get cephfs + register: cephfs_stat + failed_when: false + changed_when: false + run_once: true + +- name: Creating ceph new filesystem + command: docker exec ceph_mon ceph fs new cephfs cephfs_metadata cephfs_data + run_once: true + when: cephfs_stat.rc != 0 diff --git a/ansible/roles/ceph/tasks/upgrade.yml b/ansible/roles/ceph/tasks/upgrade.yml index 52f76c05b8..10d8e36db9 100644 --- a/ansible/roles/ceph/tasks/upgrade.yml +++ b/ansible/roles/ceph/tasks/upgrade.yml @@ -11,3 +11,8 @@ when: - enable_ceph_rgw | bool - inventory_hostname in groups['ceph-rgw'] + +- include: start_mdss.yml + when: + - enable_ceph_mds | bool + - inventory_hostname in groups['ceph-mds'] diff --git a/ansible/roles/ceph/templates/ceph-mds.json.j2 b/ansible/roles/ceph/templates/ceph-mds.json.j2 new file mode 100644 index 0000000000..dc7073c635 --- /dev/null +++ b/ansible/roles/ceph/templates/ceph-mds.json.j2 @@ -0,0 +1,17 @@ +{ + "command": "/usr/bin/ceph-mds -f -c /etc/ceph/ceph.conf -i {{ inventory_hostname }}", + "config_files": [ + { + "source": "{{ container_config_directory }}/ceph.conf", + "dest": "/etc/ceph/ceph.conf", + "owner": "ceph", + "perm": "0600" + }, + { + "source": "{{ container_config_directory }}/ceph.mds.{{ inventory_hostname }}.keyring", + "dest": "/var/lib/ceph/mds/ceph-{{ inventory_hostname }}/keyring", + "owner": "root", + "perm": "0644" + } + ] +} diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index 9234f576f7..6c9684d4ef 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -142,6 +142,7 @@ kolla_internal_vip_address: "10.10.10.254" #enable_ceilometer: "no" #enable_central_logging: "no" #enable_ceph: "no" +#enable_ceph_mds: "no" #enable_ceph_rgw: "no" #enable_chrony: "no" #enable_cinder: "no" diff --git a/releasenotes/notes/implement-cephfs-a54396fd56fa1252.yaml b/releasenotes/notes/implement-cephfs-a54396fd56fa1252.yaml new file mode 100644 index 0000000000..ac68b88d44 --- /dev/null +++ b/releasenotes/notes/implement-cephfs-a54396fd56fa1252.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Cephfs is implemented