dev mode: Add support for sahara

Provide support fot kolla dev mode in sahara. When
'kolla_dev_mode' or 'sahara_dev_mode' variables are
enabled, source code of sahara  project will be  cloned
and  mounted automatically

Partially implements: blueprint mount-sources

Change-Id: I496ea4443ec8ffc4dc9d0f0d3e6a4514d16ed336
Co-Authored-By: zhulingjie <easyzlj@gmail.com>
This commit is contained in:
wu.chunyang 2018-06-07 13:56:07 +00:00
parent e88b9a7ad4
commit 31a6de01f3
6 changed files with 23 additions and 4 deletions

View File

@ -12,6 +12,7 @@ sahara_services:
- "/etc/localtime:/etc/localtime:ro"
- "sahara:/var/lib/sahara/"
- "kolla_logs:/var/log/kolla/"
- "{{ kolla_dev_repos_directory ~ '/sahara/sahara:/var/lib/kolla/venv/lib/python2.7/site-packages/sahara' if sahara_dev_mode | bool else '' }}"
sahara-engine:
container_name: sahara_engine
group: sahara-engine
@ -24,6 +25,7 @@ sahara_services:
- "sahara:/var/lib/sahara/"
- "kolla_logs:/var/log/kolla/"
- "/run:/run:shared"
- "{{ kolla_dev_repos_directory ~ '/sahara/sahara:/var/lib/kolla/venv/lib/python2.7/site-packages/sahara' if sahara_dev_mode | bool else '' }}"
####################
@ -61,3 +63,11 @@ sahara_logging_debug: "{{ openstack_logging_debug }}"
sahara_keystone_user: "sahara"
openstack_sahara_auth: "{{ openstack_auth }}"
####################
## Kolla
#####################
sahara_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
sahara_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
sahara_dev_mode: "{{ kolla_dev_mode }}"

View File

@ -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:
- kolla_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 }}"
privileged: "{{ service.privileged | default(False) }}"
when:
- kolla_action != "config"

View File

@ -14,6 +14,6 @@
BOOTSTRAP:
name: "bootstrap_sahara"
restart_policy: "never"
volumes: "{{ sahara_api.volumes }}"
volumes: "{{ sahara_api.volumes|reject('equalto', '')|list }}"
run_once: True
delegate_to: "{{ groups[sahara_api.group][0] }}"

View File

@ -0,0 +1,6 @@
---
- name: Cloning sahara source repository for development
git:
repo: "{{ sahara_git_repository }}"
dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}"
update: "{{ sahara_dev_repos_pull }}"

View File

@ -89,7 +89,7 @@
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
privileged: "{{ item.value.privileged | default(False) }}"
volumes: "{{ item.value.volumes }}"
volumes: "{{ item.value.volumes|reject('equalto', '')|list }}"
register: check_sahara_containers
when:
- kolla_action != "config"

View File

@ -6,6 +6,9 @@
when: inventory_hostname in groups['sahara-api'] or
inventory_hostname in groups['sahara-engine']
- include: clone.yml
when: sahara_dev_mode | bool
- include: bootstrap.yml
when: inventory_hostname in groups['sahara-api']