[libvirt] [PATCH] libvirtd: Explicit dependency on systemd-machined

Michal Koutný posted 1 patch 6 years, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180110220641.23203-1-mkoutny@suse.com
daemon/libvirtd.service.in | 2 ++
1 file changed, 2 insertions(+)
[libvirt] [PATCH] libvirtd: Explicit dependency on systemd-machined
Posted by Michal Koutný 6 years, 3 months ago
The libvirtd daemon uses systemd-machined D-Bus API when manipulating
domains. The systemd-machined is D-Bus activated on demand.

However, during system shutdown systemd-machined is stopped concurrently
with libvirtd and virsh users also doing their final cleanup may
transitively fail due to unavailability of systemd-machined. Example
error message

> libvirtd[1390]: 2017-12-20 18:55:56.182+0000: 32700: error : virSystemdTerminateMachine:503 : Refusing activation, D-Bus is shutting down.

To circumvent this we need to explicitly specify both ordering and
requirement dependency (to avoid late D-Bus activation) on
systemd-machined. See [1] for the dependency debate.

[1] https://lists.freedesktop.org/archives/systemd-devel/2018-January/040095.html
---

The Wants= dependency is for the case when systemd-machined wasn't started
neither D-Bus activated anytime before the shutdown transaction. AFAICS this is
very unlikely so for the sake of lazy activation, the Wants= hunk can be
dropped.

 daemon/libvirtd.service.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
index c189f5e65..769702ea7 100644
--- a/daemon/libvirtd.service.in
+++ b/daemon/libvirtd.service.in
@@ -7,6 +7,7 @@
 Description=Virtualization daemon
 Requires=virtlogd.socket
 Requires=virtlockd.socket
+Wants=systemd-machined.service
 Before=libvirt-guests.service
 After=network.target
 After=dbus.service
@@ -14,6 +15,7 @@ After=iscsid.service
 After=apparmor.service
 After=local-fs.target
 After=remote-fs.target
+After=systemd-machined.service
 Documentation=man:libvirtd(8)
 Documentation=https://libvirt.org
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] libvirtd: Explicit dependency on systemd-machined
Posted by Michal Koutný 6 years, 3 months ago
Hello list.

On 01/10/2018 11:06 PM, Michal Koutný  wrote:
> [...]
I see there's no response to the patch. Do you have any comments on this
patch?

Thanks,
Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] libvirtd: Explicit dependency on systemd-machined
Posted by Cedric Bosdonnat 6 years, 3 months ago
The patch looks good to me, though I'm not a systemd expert.
If no one vetoes it I'll push your patch by the end of the day.

--
Cedric

On Mon, 2018-01-22 at 09:10 +0100, Michal Koutný wrote:
> Hello list.
> 
> On 01/10/2018 11:06 PM, Michal Koutný  wrote:
> > [...]
> 
> I see there's no response to the patch. Do you have any comments on this
> patch?
> 
> Thanks,
> Michal
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] libvirtd: Explicit dependency on systemd-machined
Posted by Michal Privoznik 6 years, 3 months ago
On 01/22/2018 11:10 AM, Cedric Bosdonnat wrote:
> The patch looks good to me, though I'm not a systemd expert.
> If no one vetoes it I'll push your patch by the end of the day.

Yup ACK.

Sorry, I had this marked for review but got buried under some other
stuff. Cedric feel free to push and don't forget to congratulate Michal
on this first contribution ;-)

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] libvirtd: Explicit dependency on systemd-machined
Posted by Cedric Bosdonnat 6 years, 3 months ago
It's now pushed!
Thanks a lot Michal for your contribution, feel free to submit other ones in the future ;)

--
Cedric

On Wed, 2018-01-10 at 23:06 +0100, Michal Koutný wrote:
> The libvirtd daemon uses systemd-machined D-Bus API when manipulating
> domains. The systemd-machined is D-Bus activated on demand.
> 
> However, during system shutdown systemd-machined is stopped concurrently
> with libvirtd and virsh users also doing their final cleanup may
> transitively fail due to unavailability of systemd-machined. Example
> error message
> 
> > libvirtd[1390]: 2017-12-20 18:55:56.182+0000: 32700: error : virSystemdTerminateMachine:503 : Refusing activation,
> > D-Bus is shutting down.
> 
> To circumvent this we need to explicitly specify both ordering and
> requirement dependency (to avoid late D-Bus activation) on
> systemd-machined. See [1] for the dependency debate.
> 
> [1] https://lists.freedesktop.org/archives/systemd-devel/2018-January/040095.html
> ---
> 
> The Wants= dependency is for the case when systemd-machined wasn't started
> neither D-Bus activated anytime before the shutdown transaction. AFAICS this is
> very unlikely so for the sake of lazy activation, the Wants= hunk can be
> dropped.
> 
>  daemon/libvirtd.service.in | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
> index c189f5e65..769702ea7 100644
> --- a/daemon/libvirtd.service.in
> +++ b/daemon/libvirtd.service.in
> @@ -7,6 +7,7 @@
>  Description=Virtualization daemon
>  Requires=virtlogd.socket
>  Requires=virtlockd.socket
> +Wants=systemd-machined.service
>  Before=libvirt-guests.service
>  After=network.target
>  After=dbus.service
> @@ -14,6 +15,7 @@ After=iscsid.service
>  After=apparmor.service
>  After=local-fs.target
>  After=remote-fs.target
> +After=systemd-machined.service
>  Documentation=man:libvirtd(8)
>  Documentation=https://libvirt.org
>  

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