Bug 1401054
| Summary: | [RFE] Gracefully shutdown Virtual Machines on Host reboot/shutdown. | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Michal Skrivanek <michal.skrivanek> |
| Component: | libvirt | Assignee: | Martin Kletzander <mkletzan> |
| Status: | CLOSED ERRATA | QA Contact: | Fangge Jin <fjin> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.2 | CC: | dfediuck, dyuan, fjin, gordon.stocks, gveitmic, jdenemar, lsurette, mavital, michal.skrivanek, mtessun, nobody, rbalakri, Rhev-m-bugs, sbonazzo, srevivo, xuzhang, ykaul, ylavi |
| Target Milestone: | rc | Keywords: | FutureFeature |
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-2.5.0-1.el7 | Doc Type: | Enhancement |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 1334982 | Environment: | |
| Last Closed: | 2017-08-01 17:19:14 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | Infra | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1334982 | ||
|
Description
Michal Skrivanek
2016-12-02 16:13:00 UTC
I believe this is already implemented upstream by
commit 01079727fe29dfeafac751a07e564e0d6bb53389
Refs: v2.4.0-186-g01079727f
Author: Nikolay Shirokovskiy <nshirokovskiy>
AuthorDate: Fri Oct 14 10:13:48 2016 +0300
Commit: Maxim Nestratov <mnestratov>
CommitDate: Wed Nov 23 11:13:53 2016 +0300
libvirtd: systemd: add special target for system shutdown
It is already discussed in "[RFC] daemon: remove hardcode dep on libvirt-guests" [1].
Mgmt can use means to save/restore domains on system shutdown/boot other than
libvirt-guests.service. Thus we need to specify appropriate ordering dependency between
libvirtd, domains and save/restore service. This patch takes approach suggested
in RFC and introduces a systemd target, so that ordering can be built next way:
libvirtd -> domain -> virt-guest-shutdown.target -> save-restore.service.
This way domains are decoupled from specific shutdown service via intermediate
target.
[1] https://www.redhat.com/archives/libvir-list/2016-September/msg01353.html
In other words, you can just remove libvirt-guests from virt-guest-shutdown.target and put your custom service which will do it your way.
Verify PASS libvirt-3.1.0-2.el7.x86_64 0.# systemctl cat libvirt-guests|grep virt-guest-shutdown Requires=virt-guest-shutdown.target After=virt-guest-shutdown.target 1.virt-guest-shutdown.target is inactive at first. # systemctl status virt-guest-shutdown.target ● virt-guest-shutdown.target - Libvirt guests shutdown Loaded: loaded (/usr/lib/systemd/system/virt-guest-shutdown.target; static; vendor preset: disabled) Active: inactive (dead) since Wed 2017-03-15 05:15:14 EDT; 2s ago 2.# systemctl start libvirt-guests 3.virt-guest-shutdown.target is started along with libvirt-guests. # systemctl status virt-guest-shutdown.target ● virt-guest-shutdown.target - Libvirt guests shutdown Loaded: loaded (/usr/lib/systemd/system/virt-guest-shutdown.target; static; vendor preset: disabled) Active: active since Wed 2017-03-15 05:16:02 EDT; 22s ago 4.# virsh start guest 5.# reboot 6. After host boots up: # ll /var/lib/libvirt/qemu/save/ total 3616 -rw-------. 1 root root 3702094 Mar 15 05:11 guest.save Guest is saved on host shutdown. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2017:1846 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2017:1846 |