From 0b0b2b39d7593a4c9f28872c25b9d340e1377bbf Mon Sep 17 00:00:00 2001 From: caoyuan Date: Fri, 13 Apr 2018 12:44:00 +0800 Subject: [PATCH] Provide support for nova dev mode in kolla Add a possibility to mount sources as volumes to containers, in "more than documentation" way. That will let us to use kolla as a replacement for devstack. Partially implements: blueprint mount-sources Co-Authored-By: zhulingjie Change-Id: I10677e5ad22f2107a0657feeeaf32287ab9f8e28 --- ansible/roles/nova/defaults/main.yml | 20 +++++++++++++++++++ ansible/roles/nova/handlers/main.yml | 1 - .../roles/nova/tasks/bootstrap_service.yml | 2 +- ansible/roles/nova/tasks/clone.yml | 6 ++++++ ansible/roles/nova/tasks/deploy.yml | 3 +++ 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 ansible/roles/nova/tasks/clone.yml diff --git a/ansible/roles/nova/defaults/main.yml b/ansible/roles/nova/defaults/main.yml index dffa7f4d85..9b64ff812a 100644 --- a/ansible/roles/nova/defaults/main.yml +++ b/ansible/roles/nova/defaults/main.yml @@ -21,6 +21,7 @@ nova_services: - "{{ nova_instance_datadir_volume }}:/var/lib/nova/" - "{% if enable_cinder_backend_nfs | bool %}/var/lib/nova/mnt:/var/lib/nova/mnt:shared{% endif %}" - "nova_libvirt_qemu:/etc/libvirt/qemu" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ nova_libvirt_dimensions }}" nova-ssh: container_name: "nova_ssh" @@ -33,6 +34,7 @@ nova_services: - "kolla_logs:/var/log/kolla" - "{{ nova_instance_datadir_volume }}:/var/lib/nova" - "{% if enable_cinder_backend_nfs | bool %}/var/lib/nova/mnt:/var/lib/nova/mnt:shared{% endif %}" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ nova_ssh_dimensions }}" placement-api: container_name: "placement_api" @@ -43,6 +45,7 @@ nova_services: - "{{ node_config_directory }}/placement-api/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ placement_api_dimensions }}" nova-api: container_name: "nova_api" @@ -55,6 +58,7 @@ nova_services: - "/etc/localtime:/etc/localtime:ro" - "/lib/modules:/lib/modules:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ nova_api_dimensions }}" nova-consoleauth: container_name: "nova_consoleauth" @@ -65,6 +69,7 @@ nova_services: - "{{ node_config_directory }}/nova-consoleauth/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ nova_consoleauth_dimensions }}" nova-novncproxy: container_name: "nova_novncproxy" @@ -75,6 +80,7 @@ nova_services: - "{{ node_config_directory }}/nova-novncproxy/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ nova_novncproxy_dimensions }}" nova-scheduler: container_name: "nova_scheduler" @@ -85,6 +91,7 @@ nova_services: - "{{ node_config_directory }}/nova-scheduler/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ nova_scheduler_dimensions }}" nova-spicehtml5proxy: container_name: "nova_spicehtml5proxy" @@ -95,6 +102,7 @@ nova_services: - "{{ node_config_directory }}/nova-spicehtml5proxy/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ nova_spicehtml5proxy_dimensions }}" nova-serialproxy: container_name: "nova_serialproxy" @@ -105,6 +113,7 @@ nova_services: - "{{ node_config_directory }}/nova-serialproxy/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ nova_serialproxy_dimensions }}" nova-conductor: container_name: "nova_conductor" @@ -115,6 +124,7 @@ nova_services: - "{{ node_config_directory }}/nova-conductor/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ nova_conductor_dimensions }}" nova-compute: container_name: "nova_compute" @@ -136,6 +146,7 @@ nova_services: - "libvirtd:/var/lib/libvirt" - "{{ nova_instance_datadir_volume }}:/var/lib/nova/" - "{% if enable_cinder_backend_nfs | bool %}/var/lib/nova/mnt:/var/lib/nova/mnt:shared{% endif %}" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ nova_compute_dimensions }}" nova-compute-ironic: container_name: "nova_compute_ironic" @@ -146,6 +157,7 @@ nova_services: - "{{ node_config_directory }}/nova-compute-ironic/:{{ container_config_directory }}/:ro" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" + - "{{ kolla_dev_repos_directory ~ '/nova/nova:/var/lib/kolla/venv/lib/python2.7/site-packages/nova' if nova_dev_mode | bool else '' }}" dimensions: "{{ nova_compute_ironic_dimensions }}" #################### @@ -298,3 +310,11 @@ nova_enabled_notification_topics: "{{ nova_notification_topics | selectattr('ena #################### vmware_vcenter_datastore_regex: ".*" ovs_bridge: "nsx-managed" + + +#################### +# Kolla +#################### +nova_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}" +nova_dev_repos_pull: "{{ kolla_dev_repos_pull }}" +nova_dev_mode: "{{ kolla_dev_mode }}" diff --git a/ansible/roles/nova/handlers/main.yml b/ansible/roles/nova/handlers/main.yml index 747fbe1d3f..1bf939f87d 100644 --- a/ansible/roles/nova/handlers/main.yml +++ b/ansible/roles/nova/handlers/main.yml @@ -156,7 +156,6 @@ or policy_overwriting.changed | bool or nova_conductor_container.changed | bool - - name: Restart nova-consoleauth container vars: service_name: "nova-consoleauth" diff --git a/ansible/roles/nova/tasks/bootstrap_service.yml b/ansible/roles/nova/tasks/bootstrap_service.yml index 1e35579ce6..4728975e85 100644 --- a/ansible/roles/nova/tasks/bootstrap_service.yml +++ b/ansible/roles/nova/tasks/bootstrap_service.yml @@ -15,6 +15,6 @@ BOOTSTRAP: name: "bootstrap_nova" restart_policy: "never" - volumes: "{{ nova_api.volumes }}" + volumes: "{{ nova_api.volumes|reject('equalto', '')|list }}" run_once: True delegate_to: "{{ groups[nova_api.group][0] }}" diff --git a/ansible/roles/nova/tasks/clone.yml b/ansible/roles/nova/tasks/clone.yml new file mode 100644 index 0000000000..28dd6faeef --- /dev/null +++ b/ansible/roles/nova/tasks/clone.yml @@ -0,0 +1,6 @@ +--- +- name: Cloning nova source repository for development + git: + repo: "{{ nova_git_repository }}" + dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}" + update: "{{ nova_dev_repos_pull }}" diff --git a/ansible/roles/nova/tasks/deploy.yml b/ansible/roles/nova/tasks/deploy.yml index 42a2672a5f..968d406754 100644 --- a/ansible/roles/nova/tasks/deploy.yml +++ b/ansible/roles/nova/tasks/deploy.yml @@ -23,6 +23,9 @@ - inventory_hostname in groups['compute'] - nova_compute_virt_type == "xenapi" +- include_tasks: clone.yml + when: nova_dev_mode | bool + - include_tasks: config.yml - include_tasks: config-nova-fake.yml