Skip to content

Commit 57d7ad5

Browse files
authored
Merge pull request #202 from stackhpc/libvirt-on-host
Support running libvirt on the host
2 parents d2753a1 + 1152fc6 commit 57d7ad5

File tree

22 files changed

+360
-120
lines changed

22 files changed

+360
-120
lines changed

ansible/group_vars/all.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ enable_neutron_trunk: "no"
692692
enable_neutron_metering: "no"
693693
enable_neutron_infoblox_ipam_agent: "no"
694694
enable_neutron_port_forwarding: "no"
695+
enable_nova_libvirt_container: "{{ nova_compute_virt_type in ['kvm', 'qemu'] }}"
695696
enable_nova_serialconsole_proxy: "no"
696697
enable_nova_ssh: "yes"
697698
enable_octavia: "no"
@@ -1027,7 +1028,7 @@ nova_backend_ceph: "no"
10271028
nova_backend: "{{ 'rbd' if nova_backend_ceph | bool else 'default' }}"
10281029
# Valid options are [ kvm, qemu, vmware ]
10291030
nova_compute_virt_type: "kvm"
1030-
nova_instance_datadir_volume: "nova_compute"
1031+
nova_instance_datadir_volume: "{{ 'nova_compute' if enable_nova_libvirt_container | bool else '/var/lib/nova' }}"
10311032
nova_safety_upgrade: "no"
10321033
# Valid options are [ none, novnc, spice ]
10331034
nova_console: "novnc"

ansible/nova-libvirt-cleanup.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
- import_playbook: gather-facts.yml
3+
4+
- name: Remove nova_libvirt container
5+
gather_facts: false
6+
hosts:
7+
- compute
8+
serial: '{{ kolla_serial|default("0") }}'
9+
tags:
10+
- nova-libvirt-cleanup
11+
tasks:
12+
- import_role:
13+
name: nova-cell
14+
tasks_from: libvirt-cleanup.yml

ansible/roles/baremetal/defaults/main.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ redhat_pkg_install:
6868
ubuntu_pkg_removals:
6969
- lxd
7070
- lxc
71-
- libvirt-bin
71+
- "{% if enable_nova_libvirt_container | bool %}libvirt-bin{% endif %}"
7272
- open-iscsi
7373
- "{% if enable_chrony | bool %}chrony{% endif %}"
7474

7575
redhat_pkg_removals:
76-
- libvirt
77-
- libvirt-daemon
76+
- "{% if enable_nova_libvirt_container | bool %}libvirt{% endif %}"
77+
- "{% if enable_nova_libvirt_container | bool %}libvirt-daemon{% endif %}"
7878
- iscsi-initiator-utils
7979
- "{% if enable_chrony | bool %}chrony{% endif %}"
8080

@@ -86,3 +86,6 @@ virtualenv:
8686
# directory. This is typically required for modules such as yum and apt which
8787
# are not available on PyPI.
8888
virtualenv_site_packages: True
89+
90+
# Whether to remove the AppArmor libvirt profile on Ubuntu hosts.
91+
apparmor_remove_libvirt_profile: "{{ enable_nova_libvirt_container | bool }}"

ansible/roles/baremetal/tasks/post-install.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -188,29 +188,30 @@
188188
daemon_reload: yes
189189
register: docker_reloaded
190190

191-
- name: Get stat of libvirtd apparmor profile
192-
stat:
193-
path: /etc/apparmor.d/usr.sbin.libvirtd
194-
register: apparmor_libvirtd_profile
195-
when: ansible_facts.distribution == "Ubuntu"
196-
197-
- name: Get stat of libvirtd apparmor disable profile
198-
stat:
199-
path: /etc/apparmor.d/disable/usr.sbin.libvirtd
200-
register: apparmor_libvirtd_disable_profile
201-
when: ansible_facts.distribution == "Ubuntu"
202-
203-
- name: Remove apparmor profile for libvirt
204-
shell: |
205-
apparmor_parser -v -R /etc/apparmor.d/usr.sbin.libvirtd && \
206-
ln -vsf /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable
207-
args:
208-
executable: /bin/bash
209-
become: True
191+
- block:
192+
- name: Get stat of libvirtd apparmor profile
193+
stat:
194+
path: /etc/apparmor.d/usr.sbin.libvirtd
195+
register: apparmor_libvirtd_profile
196+
197+
- name: Get stat of libvirtd apparmor disable profile
198+
stat:
199+
path: /etc/apparmor.d/disable/usr.sbin.libvirtd
200+
register: apparmor_libvirtd_disable_profile
201+
202+
- name: Remove apparmor profile for libvirt
203+
shell: |
204+
apparmor_parser -v -R /etc/apparmor.d/usr.sbin.libvirtd && \
205+
ln -vsf /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable
206+
args:
207+
executable: /bin/bash
208+
become: True
209+
when:
210+
- apparmor_libvirtd_profile.stat.exists
211+
- not apparmor_libvirtd_disable_profile.stat.exists
210212
when:
211213
- ansible_facts.distribution == "Ubuntu"
212-
- apparmor_libvirtd_profile.stat.exists
213-
- not apparmor_libvirtd_disable_profile.stat.exists
214+
- apparmor_remove_libvirt_profile | bool
214215

