On Tue, Oct 11, 2016 at 03:17:07PM +0200, Andrea Bolognani wrote:
On Mon, 2016-10-10 at 15:59 +0200, Martin Kletzander wrote:
On Fri, Oct 07, 2016 at 10:19:53AM +0200, Andrea Bolognani wrote:
> 
> The Requires relationship is very strong, in that it prevents
> a unit from running unless all the units it Requires are
> running as well.
> 
> This turns out to be a problem because we want to be able to
> restart libvirtd at any time without having libvirt-guests
> suspend or shutdown running guests.
> 
> Turn the Requires relationship into a Wants relationship:
> this way starting libvirt-guests will cause systemd to (attempt
> to) start libvirtd as well, but stopping or restarting libvirtd
> will not alter libvirt-guests' running state.
 
I can't figure out how exactly this works, even when looking at the
systemd.unit documentation.  You are saying that Wants= means that if
you issue 'service libvirtd stop'

You mean

  systemctl stop libvirtd

Unless distributions have converted service(8) into a wrapper
for systemctl(1)... Oh, it looks like at least Fedora and
Debian have. Makes sense :)

it will not save your guests after
this patch.

Correct. If B Requires=A and A becomes unavailable, B will be
stopped as well; the same doesn't happen if B merely Wants=A.

What if you stop the service and then shutdown the machine?
I would agree that it's your fault if it doesn't save your guests.

It would be super neat if we could stop libvirt-guests when
stopping libvirtd, so that guests are saved properly, but not
stop it when libvirtd is merely being restarted.

Unfortunately systemd doesn't allow that level of granularity,
so we're basically forced to choose between two partially
unsatisfying solutions :(


Sometimes you don't even want that.  Maybe systemd could add yet another
new thing that would mean this service needs this other service when it
is being stopped or started, but not in between.  And also this service
should change state when starting or shutting down only... and bunch of
others.  Until that we'll always have bunch of workarounds anyway.

From
what I am reading, it makes sense, so ACK from me.  Basically because I
can't come up with scenarios that could be broken by this change =)

I will wait a while before pushing it, so other people can
have a chance to weigh in.

In the meantime, thanks for the review! :)

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to