Create the nova instances directory when need during starting

The /var/lib/nova/instances should be create if it do not exist
during starting nova-compute container. Rather than create it
at the bootstrap service stage.

Change-Id: Ibcc5fb8eec0b38cf2b4313f48d1beb3ba83b1e85
Closes-Bug: #1614970
This commit is contained in:
Jeffrey Zhang 2016-08-19 21:54:28 +08:00 committed by Jeffrey Zhang
parent 755d5172b3
commit 2b741eb870
2 changed files with 1 additions and 37 deletions

View File

@ -18,36 +18,3 @@
- "kolla_logs:/var/log/kolla/"
run_once: True
delegate_to: "{{ groups['nova-api'][0] }}"
- name: Creating nova-compute volume
kolla_docker:
action: "create_volume"
common_options: "{{ docker_common_options }}"
name: "nova_compute"
register: nova_compute_volume
when:
- inventory_hostname in groups['compute']
- not enable_nova_fake | bool
- name: Running Nova compute bootstrap container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
detach: False
environment:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
image: "{{ nova_compute_image_full }}"
labels:
BOOTSTRAP:
name: "bootstrap_nova_compute"
restart_policy: "never"
volumes:
- "{{ node_config_directory }}/nova-compute/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla/"
- "nova_compute:/var/lib/nova/"
when:
- inventory_hostname in groups['compute']
- not enable_nova_fake | bool
- nova_compute_volume.changed

View File

@ -1,8 +1,5 @@
#!/bin/bash
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
if [[ ! -d /var/lib/nova/instances ]]; then
mkdir -p /var/lib/nova/instances
exit 0
fi