Bug #12721
closedwould like svcadm disable -c
100%
Updated by John Levon over 3 years ago
More than once, we've found a service instance disabled without any clear indication of why, and we've had to play detective based upon the state transition time to have some clue as to who might have made the change and why. It'd be very useful if it was possible to record a reason when explicitly disabling a service. We'll modify svcs to output the reason when suitable (and svccfg export to elide it as part of the enabled state).
The changes I have explicitly don't cover:
- a new version of smf_disable_instance(). The C API doesn't get much use, so it didn't seem worth it. This mostly used by legacy *adm flags to disable a particular service like auditd
- documenting of internal transitions - for example, temporaryil disabling services as part of "svcadm milestone", which is handled by the startd graph
- "svcadm mark maintenance" - this doesn't appear to be much used, and would complicate the lifecycle of the comment property.
- disabling via applying profiles or other mechanisms outside of an explicit "svcadm disable".
- svcadm enable - almost all the time, the enabled state of the service itself, or its dependents, seems sufficient explanation
- inetadm disable - inetd is not of much interest
Updated by Joshua M. Clulow over 3 years ago
For what it's worth, I use the C API for things. I want to finish wrapping it in a high quality Rust crate for future work, too. I can always add more API later but it'd be neat if we could continue to tend that particular garden.
Updated by John Levon over 3 years ago
I tested the C API changes with a small test program that disables a service instance.
I tested all the variations of temporarily/permanently enabled/disabled with/without comment, and checked that the behaviour was correct in terms of svcs -l and svcs -xv reporting of comment and state, and that the comment was cleared / set when necessary.
I checked that temporary disable etc. via svcadm milestone sitll worked OK.
I verified that e.g. rcapadm could disable/enable OK still
Updated by John Levon over 3 years ago
Also tested recursive enable.
Example output:
root@piano:~# svcs -xv coreadm
svc:/system/coreadm:default (system-wide core file configuration)
State: disabled since 12 May 2020 at 10:40:38 UTC
Reason: Disabled by an administrator: comment2
See: http://illumos.org/msg/SMF-8000-05
See: man -M /usr/share/man -s 1M coreadm
Impact: This service is not running.
Updated by Electric Monk over 3 years ago
- % Done changed from 0 to 100
- Status changed from New to Closed
git commit 8fff788790878e3c95666decd46960ecc74c1c69
commit 8fff788790878e3c95666decd46960ecc74c1c69 Author: John Levon <john.levon@joyent.com> Date: 2020-06-03T09:54:39.000Z 12721 would like svcadm disable -c Reviewed by: Jason King <jason.brian.king@gmail.com> Heckling from the gallery by: Joshua M. Clulow <josh@sysmgr.org> Approved by: Dan McDonald <danmcd@joyent.com>