dev mode: Add support for ironic

Allows users to develop on ironic using Kolla.

Partially implements: blueprint mount-sources

Change-Id: I74540f5bcbf723f097f3dea96dcaf067834c493a
This commit is contained in:
wu.chunyang 2018-05-28 15:03:18 +00:00
parent f7950466e3
commit 291c04c87f
6 changed files with 33 additions and 6 deletions

View File

@ -11,6 +11,7 @@ ironic_services:
- "{{ node_config_directory }}/ironic-api/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/ironic-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro" - "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla" - "kolla_logs:/var/log/kolla"
- "{{ kolla_dev_repos_directory ~ '/ironic/ironic:/var/lib/kolla/venv/lib/python2.7/site-packages/ironic' if ironic_dev_mode | bool else '' }}"
ironic-conductor: ironic-conductor:
container_name: ironic_conductor container_name: ironic_conductor
group: ironic-conductor group: ironic-conductor
@ -28,6 +29,7 @@ ironic_services:
- "ironic:/var/lib/ironic" - "ironic:/var/lib/ironic"
- "ironic_pxe:/tftpboot/" - "ironic_pxe:/tftpboot/"
- "ironic_ipxe:/httpboot/" - "ironic_ipxe:/httpboot/"
- "{{ kolla_dev_repos_directory ~ '/ironic/ironic:/var/lib/kolla/venv/lib/python2.7/site-packages/ironic' if ironic_dev_mode | bool else '' }}"
ironic-inspector: ironic-inspector:
container_name: ironic_inspector container_name: ironic_inspector
group: ironic-inspector group: ironic-inspector
@ -38,6 +40,7 @@ ironic_services:
- "{{ node_config_directory }}/ironic-inspector/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/ironic-inspector/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro" - "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla" - "kolla_logs:/var/log/kolla"
- "{{ kolla_dev_repos_directory ~ '/ironic-inspector/ironic_inspector:/var/lib/kolla/venv/lib/python2.7/site-packages/ironic_inspector' if ironic_dev_mode | bool else '' }}"
ironic-pxe: ironic-pxe:
container_name: ironic_pxe container_name: ironic_pxe
group: ironic-pxe group: ironic-pxe
@ -140,3 +143,12 @@ ironic_dnsmasq_boot_file: "{% if enable_ironic_ipxe | bool %}undionly.kpxe{% els
ironic_cleaning_network: ironic_cleaning_network:
ironic_console_serial_speed: "115200n8" ironic_console_serial_speed: "115200n8"
ironic_ipxe_url: http://{{ api_interface_address }}:{{ ironic_ipxe_port }} ironic_ipxe_url: http://{{ api_interface_address }}:{{ ironic_ipxe_port }}
####################
## Kolla
#####################
ironic_inspector_git_repository: "{{ kolla_dev_repos_git }}/ironic-inspector"
ironic_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
ironic_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
ironic_dev_mode: "{{ kolla_dev_mode }}"

View File

@ -12,7 +12,7 @@
common_options: "{{ docker_common_options }}" common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}" name: "{{ service.container_name }}"
image: "{{ service.image }}" image: "{{ service.image }}"
volumes: "{{ service.volumes }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}"
when: when:
- kolla_action != "config" - kolla_action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]
@ -36,7 +36,7 @@
name: "{{ service.container_name }}" name: "{{ service.container_name }}"
image: "{{ service.image }}" image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}" privileged: "{{ service.privileged | default(False) }}"
volumes: "{{ service.volumes }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}"
when: when:
- kolla_action != "config" - kolla_action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]
@ -59,7 +59,7 @@
name: "{{ service.container_name }}" name: "{{ service.container_name }}"
image: "{{ service.image }}" image: "{{ service.image }}"
privileged: "{{ service.privileged | default(False) }}" privileged: "{{ service.privileged | default(False) }}"
volumes: "{{ service.volumes }}" volumes: "{{ service.volumes|reject('equalto', '')|list }}"
when: when:
- kolla_action != "config" - kolla_action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]

View File

@ -14,7 +14,7 @@
BOOTSTRAP: BOOTSTRAP:
name: "bootstrap_ironic" name: "bootstrap_ironic"
restart_policy: "never" restart_policy: "never"
volumes: "{{ ironic_api.volumes }}" volumes: "{{ ironic_api.volumes|reject('equalto', '')|list }}"
run_once: True run_once: True
delegate_to: "{{ groups[ironic_api.group][0] }}" delegate_to: "{{ groups[ironic_api.group][0] }}"
when: inventory_hostname in groups[ironic_api.group] when: inventory_hostname in groups[ironic_api.group]
@ -34,7 +34,7 @@
BOOTSTRAP: BOOTSTRAP:
name: "bootstrap_ironic_inspector" name: "bootstrap_ironic_inspector"
restart_policy: "never" restart_policy: "never"
volumes: "{{ ironic_inspector.volumes }}" volumes: "{{ ironic_inspector.volumes|reject('equalto', '')|list }}"
run_once: True run_once: True
delegate_to: "{{ groups[ironic_inspector.group][0] }}" delegate_to: "{{ groups[ironic_inspector.group][0] }}"
when: inventory_hostname in groups[ironic_inspector.group] when: inventory_hostname in groups[ironic_inspector.group]

View File

@ -0,0 +1,12 @@
---
- name: Cloning ironic source repository for development
git:
repo: "{{ ironic_git_repository }}"
dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}"
update: "{{ ironic_dev_repos_pull }}"
- name: Cloning ironic-inspector source repository for development
git:
repo: "{{ ironic_inspector_git_repository }}"
dest: "{{ kolla_dev_repos_directory }}/ironic-inspector"
update: "{{ ironic_dev_repos_pull }}"

View File

@ -258,7 +258,7 @@
image: "{{ item.value.image }}" image: "{{ item.value.image }}"
privileged: "{{ item.value.privileged|default(False) }}" privileged: "{{ item.value.privileged|default(False) }}"
cap_add: "{{ item.value.cap_add|default([]) }}" cap_add: "{{ item.value.cap_add|default([]) }}"
volumes: "{{ item.value.volumes }}" volumes: "{{ item.value.volumes|reject('equalto', '')|list }}"
register: check_ironic_containers register: check_ironic_containers
when: when:
- kolla_action != "config" - kolla_action != "config"

View File

@ -11,6 +11,9 @@
inventory_hostname in groups['ironic-pxe'] or inventory_hostname in groups['ironic-pxe'] or
inventory_hostname in groups['ironic-ipxe'] inventory_hostname in groups['ironic-ipxe']
- include: clone.yml
when: ironic_dev_mode | bool
- include: bootstrap.yml - include: bootstrap.yml
when: inventory_hostname in groups['ironic-api'] or when: inventory_hostname in groups['ironic-api'] or
inventory_hostname in groups['ironic-inspector'] or inventory_hostname in groups['ironic-inspector'] or