[systemd-devel] [PATCH 1/3] systemctl: check for triggering units before calling StopUnit

Michal Sekletar msekleta at redhat.com
Fri Sep 13 07:46:43 PDT 2013


On Wed, Sep 11, 2013 at 08:04:38PM +0200, Lennart Poettering wrote:
> On Fri, 09.08.13 16:00, Michal Sekletar (msekleta at redhat.com) wrote:
> 
> Heya,

Hi Lennart,

> 
> Hmm, so what I don't really like about this patch is that the stop might
> have caused the triggering units also to go away via some deps. If we
> check the triggers before executing the operations we will never take
> that into account. (Note that so far the trigger message is delayed
> after the job succeeded in order to make sure we can take the full
> a-posteriori state into account).

I understand your point, however I thought that displaying a message before
issuing stop job is better than presenting user with no information in case when
job gets canceled.

> 
> So not sure, Zbigniew, do you have an opinion on this?

I think that Zbigniew's proposal might be the right thing to do here, i.e. we
would leave check for triggers as it is right now, but in case that stop job gets
canceled we would query for triggers anyway and present this information to the
user.

> 
> (Also, Michal, what about the other patches from this series, are they
> still relevant? I amnot sure if you pulled them back or not, the thread
> confused me....)

Second patch was about disallowing to enable template units, arguably there are
still use cases for this as presented by Tom. That makes the patch not
applicable. We need to come up with the scheme how to handle installation of
template units. Tom already proposed some solution in this thread, it'd be great
if you could comment on this.

> 
> Lennart

Michal

> 
> > 
> > >From a62d3668fb2513b1ece827520d44d5b7cd560407 Mon Sep 17 00:00:00 2001
> > From: Michal Sekletar <msekleta at redhat.com>
> > Date: Thu, 8 Aug 2013 13:26:56 +0200
> > Subject: [PATCH 1/3] systemctl: check for triggering units before calling
> >  StopUnit
> > 
> > Rearranging the code in a way that we always check for triggers before
> > we issue StopUnit D-Bus call. This will make behavior consistent,
> > because triggers are always checked.
> > 
> > https://bugzilla.redhat.com/show_bug.cgi?id=908690
> > ---
> >  src/systemctl/systemctl.c | 20 ++++++++++----------
> >  1 file changed, 10 insertions(+), 10 deletions(-)
> > 
> > diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
> > index 8ec1824..ee47841 100644
> > --- a/src/systemctl/systemctl.c
> > +++ b/src/systemctl/systemctl.c
> > @@ -1980,6 +1980,16 @@ static int start_unit(DBusConnection *bus, char **args) {
> >                          return log_oom();
> >          }
> >  
> > +        /* When stopping units, warn if they can still be triggered by
> > +         * another active unit (socket, path, timer) */
> > +        if (!arg_quiet && streq(method, "StopUnit")) {
> > +                if (one_name)
> > +                        check_triggering_units(bus, one_name);
> > +                else
> > +                        STRV_FOREACH(name, args+1)
> > +                                check_triggering_units(bus, *name);
> > +        }
> > +
> >          if (one_name) {
> >                  ret = start_unit_one(bus, method, one_name, mode, &error, s);
> >                  if (ret < 0)
> > @@ -1998,16 +2008,6 @@ static int start_unit(DBusConnection *bus, char **args) {
> >                  r = wait_for_jobs(bus, s);
> >                  if (r < 0)
> >                          return r;
> > -
> > -                /* When stopping units, warn if they can still be triggered by
> > -                 * another active unit (socket, path, timer) */
> > -                if (!arg_quiet && streq(method, "StopUnit")) {
> > -                        if (one_name)
> > -                                check_triggering_units(bus, one_name);
> > -                        else
> > -                                STRV_FOREACH(name, args+1)
> > -                                        check_triggering_units(bus, *name);
> > -                }
> >          }
> >  
> >          return ret;
> 
> 
> Lennart
> 
> -- 
> Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list