From 0669d4f3e68a143d6401532807376d1c40a2eb1c Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Fri, 22 Jun 2018 17:19:38 +0100 Subject: [PATCH] Create /volumes when using external ceph Currently we only create the /volumes directory when using the kolla-ansible bundled ceph. This extends the functionality to external ceph. Note: In addition to the cherry-picked commit, we add jmespath to requirements as it is required for the json_query filter, with a minimum version of 0.9.3 to match lower-constraints.txt. Change-Id: I1e9a40e4ee893a53f04909ef7835be005c9b5276 Closes-Bug: #1778720 (cherry picked from commit 2f6b1c6890cf7ea6b0dd33ac219646e4dcaf1fd6) --- ansible/roles/manila/defaults/main.yml | 1 + ansible/roles/manila/tasks/deploy.yml | 3 +-- .../roles/manila/tasks/fix_cephfs_owner.yml | 21 ++++++++++++++----- requirements.txt | 1 + 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ansible/roles/manila/defaults/main.yml b/ansible/roles/manila/defaults/main.yml index b77abbc625..be487e2961 100644 --- a/ansible/roles/manila/defaults/main.yml +++ b/ansible/roles/manila/defaults/main.yml @@ -35,6 +35,7 @@ manila_services: - "/etc/localtime:/etc/localtime:ro" - "/run/:/run/:shared" - "kolla_logs:/var/log/kolla/" + - "/lib/modules:/lib/modules:ro" - "{{ kolla_dev_repos_directory ~ '/manila/manila:/var/lib/kolla/venv/lib/python2.7/site-packages/manila' if manila_dev_mode | bool else '' }}" dimensions: "{{ manila_share_dimensions }}" manila-data: diff --git a/ansible/roles/manila/tasks/deploy.yml b/ansible/roles/manila/tasks/deploy.yml index 1f703768e0..bb2457d0b5 100644 --- a/ansible/roles/manila/tasks/deploy.yml +++ b/ansible/roles/manila/tasks/deploy.yml @@ -19,7 +19,6 @@ - include_tasks: fix_cephfs_owner.yml when: - - enable_ceph | bool - - enable_ceph_mds | bool + - not enable_ceph | bool or enable_ceph_mds | bool - enable_manila_backend_cephfs_native | bool - inventory_hostname in groups['manila-share'] diff --git a/ansible/roles/manila/tasks/fix_cephfs_owner.yml b/ansible/roles/manila/tasks/fix_cephfs_owner.yml index 4c58c12bdc..f792b48b95 100644 --- a/ansible/roles/manila/tasks/fix_cephfs_owner.yml +++ b/ansible/roles/manila/tasks/fix_cephfs_owner.yml @@ -11,14 +11,25 @@ run_once: True when: check_cephfs.rc != 0 -- name: Get cephfs addr - set_fact: cephfs_addr={% for host in groups['ceph-mon'] %}{{ hostvars[host]['ansible_' + hostvars[host]['storage_interface']]['ipv4']['address'] }}{% if loop.last %}:6789:/{% else %},{% endif %}{% endfor %} +- name: Get monitor dump + command: docker exec manila_share ceph mon dump -c /etc/ceph/ceph.conf --name client.manila -f json + register: ceph_monitor_dump + changed_when: False run_once: True -- name: Pulling cephx keyring for manila - command: docker exec ceph_mon ceph auth get-key client.manila +- name: Get cephfs addr + vars: + query: mons[*].public_addr + # take only ip and port from public_addr, e.g from public_addr: 10.66.1.5:6789/0 + # use 10.66.1.5:6789 + regex: "[^/]*" + set_fact: + cephfs_addr: "{{ ceph_monitor_dump.stdout | from_json | json_query(query) | map('regex_search', regex) | join(',') }}" + run_once: true + +- name: Get cephfs secret + command: docker exec manila_share ceph-authtool -p /etc/ceph/ceph.client.manila.keyring -n client.manila register: manila_keyring - delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False run_once: True diff --git a/requirements.txt b/requirements.txt index d7f806744c..0bf32bc9d6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,4 @@ setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2. PyYAML>=3.12 # MIT netaddr>=0.7.18 # BSD cryptography>=2.1 # BSD/Apache-2.0 +jmespath>=0.9.3 # MIT