Bug 80749

Summary: RFE: NOTIFY_SOCKET ERRNO is not implemented
Product: systemd Reporter: Miguel Angel <majopela>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Proposed patch
systemd status+errno notify test
service definition for the test
systemd status+errno notify test
systemd status+errno notify test
Proposed patch (corrected)
Proposed patch

Description Miguel Angel 2014-07-01 07:46:21 UTC
Description of problem:

  NOTIFY_SOCKET specification of systemd [1] describes the ERRNO argument,
that would allow for passing error numbers for 'systemctl status' return,
but it's not implemented [2],[3]

  I discovered it during the design of this specifications: [4]



   I'm am proposing a new dbus field for this message (ERRNO, along with PID, Code, Status). 

   Initially I thought of using the ExecStatus code, but this is overwritten at final daemon exit.

   Also, I think this message has potential [4] to be used as a complement 
to the status string which can be passed via NOTIFY_SOCKET, but as a 
numeric error when a daemon is having any trouble and running in degraded 
mode. Specially when using some HA solution like pacemaker and we need to notify that the service is degraded, but we don't want to bring the service down to communicate an exit code.


[1] http://www.freedesktop.org/software/systemd/man/sd_notify.html
[2] http://cgit.freedesktop.org/systemd/systemd/tree/src/core/service.c?id=194bbe33382f5365be3865ed1779147cb#n3201
[3] http://cgit.freedesktop.org/systemd/systemd/tree/src/systemctl/systemctl.c?id=194bbe33382f5365be3865ed1779147cb#n2882
[4] http://docs-draft.openstack.org/48/97748/1/check/gate-oslo-specs-docs/c4a464e/doc/build/html/
Comment 1 Miguel Angel 2014-07-01 07:46:49 UTC
Created attachment 102055 [details]
Proposed patch
Comment 2 Miguel Angel 2014-07-01 07:48:23 UTC
Created attachment 102056 [details]
systemd status+errno notify test
Comment 3 Miguel Angel 2014-07-01 07:48:41 UTC
Created attachment 102057 [details]
service definition for the test
Comment 4 Miguel Angel 2014-07-01 07:49:04 UTC
The proposed patch needs some testing on my side yet, that will be done during today.
Comment 5 Miguel Angel 2014-07-03 08:48:52 UTC
Created attachment 102186 [details]
systemd status+errno notify test

Fixed a few missing changes for dbus communication.
Comment 6 Miguel Angel 2014-07-03 08:50:10 UTC
Created attachment 102187 [details]
systemd status+errno notify test
Comment 7 Miguel Angel 2014-07-03 08:50:33 UTC
Created attachment 102188 [details]
Proposed patch (corrected)
Comment 8 Miguel Angel 2014-07-07 11:12:01 UTC
Created attachment 102366 [details] [review]
Proposed patch

Adjusted to add a dbus property as StatusText, but StatusErrno,
and extended the Service struct.
Comment 9 Miguel Angel 2014-07-07 11:12:44 UTC
now it looks like:

# systemctl show test
[...]
StatusText=I'm running, with status 8
StatusErrno=8
[...]
Comment 10 Lennart Poettering 2014-07-07 15:04:51 UTC
Fixed in git! Thanks!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.