BACKGROUND Effort to port ovirt-engine to other distributions, such as upstart based and OpenRC based. CURRENT IMPLEMENTATION Custom python script to be used directly by sysvinit and systemd. The script is complex as: 1. it expects be executed by root and fallback to correct engine account. 2. it forks into the background always, while downstream services such as upstart and systemd do not require that. 3. it exec() the java process (jboss) without waiting for it to exit, so it does not cleanup after execution. 4. it does not conform with other services when start and pid is not cleaned (bug#838527) 5. it cannot be fully used for development mode. 6. it implements its own daemon implementation, while python-daemon is available. 7. it parsed its own command-line parameters. 8. it did not use standard python logging module, but direct calls to syslog. 9. it used global variables, which in python are very complex to use. NEW IMPLEMENTATION Use downstream services for maximum compatibility with distributions: 1. Execute as non privileged user 2. Set rlimit resources. 3. Remove the stop and status from the service code, as downstream services provide that. 4. Handle pid file only on downstreams that requires that, align with behavior of other services. 5. Wait for java process to exit in order to cleanup tmp, pid file and exit cleanly to downstream services. 6. Add foreground mode, add pid file-less mode, Cleanup service packaging. Cleanup service build. Major cleanup of service code (95% rewrite). Added extensive logs and debug, added an option to debug messages. Added support to gettext to allow localization. METHOD To ease review the work was split into evolution type of patches, don't be alarmed from the number of patches.
packaging: service: do not use users from configuration if non-root
packaging: service: only verify engine user owned directories owner In development mode directories will not be owned by root.
packaging: engine-service: recover from corrupted pid file The case in which pidfile is empty is common.
packaging: engine-service: remove limits.d file the limits.d file is not used as service applies rlimit on its own.
packaging: engine-service: allow service user customization
packaging: engine-service: use python daemon instead of own implementation
packaging: engine-service: rework start pid file handling There is no reason to force user to explicit stop and start the service in case pid file contains non running process. Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=838527 Change-Id: I8d8a7f8f8b7f5941f447df3d279686b973b5c393 Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: add options for wrappers In order to be used at other environments, with their own init.d layout, Add: --quiet --pidfile --foreground Change-Id: I00d868fc51ec73800cae2eb24002feb933744851 Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: downstream infrastructure usage Use features of downstream instead our own implementation. systemd 1. detach from controlling terminal. 2. Change user/group. 3. stop service using signal. 4. set rlimit. sysv 1. Change user/group. 2. stop service by pidfile. 3. set rlimit systemd note: As jboss return non zero error code when receiving SIGTERM, and systemd expect processes to terminate with zero error code, we create a wrapper over the java. Change-Id: Ie02f0d44bbba7d1a7af6bcf6b808610e85b907c6 Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: remove dead code Change-Id: Id520a0ff33e797b2995fb217754605c219f6a922 Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: set default service mode to foreground this will ease developer when executing the service. Change-Id: Ib7e5ffe4e104d2c3a0c931f3f344f7c3c12eb57f Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: remove /usr/bin symlink The engine-service script is not a utility to be used by user but by downstream packager, hence no reason to install at /usr/bin. Change-Id: I49fc25ad586b8f04e1588d04ab772858f2bfd169 Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: do not allow execution as non-root all downstream has a mean to execute the script under the correct account. So no need for us to change identity nor expect other user. Change-Id: Ic30ce5316918a98bf2ef4cbf17d0eb91b85c74d1 Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: do not clean environment the init system may put important variables in environment. add LC_ALL as java is effected by AC_CTYPE per defaults of string conversions, as if it is set by init it will effect us. in practice we should only set LC_CTYPE or use jnu.encoding, when we are sure that no default locale is used for conversions within application. Change-Id: Ia8231b343574df83e65c55d9ffa75698a3f2d692 Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: remove unused tmpfiles config Change-Id: I81175c21f018be180157ffcaadef1dd28ee8801c Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: move service to backend subpackage Change-Id: I3df9c0f0d221d883c7a49b0c7f953a2ffde211c0 Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: major cleanup Last patch in series of engine-service, after all core issues merged into existing implementation, this introduce python only rework and cleanups. 1. Removal global variable. 2. Previous patch already use python subprocess instead of direct exec. 3. Use python logging instead of direct syslog calls. 4. Add debug log. 5. Add debug parameter. 6. Add gettext support. 7. Modular functional. 8. Remove one time used variables. 9. Remove replication of configuration variable into local variables. 10. Remove dead code. 11. pyflakes free 12. pep8 complaint. Change-Id: Iea45e8131190f41171e937699ec2e261939c4bd9 Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: fix systemd packaging per fedora requirements Change-Id: I84d290d2cc389450be183cd85fb91ee1e58e4e9a Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: clean /var/tmp in upgrade and cleanup previous service implementation used mixed ownership of root/ovirt in /var/tmp/ovirt-engine, /var/lib/ovirt-engine/deployments. the /var/tmp/ovirt-engine was not cleared if daemon exited so likely to remain. new service implementation does not run under root account, so having root owned resources is not healthy. during upgrade setup correct setting, during setup remove leftovers, as engine-cleanup not to be trusted as it does not actually revert to initial state. Change-Id: If0efa0b8a71673140490e2c363af7d3ba6044ffe Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: cleanup: merge check for running process Change-Id: I20238c634c418029c669bdf2b4b77e329b39faa1 Signed-off-by: Alon Bar-Lev <alonbl>
Modified per future rebase.
packaging: engine-service: move service out of fedora into own directory service is working in fedora, rhel, cenots, gentoo, ubuntu. service resources are installed at one directory at target, reorder filesystem structure within source tree to be similar. Change-Id: I38c2653509795ae04c190c4a84f00f53410fa983 Signed-off-by: Alon Bar-Lev <alonbl>
packaging: engine-service: split service to allow code reuse this will allow to reuse effort to implement other services. Change-Id: Ie912a502f220417e72efbd2f5b87c5674525f79b Signed-off-by: Alon Bar-Lev <alonbl>
Got need-info but I cannot see this in bug. How to test this is drop-in replacement using re-implementation using downstream services. existing tests should be sufficient.
thanks. ACKed
Verified on is3: [root@istein-33 ~]# service ovirt-engine status (pid 27342) is running... [root@istein-33 ~]# service ovirt-engine stop Stopping oVirt Engine: [ OK ] [root@istein-33 ~]# service ovirt-engine start Starting oVirt Engine: [ OK ] [root@istein-33 ~]# service ovirt-engine status (pid 21751) is running... [root@istein-33 ~]# kill -9 21751 [root@istein-33 ~]# service ovirt-engine status dead but pid file exists
This bug is currently attached to errata RHEA-2013:15231. If this change is not to be documented in the text for this errata please either remove it from the errata, set the requires_doc_text flag to minus (-), or leave a "Doc Text" value of "--no tech note required" if you do not have permission to alter the flag. Otherwise to aid in the development of relevant and accurate release documentation, please fill out the "Doc Text" field above with these four (4) pieces of information: * Cause: What actions or circumstances cause this bug to present. * Consequence: What happens when the bug presents. * Fix: What was done to fix the bug. * Result: What now happens when the actions or circumstances above occur. (NB: this is not the same as 'the bug doesn't present anymore') Once filled out, please set the "Doc Type" field to the appropriate value for the type of change made and submit your edits to the bug. For further details on the Cause, Consequence, Fix, Result format please refer to: https://bugzilla.redhat.com/page.cgi?id=fields.html#cf_release_notes Thanks in advance.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2014-0038.html