From cb03e96dc73664cdfb60d6316d32a9466ce8b254 Mon Sep 17 00:00:00 2001 From: caoyuan Date: Thu, 18 Jan 2018 17:17:50 +0800 Subject: [PATCH] dev mode: Add support for senlin Allows users to develop on Senlin using Kolla. Partially implements: blueprint mount-sources Change-Id: I3523ab5638b8440050f538501f1b1a35270435cd --- ansible/roles/senlin/defaults/main.yml | 10 ++++++++++ ansible/roles/senlin/handlers/main.yml | 4 ++-- ansible/roles/senlin/tasks/bootstrap_service.yml | 2 +- ansible/roles/senlin/tasks/clone.yml | 6 ++++++ ansible/roles/senlin/tasks/config.yml | 2 +- ansible/roles/senlin/tasks/deploy.yml | 3 +++ 6 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 ansible/roles/senlin/tasks/clone.yml diff --git a/ansible/roles/senlin/defaults/main.yml b/ansible/roles/senlin/defaults/main.yml index 4a3c57f699..ce37ad0e13 100644 --- a/ansible/roles/senlin/defaults/main.yml +++ b/ansible/roles/senlin/defaults/main.yml @@ -11,6 +11,7 @@ senlin_services: - "{{ node_config_directory }}/senlin-api/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/senlin/senlin:/var/lib/kolla/venv/lib/python2.7/site-packages/senlin' if senlin_dev_mode | bool else '' }}" senlin-engine: container_name: senlin_engine group: senlin-engine @@ -20,6 +21,7 @@ senlin_services: - "{{ node_config_directory }}/senlin-engine/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/senlin/senlin:/var/lib/kolla/venv/lib/python2.7/site-packages/senlin' if senlin_dev_mode | bool else '' }}" #################### # Database @@ -56,3 +58,11 @@ senlin_logging_debug: "{{ openstack_logging_debug }}" senlin_keystone_user: "senlin" openstack_senlin_auth: "{{ openstack_auth }}" + + +#################### +# Kolla +#################### +senlin_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}" +senlin_dev_repos_pull: "{{ kolla_dev_repos_pull }}" +senlin_dev_mode: "{{ kolla_dev_mode }}" diff --git a/ansible/roles/senlin/handlers/main.yml b/ansible/roles/senlin/handlers/main.yml index df0ac9c42c..13d058ea54 100644 --- a/ansible/roles/senlin/handlers/main.yml +++ b/ansible/roles/senlin/handlers/main.yml @@ -12,7 +12,7 @@ common_options: "{{ docker_common_options }}" name: "{{ service.container_name }}" image: "{{ service.image }}" - volumes: "{{ service.volumes }}" + volumes: "{{ service.volumes|reject('equalto', '')|list }}" when: - action != "config" - inventory_hostname in groups[service.group] @@ -35,7 +35,7 @@ common_options: "{{ docker_common_options }}" name: "{{ service.container_name }}" image: "{{ service.image }}" - volumes: "{{ service.volumes }}" + volumes: "{{ service.volumes|reject('equalto', '')|list }}" when: - action != "config" - inventory_hostname in groups[service.group] diff --git a/ansible/roles/senlin/tasks/bootstrap_service.yml b/ansible/roles/senlin/tasks/bootstrap_service.yml index 1fe89fb214..cc5a3961ea 100644 --- a/ansible/roles/senlin/tasks/bootstrap_service.yml +++ b/ansible/roles/senlin/tasks/bootstrap_service.yml @@ -14,6 +14,6 @@ BOOTSTRAP: name: "bootstrap_senlin" restart_policy: "never" - volumes: "{{ senlin_api.volumes }}" + volumes: "{{ senlin_api.volumes|reject('equalto', '')|list }}" run_once: True delegate_to: "{{ groups[senlin_api.group][0] }}" diff --git a/ansible/roles/senlin/tasks/clone.yml b/ansible/roles/senlin/tasks/clone.yml new file mode 100644 index 0000000000..453b3e4234 --- /dev/null +++ b/ansible/roles/senlin/tasks/clone.yml @@ -0,0 +1,6 @@ +--- +- name: Cloning senlin source repository for development + git: + repo: "{{ senlin_git_repository }}" + dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}" + update: "{{ senlin_dev_repos_pull }}" diff --git a/ansible/roles/senlin/tasks/config.yml b/ansible/roles/senlin/tasks/config.yml index fe50e6f78e..332995d80f 100644 --- a/ansible/roles/senlin/tasks/config.yml +++ b/ansible/roles/senlin/tasks/config.yml @@ -67,7 +67,7 @@ common_options: "{{ docker_common_options }}" name: "{{ item.value.container_name }}" image: "{{ item.value.image }}" - volumes: "{{ item.value.volumes }}" + volumes: "{{ item.value.volumes|reject('equalto', '')|list }}" register: check_senlin_containers when: - action != "config" diff --git a/ansible/roles/senlin/tasks/deploy.yml b/ansible/roles/senlin/tasks/deploy.yml index 7e02e41d90..b9792d9512 100644 --- a/ansible/roles/senlin/tasks/deploy.yml +++ b/ansible/roles/senlin/tasks/deploy.yml @@ -6,6 +6,9 @@ when: inventory_hostname in groups['senlin-api'] or inventory_hostname in groups['senlin-engine'] +- include: clone.yml + when: senlin_dev_mode | bool + - include: bootstrap.yml when: inventory_hostname in groups['senlin-api']