[arch-general] libvirtd - save shutdown and systemd
Hey all, I'm pretty sure this is a fairly basic question, but i am a bit confused on systemd targets. It has been a while since i converted my systems to systemd and most of it seems to be working ok. Now i am looking for a way to automatically save my VM's to disk in case i forget to shutdown/save one before shutting down the host. After some searching, i stumbled upon this in man systemd-halt.service: " Immediately before executing the actual system halt/poweroff/reboot/kexec systemd-shutdown will run all executables in /usr/lib/systemd/system-shutdown/ and pass one arguments to them: either "halt", "poweroff", "reboot" or "kexec", depending on the chosen action. All executables in this directory are executed in parallel, and execution of the action is not continued before all executables finished. " So at least one way would be place a script that calls "/etc/rc.d/libvirtd-guests stop" (or equivalent, it's not hard to replace) in /etc/systemd/system-shutdown/ . My main question is if this would be a "correct" way or that i could better write some custom unit file to do this? The tricky part is that i am /not/ interested in an automatic resume of previously running guests, only saving them in case i forgot. I'd be very interested in hearing opinions. mvg, Guus
On Wed, May 8, 2013 at 5:52 PM, Guus Snijders <gsnijders@gmail.com> wrote:
So at least one way would be place a script that calls "/etc/rc.d/libvirtd-guests stop" (or equivalent, it's not hard to replace) in /etc/systemd/system-shutdown/ . My main question is if this would be a "correct" way or that i could better write some custom unit file to do this? The tricky part is that i am /not/ interested in an automatic resume of previously running guests, only saving them in case i forgot.
I'm not sure if it's of any help, but there is already a /lib/systemd/system/libvirt-guests.service unit that calls /etc/rc.d/libvirtd-guests. =-Jameson
Op 13 mei 2013 21:12 schreef "Jameson" <imntreal@gmail.com> het volgende:
On Wed, May 8, 2013 at 5:52 PM, Guus Snijders <gsnijders@gmail.com> wrote:
So at least one way would be place a script that calls "/etc/rc.d/libvirtd-guests stop" (or equivalent, it's not hard to
in /etc/systemd/system-shutdown/ . My main question is if this would be a "correct" way or that i could better write some custom unit file to do
replace) this?
The tricky part is that i am /not/ interested in an automatic resume of previously running guests, only saving them in case i forgot.
I'm not sure if it's of any help, but there is already a /lib/systemd/system/libvirt-guests.service unit that calls /etc/rc.d/libvirtd-guests.
Thanks, but my main question how i can best enable that service on shutdown/reboot etc scenarios. I prefer to not have enabled on startup (if possible). Mvg, Guus
On Tue, May 14, 2013 at 6:48 AM, Guus Snijders <gsnijders@gmail.com> wrote:
Op 13 mei 2013 21:12 schreef "Jameson" <imntreal@gmail.com> het volgende:
On Wed, May 8, 2013 at 5:52 PM, Guus Snijders <gsnijders@gmail.com> wrote:
So at least one way would be place a script that calls "/etc/rc.d/libvirtd-guests stop" (or equivalent, it's not hard to
in /etc/systemd/system-shutdown/ . My main question is if this would be a "correct" way or that i could better write some custom unit file to do
replace) this?
The tricky part is that i am /not/ interested in an automatic resume of previously running guests, only saving them in case i forgot.
I'm not sure if it's of any help, but there is already a /lib/systemd/system/libvirt-guests.service unit that calls /etc/rc.d/libvirtd-guests.
Thanks, but my main question how i can best enable that service on shutdown/reboot etc scenarios. I prefer to not have enabled on startup (if possible).
I think your best bet would be to copy that unit to /etc/systemd/system, and change the After line to look something like Before=shutdown.target reboot.target. Then in theory if you start that unit, it should call /etc/rc.d/libvirtd-guests stop before a shutdown or reboot. In theory. :) =-Jameson
participants (2)
-
Guus Snijders
-
Jameson