Browse Source

Merge "Add customized libvirt-guests unit file to properly shutdown instances" into stable/queens

tags/8.4.1
Zuul 1 month ago
parent
commit
0958a9b63d

+ 41
- 0
puppet/services/nova-compute.yaml View File

@@ -372,6 +372,47 @@ outputs:
372 372
             nfs_vers: {get_attr: [RoleParametersValue, value, nfs_vers]}
373 373
           mount: name=/var/lib/nova/instances src="{{nfs_share}}" fstype=nfs4 opts="_netdev,bg,{{nfs_options}},vers={{nfs_vers}},nfsvers={{nfs_vers}}" state=mounted
374 374
           when: nfs_backend_enable|bool
375
+        - name: is Nova Resume Guests State On Host Boot enabled
376
+          set_fact:
377
+            resume_guests_state_on_host_boot_enabled: {get_param: NovaResumeGuestsStateOnHostBoot}
378
+        - name: install libvirt-guests systemd unit file
379
+          when: resume_guests_state_on_host_boot_enabled|bool
380
+          block:
381
+          - name: libvirt-guests unit to stop nova_api container before shutdown VMs
382
+            copy:
383
+              dest: /etc/systemd/system/libvirt-guests.service
384
+              content: |
385
+                [Unit]
386
+                Description=Suspend/Resume Running libvirt Guests
387
+                Requires=virt-guest-shutdown.target
388
+                After=network.target
389
+                After=time-sync.target
390
+                After=virt-guest-shutdown.target
391
+                After=docker.service
392
+                After=paunch-container-shutdown.service
393
+                After=rhel-push-plugin.service
394
+                Documentation=man:libvirtd(8)
395
+                Documentation=https://libvirt.org
396
+
397
+                [Service]
398
+                EnvironmentFile=-/etc/sysconfig/libvirt-guests
399
+                # Hack just call traditional service until we factor
400
+                # out the code
401
+                ExecStart=/usr/libexec/libvirt-guests.sh start
402
+                ExecStop=/bin/docker stop nova_compute
403
+                ExecStop=/usr/libexec/libvirt-guests.sh stop
404
+                Type=oneshot
405
+                RemainAfterExit=yes
406
+                StandardOutput=journal+console
407
+                TimeoutStopSec=0
408
+
409
+                [Install]
410
+                WantedBy=multi-user.target
411
+          - name: libvirt-guests enable VM shutdown on compute reboot/shutdown
412
+            systemd:
413
+              name: libvirt-guests
414
+              enabled: yes
415
+              daemon_reload: yes
375 416
       upgrade_tasks:
376 417
         - name: Stop nova-compute service
377 418
           when: step|int == 1

+ 16
- 0
releasenotes/notes/nova_custom_libvirt-guests_unit-7ac2c4b5511ca549.yaml View File

@@ -0,0 +1,16 @@
1
+---
2
+fixes:
3
+  - |
4
+    Add customized libvirt-guests unit file to properly shutdown instances
5
+
6
+    If resume_guests_state_on_host_boot is set in nova.conf instances
7
+    need to be shutdown using libvirt-guests after nova_compute container
8
+    is shut down. Therefore we need a customized libvirt-guests unit file
9
+    1) removes the dependency to libvirt (non container) that it don't
10
+    get started as a dependency and make the nova_libvirt container to fail.
11
+    2) adds a dependency to docker related services that a shutdown of
12
+    nova_compute container is possible on system reboot.
13
+    3) stops nova_compute container
14
+    4) shutdown VMs
15
+
16
+    This is a missing part of Bug 1778216.

Loading…
Cancel
Save