From c8bb9bcc2b1009a941bcfb9044fbec0d43383c46 Mon Sep 17 00:00:00 2001 From: caoyuan Date: Fri, 13 Apr 2018 21:10:10 +0800 Subject: [PATCH] dev mode: Add support for cinder Provide support for kolla dev mode in cinder. When 'kolla_dev_mode' or 'cinder_dev_mode' variables are enabled, source code of cinder project is cloned and bind mounted. Partially implements: blueprint mount-sources Change-Id: I9ccd395d076f9cc1ad4b51af9d22ba8b17fac1bc --- ansible/roles/cinder/defaults/main.yml | 12 ++++++++++++ ansible/roles/cinder/tasks/bootstrap_service.yml | 2 +- ansible/roles/cinder/tasks/clone.yml | 6 ++++++ ansible/roles/cinder/tasks/deploy.yml | 3 +++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 ansible/roles/cinder/tasks/clone.yml diff --git a/ansible/roles/cinder/defaults/main.yml b/ansible/roles/cinder/defaults/main.yml index 4842692471..ce3bb926db 100644 --- a/ansible/roles/cinder/defaults/main.yml +++ b/ansible/roles/cinder/defaults/main.yml @@ -11,6 +11,7 @@ cinder_services: - "{{ node_config_directory }}/cinder-api/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/cinder/cinder:/var/lib/kolla/venv/lib/python2.7/site-packages/cinder' if cinder_dev_mode | bool else '' }}" cinder-scheduler: container_name: cinder_scheduler group: cinder-scheduler @@ -20,6 +21,7 @@ cinder_services: - "{{ node_config_directory }}/cinder-scheduler/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/cinder/cinder:/var/lib/kolla/venv/lib/python2.7/site-packages/cinder' if cinder_dev_mode | bool else '' }}" cinder-volume: container_name: cinder_volume group: cinder-volume @@ -36,6 +38,7 @@ cinder_services: - "cinder:/var/lib/cinder" - "{% if enable_iscsid | bool %}iscsi_info:/etc/iscsi{% endif %}" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/cinder/cinder:/var/lib/kolla/venv/lib/python2.7/site-packages/cinder' if cinder_dev_mode | bool else '' }}" cinder-backup: container_name: cinder_backup group: cinder-backup @@ -50,6 +53,7 @@ cinder_services: - "cinder:/var/lib/cinder" - "{% if enable_iscsid | bool %}iscsi_info:/etc/iscsi{% endif %}" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/cinder/cinder:/var/lib/kolla/venv/lib/python2.7/site-packages/cinder' if cinder_dev_mode | bool else '' }}" #################### # Ceph @@ -179,3 +183,11 @@ zfssa_iscsi_project: zfssa_iscsi_initiator_group: zfssa_iscsi_target_portal: zfssa_iscsi_target_interfaces: + + +#################### +# Kolla +#################### +cinder_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}" +cinder_dev_repos_pull: "{{ kolla_dev_repos_pull }}" +cinder_dev_mode: "{{ kolla_dev_mode }}" diff --git a/ansible/roles/cinder/tasks/bootstrap_service.yml b/ansible/roles/cinder/tasks/bootstrap_service.yml index 9f9ec5020a..c45ab06476 100644 --- a/ansible/roles/cinder/tasks/bootstrap_service.yml +++ b/ansible/roles/cinder/tasks/bootstrap_service.yml @@ -15,6 +15,6 @@ BOOTSTRAP: name: "bootstrap_cinder" restart_policy: "never" - volumes: "{{ cinder_api.volumes }}" + volumes: "{{ cinder_api.volumes|reject('equalto', '')|list }}" run_once: True delegate_to: "{{ groups[cinder_api.group][0] }}" diff --git a/ansible/roles/cinder/tasks/clone.yml b/ansible/roles/cinder/tasks/clone.yml new file mode 100644 index 0000000000..884d7248b3 --- /dev/null +++ b/ansible/roles/cinder/tasks/clone.yml @@ -0,0 +1,6 @@ +--- +- name: Cloning cinder source repository for development + git: + repo: "{{ cinder_git_repository }}" + dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}" + update: "{{ cinder_dev_repos_pull }}" diff --git a/ansible/roles/cinder/tasks/deploy.yml b/ansible/roles/cinder/tasks/deploy.yml index d3c6a0dab0..f34e908ba2 100644 --- a/ansible/roles/cinder/tasks/deploy.yml +++ b/ansible/roles/cinder/tasks/deploy.yml @@ -23,6 +23,9 @@ inventory_hostname in groups['cinder-scheduler'] or inventory_hostname in groups['cinder-backup'] +- include: clone.yml + when: cinder_dev_mode | bool + - include: bootstrap.yml when: inventory_hostname in groups['cinder-api']