[systemd-devel] machines get killed when scopes are destroyed

Cole Robinson crobinso at redhat.com
Sat Dec 14 10:14:13 PST 2013


On Mon, Nov 18, 2013 at 03:03:18AM +0100, Zbigniew Jędrzejewski-Szmek wrote:
> v0lZy reported on IRC that his qemu machines get killed when shutting
> down the host. libvirt-guests.service is designed to suspend them
> during shutdown, but when it was run, the guests were all already dead.
>
> And indeed, each qemu is running inside a scope, which is not
> connected by any dependencies to either systemd-machine.service, or
> libvirt-guests.service. libvirt-guests.service does not depend on
> systemd-machine.service either. This means that when shutdown is
> ordered, the scopes will stopped in parallel to other
> libvirt-guests.service, and depending on timing, qemus will be just
> killed with SIGTERM.
>
> For this whole thing to work correctly, we need to ensure that
> scopes are not terminated prematurely. If we introduced a target
> like libvirt-ready.target, and made libvirt-guests.service be
> After=libvirt-ready.target, and made all the scopes be
> Before=libvirt-ready.target, I think the vms would have a chance
> to shutdown properly. But that's pretty complicated.
> And I'm not even sure how to do that properly. Any better
> ideas?

As mentioned downthread, Zbyszek filed:

https://bugzilla.redhat.com/show_bug.cgi?id=1031696

Basically I tried to pass After=libvirt-guests.service to CreateMachine
scope_properties, but I just got an error back. Libvirt diffs are in the bug
report.

Maybe that isn't supposed to work, or makes no sense, or I messed up the
syntax. Or maybe there's a much better solution.

Lennart, any thoughts?

Thanks,
Cole


More information about the systemd-devel mailing list