[systemd-devel] Cannot get Shutdown Script to Run (Libvirt Virtual Machine Shutdown)
Alexander Groleau
awgneo at xbetanet.com
Tue Sep 30 21:09:54 PDT 2014
Thanks for the reply :) The libvirt-guests.service was the very first thing
I had tried. It, however, did absolutely nothing and I believe it to be
broken in arch linux. I have given up on trying to get a shutdown/reboot
script to run for now.
On Tue, Sep 23, 2014 at 5:44 AM, Daniel P. Berrange <berrange at redhat.com>
wrote:
> On Sun, Sep 21, 2014 at 11:40:03PM -0400, Alexander Groleau wrote:
> > Hello systemd users,
> >
> > I have been trying desperately for weeks to get my simple shutdown script
> > for a Libvirt guest to run before libvirtd is shut down, without success.
> > Essentially, I need the libvirt-windows.sh script to run before the
> > libvirtd service is terminated (which occurs right after systemd-logind
> > outputs its reboot message). How can I get my script into this initial
> > section of daemon shutdowns, at the top?
>
> Any reason you've created your own shutdown script instead of using the
> libvirt-guests.service script that libvirt includes ? To get the ordering
> right, we have a number of rules:
>
> - libvirtd.service contains "Before=libvirt-guests.service"
> - libvirt-guests.service contains "After=libvirtd.service"
> - The guest scope unit contain "After=libvirtd.service" and
> "Before=libvirt-guests.service"
>
> It was the two rules aginst the .scope units that we found to be the key
> part to making shutdown work, whereby guests get stopped gracefully before
> the libvirtd daemon is stopped.
>
> The .scope units do not have any file on disk, they are generated on the
> fly as libvirt talks to systemd-machined, so you've no way to alter them
> to work with your custom shutdown script. Thus if you are not using the
> standard libvirt-guests.service, then you should at least use the name
> "libvirt-guests.service" for your own custom service.
>
> Regards,
> Daniel
> --
> |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/
> :|
> |: http://libvirt.org -o- http://virt-manager.org
> :|
> |: http://autobuild.org -o- http://search.cpan.org/~danberr/
> :|
> |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc
> :|
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141001/b4a1d220/attachment.html>
More information about the systemd-devel
mailing list