Re: [systemd-devel] systemd-218 - Requisite implies TriggeredByRestartOf

2015-05-15 Thread Evert
On 15-05-15 07:05, Andrei Borzenkov wrote:
 В Thu, 14 May 2015 21:23:38 +0200
 Evert пишет:

 Hi,

 According to the systemd documentation, Requisite disallows starting a
 unit unless the specified unit has been started. This seems to work
 fine, however, if the specified unit has been restarted, this unit will
 be started too!
 This is not what should happen and it doesn't happen with a stop and
 start of the specified unit, so clearly, restart behaves different than
 stop followed by start.

 This can easily be reproduced using 2 dummy service units:


 # dummy-1.service:
 [Unit]
 Description=dummy one
 DefaultDependencies=false
 After=local-fs.target
 Before=basic.target

 [Service]
 Type=oneshot
 RemainAfterExit=yes
 ExecStart=/bin/true
 ExecReload=/bin/true
 ExecStop=/bin/true

 [Install]
 WantedBy=sysinit.target multi-user.target
 Also=dummy-2.service


 # dummy-2.service
 [Unit]
 Description=dummy TWO
 DefaultDependencies=no
 After=dummy-1.service
 Before=shutdown.target
 Requisite=dummy-1.service

 [Service]
 Type=oneshot
 RemainAfterExit=no
 ExecStart=/bin/true

 [Install]
 WantedBy=shutdown.target


 # systemctl daemon-reload
 # systemctl enable dummy-1
 Created symlink from
 /etc/systemd/system/sysinit.target.wants/dummy-1.service to
 /etc/systemd/system/dummy-1.service.
 Created symlink from
 /etc/systemd/system/multi-user.target.wants/dummy-1.service to
 /etc/systemd/system/dummy-1.service.
 Created symlink from
 /etc/systemd/system/shutdown.target.wants/dummy-2.service to
 /etc/systemd/system/dummy-2.service.

 In another window I follow the journal which output I pasted after the
 commands I execute:
 # journalctl -f |grep dummy

 # systemctl start dummy-1
 mei 14 19:58:20 joker systemd[1]: Started dummy one.

 # systemctl stop dummy-1
 mei 14 19:58:25 joker systemd[1]: Stopping dummy one...
 mei 14 19:58:25 joker systemd[1]: Stopped dummy one.

 # systemctl start dummy-1
 mei 14 19:58:30 joker systemd[1]: Starting dummy one...
 mei 14 19:58:30 joker systemd[1]: Started dummy one.

 # systemctl restart dummy-1
 mei 14 19:58:34 joker systemd[1]: Stopping dummy one...
 mei 14 19:58:34 joker systemd[1]: Starting dummy one...
 mei 14 19:58:34 joker systemd[1]: Started dummy one.
 mei 14 19:58:34 joker systemd[1]: Starting dummy TWO...
 mei 14 19:58:34 joker systemd[1]: Started dummy TWO.

 # systemctl stop dummy-1
 mei 14 19:58:39 joker systemd[1]: Stopping dummy one...
 mei 14 19:58:39 joker systemd[1]: Stopped dummy one.

 # systemctl restart dummy-1
 mei 14 19:58:43 joker systemd[1]: Starting dummy one...
 mei 14 19:58:43 joker systemd[1]: Started dummy one.
 mei 14 19:58:43 joker systemd[1]: Starting dummy TWO...
 mei 14 19:58:43 joker systemd[1]: Started dummy TWO.

 As you can see, dummy-2 is not triggered by start or stop of dummy-1.
 However, it *is* triggered by restart of dummy-1 (no matter if dummy-1
 has been started or not). Am I missing something here or did I find a bug?

 IMHO restart should be no different than stop ; start and it should
 certainly not trigger a unit which has a Requisite on that unit.

 I do not see it on openSUSE 13.2 with (heavily patched) systemd-210 so
 it appears to be a regression, unless there is some distro-specific
 patch.

 Reverse dependency for Requisite is Required-By and I have feeling it
 had already been discussed.
Distro is Gentoo Linux Stable with kernel 3.18.13 and
sys-apps/systemd-218-r3. The only systemd patch I see in the ebuild is
218-Dont-enable-audit-by-default.patch (journal/journald-audit.c) which
doesn't seem too exciting.

What is your message when you say Reverse dependency for Requisite is
Required-By and I have feeling it
had already been discussed.?

What should I do now? Should I try systemd-219-r2, file a bug or simply
wait until it's fixed?

Evert

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] systemd-218 - Requisite implies TriggeredByRestartOf

2015-05-14 Thread Evert
Hi,

According to the systemd documentation, Requisite disallows starting a
unit unless the specified unit has been started. This seems to work
fine, however, if the specified unit has been restarted, this unit will
be started too!
This is not what should happen and it doesn't happen with a stop and
start of the specified unit, so clearly, restart behaves different than
stop followed by start.

This can easily be reproduced using 2 dummy service units:


# dummy-1.service:
[Unit]
Description=dummy one
DefaultDependencies=false
After=local-fs.target
Before=basic.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecReload=/bin/true
ExecStop=/bin/true

[Install]
WantedBy=sysinit.target multi-user.target
Also=dummy-2.service


# dummy-2.service
[Unit]
Description=dummy TWO
DefaultDependencies=no
After=dummy-1.service
Before=shutdown.target
Requisite=dummy-1.service

[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/bin/true

[Install]
WantedBy=shutdown.target


# systemctl daemon-reload
# systemctl enable dummy-1
Created symlink from
/etc/systemd/system/sysinit.target.wants/dummy-1.service to
/etc/systemd/system/dummy-1.service.
Created symlink from
/etc/systemd/system/multi-user.target.wants/dummy-1.service to
/etc/systemd/system/dummy-1.service.
Created symlink from
/etc/systemd/system/shutdown.target.wants/dummy-2.service to
/etc/systemd/system/dummy-2.service.

In another window I follow the journal which output I pasted after the
commands I execute:
# journalctl -f |grep dummy

# systemctl start dummy-1
mei 14 19:58:20 joker systemd[1]: Started dummy one.

# systemctl stop dummy-1
mei 14 19:58:25 joker systemd[1]: Stopping dummy one...
mei 14 19:58:25 joker systemd[1]: Stopped dummy one.

# systemctl start dummy-1
mei 14 19:58:30 joker systemd[1]: Starting dummy one...
mei 14 19:58:30 joker systemd[1]: Started dummy one.

# systemctl restart dummy-1
mei 14 19:58:34 joker systemd[1]: Stopping dummy one...
mei 14 19:58:34 joker systemd[1]: Starting dummy one...
mei 14 19:58:34 joker systemd[1]: Started dummy one.
mei 14 19:58:34 joker systemd[1]: Starting dummy TWO...
mei 14 19:58:34 joker systemd[1]: Started dummy TWO.

# systemctl stop dummy-1
mei 14 19:58:39 joker systemd[1]: Stopping dummy one...
mei 14 19:58:39 joker systemd[1]: Stopped dummy one.

# systemctl restart dummy-1
mei 14 19:58:43 joker systemd[1]: Starting dummy one...
mei 14 19:58:43 joker systemd[1]: Started dummy one.
mei 14 19:58:43 joker systemd[1]: Starting dummy TWO...
mei 14 19:58:43 joker systemd[1]: Started dummy TWO.

As you can see, dummy-2 is not triggered by start or stop of dummy-1.
However, it *is* triggered by restart of dummy-1 (no matter if dummy-1
has been started or not). Am I missing something here or did I find a bug?

IMHO restart should be no different than stop ; start and it should
certainly not trigger a unit which has a Requisite on that unit.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel