[libvirt] [PATCH] libvirt-guests: Weaken dependency on libvirtd

Andrea Bolognani abologna at redhat.com
Tue Oct 11 13:17:07 UTC 2016


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 :(

> 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




More information about the libvir-list mailing list