215216
- name: Get stat of chronyd apparmor profile
216217
stat:

ansible/roles/ceilometer/defaults/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ ceilometer_compute_default_volumes:
7878
- "/run/:/run/:shared"
7979
- "ceilometer:/var/lib/ceilometer/"
8080
- "kolla_logs:/var/log/kolla/"
81-
- "nova_libvirt:/var/lib/libvirt"
81+
- "{{ ceilometer_libvirt_volume }}:/var/lib/libvirt"
8282
- "{{ kolla_dev_repos_directory ~ '/ceilometer/ceilometer:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/ceilometer' if ceilometer_dev_mode | bool else '' }}"
8383
ceilometer_ipmi_default_volumes:
8484
- "{{ node_config_directory }}/ceilometer-ipmi/:{{ container_config_directory }}/:ro"
@@ -94,6 +94,8 @@ ceilometer_central_extra_volumes: "{{ ceilometer_extra_volumes }}"
9494
ceilometer_compute_extra_volumes: "{{ ceilometer_extra_volumes }}"
9595
ceilometer_ipmi_extra_volumes: "{{ ceilometer_extra_volumes }}"
9696

97+
ceilometer_libvirt_volume: "{{ 'nova_libvirt' if enable_nova_libvirt_container | bool else '/var/lib/libvirt' }}"
98+
9799
####################
98100
# OpenStack
99101
####################

ansible/roles/cinder/tasks/external_ceph.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
- Restart {{ item.key }} container
2121

2222
- name: Copy over Ceph keyring files for cinder-volume
23-
copy:
23+
template:
2424
src: "{{ node_custom_config }}/cinder/cinder-volume/{{ ceph_cinder_keyring }}"
2525
dest: "{{ node_config_directory }}/cinder-volume/"
2626
mode: "0660"
@@ -33,7 +33,7 @@
3333
- Restart cinder-volume container
3434

3535
- name: Copy over Ceph keyring files for cinder-backup
36-
copy:
36+
template:
3737
src: "{{ node_custom_config }}/cinder/{{ item }}"
3838
dest: "{{ node_config_directory }}/cinder-backup/"
3939
mode: "0660"

ansible/roles/common/tasks/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
- name: "conf/input/04-openstack-wsgi.conf.j2"
129129
enabled: true
130130
- name: "conf/input/05-libvirt.conf.j2"
131-
enabled: true
131+
enabled: "{{ enable_nova | bool and enable_nova_libvirt_container | bool }}"
132132
- name: "conf/input/06-zookeeper.conf.j2"
133133
enabled: true
134134
- name: "conf/input/07-kafka.conf.j2"
@@ -222,7 +222,7 @@
222222
- { name: "neutron", enabled: "{{ enable_neutron | bool }}" }
223223
- { name: "neutron-tls-proxy", enabled: "{{ neutron_enable_tls_backend | bool }}" }
224224
- { name: "nova", enabled: "{{ enable_nova | bool }}" }
225-
- { name: "nova-libvirt", enabled: "{{ enable_nova | bool and nova_compute_virt_type in ['kvm', 'qemu'] }}" }
225+
- { name: "nova-libvirt", enabled: "{{ enable_nova | bool and enable_nova_libvirt_container | bool }}" }
226226
- { name: "octavia", enabled: "{{ enable_octavia | bool }}" }
227227
- { name: "openvswitch", enabled: "{{ enable_openvswitch | bool }}" }
228228
- { name: "outward-rabbitmq", enabled: "{{ enable_outward_rabbitmq | bool }}" }

ansible/roles/glance/tasks/external_ceph.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- Restart glance-api container
1111

1212
- name: Copy over ceph Glance keyring
13-
copy:
13+
template:
1414
src: "{{ node_custom_config }}/glance/{{ ceph_glance_keyring }}"
1515
dest: "{{ node_config_directory }}/glance-api/{{ ceph_glance_keyring }}"
1616
mode: "0660"

ansible/roles/gnocchi/tasks/external_ceph.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- Restart {{ item }} container
1515

1616
- name: Copy over ceph gnocchi keyring
17-
copy:
17+
template:
1818
src: "{{ node_custom_config }}/gnocchi/{{ ceph_gnocchi_keyring }}"
1919
dest: "{{ node_config_directory }}/{{ item }}/{{ ceph_gnocchi_keyring }}"
2020
mode: "0660"

ansible/roles/manila/tasks/external_ceph.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- Restart manila-share container
1212

1313
- name: Copy over Ceph keyring files for manila
14-
copy:
14+
template:
1515
src: "{{ node_custom_config }}/manila/{{ ceph_manila_keyring }}"
1616
dest: "{{ node_config_directory }}/manila-share/{{ ceph_manila_keyring }}"
1717
mode: "0600"

0 commit comments

Comments
 (0)