[libvirt] [PATCH v2] logging: Don't inhibit shutdown in system daemon

Martin Kletzander posted 1 patch 5 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/b04fd4b30b0e0bca5d22b9dfc6c4786613e4e4c9.1524738640.git.mkletzan@redhat.com
Test syntax-check passed
src/logging/log_daemon.c | 6 ++++++
1 file changed, 6 insertions(+)
[libvirt] [PATCH v2] logging: Don't inhibit shutdown in system daemon
Posted by Martin Kletzander 5 years, 11 months ago
That is a job of libvirtd and virtlogd has a dependency on it, so that will
prevent it properly.  Doing it one extra time in virtlogd might also cause AVC
denials because it is not allowed to call that dbus method.

Caused by commit df34363d58bb.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
I have an idea how to make this way nicer, but it requires a rework and maybe
people will not like it as much, so for now this is the preferred fix.

v2:
 - Don't revert the shutdown inhibition for all instances, only for the system
   one.

v1:
 - https://www.redhat.com/archives/libvir-list/2018-April/msg02381.html

 src/logging/log_daemon.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 35d7ebb6d2bb..91bd9d0b9052 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -128,6 +128,12 @@ virLogDaemonInhibitor(bool inhibit, void *opaque)
 {
     virLogDaemonPtr dmn = opaque;
 
+    /* virtlogd uses inhibition only to stop session daemon being killed after
+     * the specified timeout, for the system daemon this is taken care of by
+     * libvirtd and the dependencies between the services. */
+    if (virNetDaemonIsPrivileged(dmn->dmn))
+        return;
+
     if (inhibit)
         virNetDaemonAddShutdownInhibition(dmn->dmn);
     else
-- 
2.17.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] logging: Don't inhibit shutdown in system daemon
Posted by Daniel P. Berrangé 5 years, 11 months ago
On Thu, Apr 26, 2018 at 12:32:27PM +0200, Martin Kletzander wrote:
> That is a job of libvirtd and virtlogd has a dependency on it, so that will
> prevent it properly.  Doing it one extra time in virtlogd might also cause AVC
> denials because it is not allowed to call that dbus method.
> 
> Caused by commit df34363d58bb.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1547250
> 
> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> ---
> I have an idea how to make this way nicer, but it requires a rework and maybe
> people will not like it as much, so for now this is the preferred fix.
> 
> v2:
>  - Don't revert the shutdown inhibition for all instances, only for the system
>    one.
> 
> v1:
>  - https://www.redhat.com/archives/libvir-list/2018-April/msg02381.html
> 
>  src/logging/log_daemon.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
> index 35d7ebb6d2bb..91bd9d0b9052 100644
> --- a/src/logging/log_daemon.c
> +++ b/src/logging/log_daemon.c
> @@ -128,6 +128,12 @@ virLogDaemonInhibitor(bool inhibit, void *opaque)
>  {
>      virLogDaemonPtr dmn = opaque;
>  
> +    /* virtlogd uses inhibition only to stop session daemon being killed after
> +     * the specified timeout, for the system daemon this is taken care of by
> +     * libvirtd and the dependencies between the services. */
> +    if (virNetDaemonIsPrivileged(dmn->dmn))
> +        return;
> +
>      if (inhibit)
>          virNetDaemonAddShutdownInhibition(dmn->dmn);
>      else

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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