Merge "Fix permissions to /var/lib/nova/"

This commit is contained in:
Jenkins 2016-01-21 00:50:01 +00:00 committed by Gerrit Code Review
commit b11421166c
8 changed files with 54 additions and 4 deletions

View File

@ -50,3 +50,32 @@
run_once: True
delegate_to: "{{ groups['nova-api'][0] }}"
when: database_created
- 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: Starting 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 }}"
name: "bootstrap_nova_compute"
restart_policy: "never"
volumes:
- "{{ node_config_directory }}/nova-compute/:{{ container_config_directory }}/:ro"
- "nova_compute:/var/lib/nova/"
when:
- inventory_hostname in groups['compute']
- not enable_nova_fake | bool
- nova_compute_volume.changed

View File

@ -27,7 +27,8 @@
- inventory_hostname in groups['compute']
- include: bootstrap.yml
when: inventory_hostname in groups['nova-api']
when: inventory_hostname in groups['nova-api'] or
inventory_hostname in groups['compute']
- include: start.yml
when: inventory_hostname in groups['compute'] or

View File

@ -10,9 +10,8 @@
volumes:
- "{{ node_config_directory }}/nova-libvirt/:{{ container_config_directory }}/:ro"
- "/lib/modules:/lib/modules:ro"
- "/run:/run"
- "/sys/fs/cgroup:/sys/fs/cgroup"
- "nova_compute:/var/lib/nova/instances"
- "nova_compute:/var/lib/nova/"
- "nova_libvirt:/var/lib/libvirt"
when: inventory_hostname in groups['compute']
@ -100,7 +99,7 @@
- "/lib/modules:/lib/modules:ro"
- "/run:/run"
- "/var/lib/kolla/dev/log:/dev/log"
- "nova_compute:/var/lib/nova/instances"
- "nova_compute:/var/lib/nova/"
- "nova_libvirt:/var/lib/libvirt"
when:
- inventory_hostname in groups['compute']

View File

@ -52,6 +52,10 @@ RUN ln -s nova-base-source/* nova \
&& cp -r /nova/etc/nova/* /etc/nova/ \
&& chown -R nova: /etc/nova /var/log/nova /home/nova /var/lib/nova
COPY nova_sudoers /etc/sudoers.d/nova_sudoers
RUN chmod 750 /etc/sudoers.d \
&& chmod 440 /etc/sudoers.d/nova_sudoers
{% endif %}
RUN usermod -a -G kolla nova

View File

@ -0,0 +1 @@
nova ALL = (root) NOPASSWD: /var/lib/kolla/venv/bin/nova-rootwrap /etc/nova/rootwrap.conf *

View File

@ -50,6 +50,12 @@ RUN /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements
{% endif %}
COPY nova_compute_sudoers /etc/sudoers.d/nova_compute_sudoers
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 755 /usr/local/bin/kolla_extend_start \
&& chmod 750 /etc/sudoers.d \
&& chmod 440 /etc/sudoers.d/nova_compute_sudoers
{{ include_footer }}
USER nova

View File

@ -0,0 +1,9 @@
#!/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
sudo chown nova: /var/lib/nova/
mkdir /var/lib/nova/instances
exit 0
fi

View File

@ -0,0 +1 @@
%kolla ALL=(root) NOPASSWD: /usr/bin/chown nova\: /var/lib/nova/, /bin/chown nova\: /var/lib/nova/