Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Make NovaResumeGuestsStateOnHostBoot podman compatible
Browse files Browse the repository at this point in the history
With podman therefore are changes required to the libvirt-guests
unit file and how we dealt with dependencies of the containers.
With podman systemd is used to manage the containers which we now
can use for container dependencies and use libvirt-guests from
inside a container.

Change-Id: I2a1f370732effd3303942dd5ec46892ec4a85df9
Closes-Bug: #1830067
  • Loading branch information
stuggi committed May 22, 2019
1 parent 45a94c8 commit 6b0d025
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 4 deletions.
55 changes: 52 additions & 3 deletions deployment/nova/nova-compute-container-puppet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ outputs:
privileged: true
user: nova
restart: always
depends_on: tripleo_nova_libvirt
healthcheck: {get_attr: [ContainersCommon, healthcheck_rpc_port]}
volumes:
list_concat:
Expand Down Expand Up @@ -688,10 +689,17 @@ outputs:
- name: is Nova Resume Guests State On Host Boot enabled
set_fact:
resume_guests_state_on_host_boot_enabled: {get_param: NovaResumeGuestsStateOnHostBoot}
- name: install libvirt-guests systemd unit file
when: resume_guests_state_on_host_boot_enabled|bool
- name: install libvirt-guests systemd unit file (docker)
when:
- resume_guests_state_on_host_boot_enabled|bool
- container_cli == 'docker'
block:
- name: libvirt-guests unit to stop nova_api container before shutdown VMs
- name: make sure libvirt-client is installed
when: resume_guests_state_on_host_boot_enabled|bool
package:
name: libvirt-client
state: present
- name: libvirt-guests unit to stop nova_compute container before shutdown VMs
copy:
dest: /etc/systemd/system/libvirt-guests.service
content: |
Expand Down Expand Up @@ -726,6 +734,47 @@ outputs:
name: libvirt-guests
enabled: yes
daemon_reload: yes
- name: install tripleo_nova_libvirt_guests systemd unit file (podman)
when:
- resume_guests_state_on_host_boot_enabled|bool
- container_cli == 'podman'
block:
- name: make sure default libvirt-guests is disabled
systemd:
name: libvirt-guests
enabled: no
state: stopped
masked: yes
daemon_reload: yes
- name: libvirt-guests unit to stop nova_compute container before shutdown VMs
copy:
dest: /etc/systemd/system/tripleo_nova_libvirt_guests.service
content: |
[Unit]
Description=Suspend libvirt Guests in tripleo
Requires=virt-guest-shutdown.target
After=systemd-machined.service
After=tripleo_nova_libvirt.service
Before=tripleo_nova_compute.service
Documentation=man:libvirtd(8)
Documentation=https://libvirt.org
[Service]
EnvironmentFile=-/etc/sysconfig/libvirt-guests
ExecStart=/usr/bin/podman exec nova_libvirt /bin/rm -f /var/lib/libvirt/libvirt-guests
ExecStop=/usr/bin/podman exec nova_libvirt /bin/sh -x /usr/libexec/libvirt-guests.sh shutdown
Type=oneshot
RemainAfterExit=yes
StandardOutput=journal+console
TimeoutStopSec=0
[Install]
WantedBy=multi-user.target
- name: tripleo_nova_libvirt_guests enable VM shutdown on compute reboot/shutdown
systemd:
name: tripleo_nova_libvirt_guests
enabled: yes
daemon_reload: yes
- name: create persistent directories
file:
path: "{{ item.path }}"
Expand Down
7 changes: 6 additions & 1 deletion deployment/nova/nova-libvirt-container-puppet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ outputs:
list_join:
- "\n"
- - include tripleo::profile::base::nova::libvirt
- include tripleo::profile::base::nova::compute::libvirt_guests
- {get_attr: [MySQLClient, role_data, step_config]}
config_image: {get_param: DockerNovaLibvirtConfigImage}
kolla_config:
Expand Down Expand Up @@ -629,6 +630,8 @@ outputs:
privileged: true
security_opt: label=disable
restart: always
depends_on:
- tripleo_nova_virtlogd
healthcheck:
test: /openstack/healthcheck
volumes:
Expand Down Expand Up @@ -788,11 +791,13 @@ outputs:
failed_when: false
register: libvirt_installed
check_mode: no
- name: make sure libvirt services are disabled
- name: make sure libvirt services are disabled and masked
service:
name: "{{ item }}"
state: stopped
enabled: no
masked: yes
daemon_reload: yes
with_items:
- libvirtd.service
- virtlogd.socket
Expand Down

0 comments on commit 6b0d025

Please sign in to comment.