openais: add systemd support and several fixes
cover openais: add systemd support and several fixes
From: Jackie Huang <[email protected]>
--
The following changes since commit c0afa706e9cdb650c0e8bb79f503743632350b00:
core-image-cgl: Remove ROOTFS_PKGMANAGE_BOOTSTRAP (2017-05-24 14:19:13 +0200)
are available in the git repository at:
https://github.com/jackiehjm/meta-cgl.git jhuang0/up_openais_170526_0
https://github.com//tree/jhuang0/up_openais_170526_0
Jackie Huang (5):
openais: add systemd support
openais: correct the use of proc name in init script
openais: fix saTmrTimerReschedule test error
openais: fix corosync not quit
openais: remove cleanup entry from openais
.../files/openais-fix-corosync-not-quit.patch | 53 ++++++++++++++++++++++ .../openais/files/openais-fix-init-script.patch | 42 +++++++++++++++++ .../files/openais-fix-resource-cleanup-entry.patch | 37 +++++++++++++++ .../openais-saTmrTimerReschedule-test-error.patch | 50 ++++++++++++++++++++ .../recipes-cgl/openais/files/openais.service | 14 ++++++ .../recipes-cgl/openais/openais_1.1.4.bb | 21 ++++++++- 6 files changed, 215 insertions(+), 2 deletions(-) create mode 100644 meta-cgl-common/recipes-cgl/openais/files/openais-fix-corosync-not-quit.patch create mode 100644 meta-cgl-common/recipes-cgl/openais/files/openais-fix-init-script.patch create mode 100644 meta-cgl-common/recipes-cgl/openais/files/openais-fix-resource-cleanup-entry.patch create mode 100644 meta-cgl-common/recipes-cgl/openais/files/openais-saTmrTimerReschedule-test-error.patch create mode 100644 meta-cgl-common/recipes-cgl/openais/files/openais.service
Signature · 1 line
2.11.0
PATCH 1/5 openais: add systemd support
From: Jackie Huang <[email protected]>
inherit systemd and add .service for systemd support
--- .../recipes-cgl/openais/files/openais.service | 14 ++++++++++++++ meta-cgl-common/recipes-cgl/openais/openais_1.1.4.bb | 17 +++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 meta-cgl-common/recipes-cgl/openais/files/openais.service
meta-cgl-common/recipes-cgl/openais/files/openais.service new file +14 -0
@@ -0,0 +1,14 @@ +[Unit] +Description=OpenAIS Cluster Framework +ConditionKernelCommandLine=!nocluster +Requires=network-online.target +After=network-online.target + +[Service] +ExecStart=@DATADIR@/openais/openais start +ExecStop=@DATADIR@/openais/openais stop +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target
meta-cgl-common/recipes-cgl/openais/openais_1.1.4.bb +15 -2
@@ -9,10 +9,23 @@ SRC_URI = " \ file://fix-lcrso-linkage.patch \ file://build-cleanup-configure-ac.patch \ file://openais-fix-bash.patch \ - " + file://openais.service \ + " + SRC_URI[md5sum] = "e500ad3c49fdc45d8653f864e80ed82c" SRC_URI[sha256sum] = "974b4959f3c401c16156dab31e65a6d45bbf84dd85a88c2a362712e738c06934" -inherit autotools pkgconfig +inherit autotools pkgconfig systemd + +SYSTEMD_SERVICE_${PN} = "openais.service" +SYSTEMD_AUTO_ENABLE = "disable" + +do_install_append() { + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -D -m 0755 ${D}${sysconfdir}/init.d/openais ${D}${datadir}/${BPN}/openais + install -D -m 0644 ${WORKDIR}/openais.service ${D}${systemd_system_unitdir}/openais.service + sed -i -e 's,@DATADIR@,${datadir},g' ${D}${systemd_system_unitdir}/openais.service + fi +} FILES_${PN}-dbg += "${libexecdir}/lcrso/.debug"
Signature · 1 line
2.11.0
PATCH 2/5 openais: correct the use of proc name in init script
In reply to [email protected]From: Jackie Huang <[email protected]>
openais actually runs on top of corosync. The init script was checking for the pid of "openais" rather than checking for corosync's pid.
--- .../openais/files/openais-fix-init-script.patch | 42 ++++++++++++++++++++++ .../recipes-cgl/openais/openais_1.1.4.bb | 1 + 2 files changed, 43 insertions(+) create mode 100644 meta-cgl-common/recipes-cgl/openais/files/openais-fix-init-script.patch
meta-cgl-common/recipes-cgl/openais/files/openais-fix-init-script.patch new file +42 -0
@@ -0,0 +1,42 @@ +commit 367f4ab0b67266e07ffedcae2df74f2576ea2aeb +Author: Aws Ismail <[email protected]> +Date: Thu Jan 24 12:36:48 2013 -0500 + + openais: correct the use of proc name in init script + + openais actually runs on top of corosync. The init + script was checking for the pid of "openais" + rather than checking for corosync's pid. + + Upstream-Status: Pending + + Signed-off-by: Aws Ismail <[email protected]> + +diff --git a/init/generic.in b/init/generic.in +index ac63a5f..e8efbb3 100644 +--- a/init/generic.in ++++ b/init/generic.in +@@ -46,7 +46,7 @@ status() + if [ $rtrn -ne 0 ]; then + echo "$1 is stopped" + else +- echo "$1 (pid $pid) is running..." ++ echo "$1 ($proc with pid $pid) is running..." + fi + return $rtrn + } +@@ -130,12 +130,12 @@ restart|reload|force-reload) + restart + ;; + condrestart|try-restart) +- if status $prog > /dev/null 2>&1; then ++ if status $proc > /dev/null 2>&1; then + restart + fi + ;; + status) +- status $prog ++ status $proc + rtrn=$? + ;; + stop)
meta-cgl-common/recipes-cgl/openais/openais_1.1.4.bb +1 -0
@@ -9,6 +9,7 @@ SRC_URI = " \ file://fix-lcrso-linkage.patch \ file://build-cleanup-configure-ac.patch \ file://openais-fix-bash.patch \ + file://openais-fix-init-script.patch \ file://openais.service \ "
Signature · 1 line
2.11.0
PATCH 3/5 openais: fix saTmrTimerReschedule test error
In reply to [email protected]From: Jackie Huang <[email protected]>
* If req_lib_tmr_timerreschedule->timer_attributes.type is SA_TIME_ABSOLUTE, an absolute time value must be higher than the current absolute time.According to the type, we will compare the current time with an absolute time. If the type is SA_TIME_ABSOLUTE, we will compare. Or else, we do nothing;
* For single-event timers, timerPeriodDuration = 0 is required. Note that saTmrTimerReschedule() cannot be used to change a timer from being a single-event timer to a periodic timer or vice versa. Since the older timerPeriodDuration is 0 in testtmr.c file, it is a single-event timer. The following reschedule will change it to a periodic timer. It is not permitted.
--- .../openais-saTmrTimerReschedule-test-error.patch | 50 ++++++++++++++++++++++ .../recipes-cgl/openais/openais_1.1.4.bb | 1 + 2 files changed, 51 insertions(+) create mode 100644 meta-cgl-common/recipes-cgl/openais/files/openais-saTmrTimerReschedule-test-error.patch
meta-cgl-common/recipes-cgl/openais/files/openais-saTmrTimerReschedule-test-error.patch new file +50 -0
@@ -0,0 +1,50 @@ +commit 379eb121110d22131408cedf2f200165d142852c +Author: yanjun.zhu <[email protected]> +Date: Fri Mar 1 12:25:33 2013 +0800 + + openais: fix saTmrTimerReschedule test error + + * If req_lib_tmr_timerreschedule->timer_attributes.type is + SA_TIME_ABSOLUTE, an absolute time value must be higher + than the current absolute time.According to the type, we + will compare the current time with an absolute time. If + the type is SA_TIME_ABSOLUTE, we will compare. Or else, + we do nothing; + * For single-event timers, timerPeriodDuration = 0 is required. + Note that saTmrTimerReschedule() cannot be used to change a + timer from being a single-event timer to a periodic timer or + vice versa. Since the older timerPeriodDuration is 0 in testtmr.c + file, it is a single-event timer. The following reschedule will + change it to a periodic timer. It is not permitted. + + Upstream-Status: Pending + + Signed-off-by: yanjun.zhu <[email protected]> +-- +diff -urpN a/services/tmr.c b/services/tmr.c +--- a/services/tmr.c ++++ b/services/tmr.c +@@ -442,7 +442,8 @@ static void message_handler_req_lib_tmr_ + + current_time = (SaTimeT)(api->timer_time_get()); + +- if (current_time > req_lib_tmr_timerreschedule->timer_attributes.initialExpirationTime) { ++ if ((SA_TIME_ABSOLUTE == req_lib_tmr_timerreschedule->timer_attributes.type) && ++ (current_time > req_lib_tmr_timerreschedule->timer_attributes.initialExpirationTime)) { + error = SA_AIS_ERR_INVALID_PARAM; + goto error_put; + } +diff -urpN a/test/testtmr.c b/test/testtmr.c +--- a/test/testtmr.c ++++ b/test/testtmr.c +@@ -86,8 +86,8 @@ int main (void) + SaTmrHandleT handle; + SaSelectionObjectT select_obj; + SaTmrTimerAttributesT attrs; +- SaTmrTimerAttributesT attrs_a = { SA_TIME_DURATION, TMR_30_SECONDS, 0 }; +- SaTmrTimerAttributesT attrs_b = { SA_TIME_DURATION, TMR_30_SECONDS, 0 }; ++ SaTmrTimerAttributesT attrs_a = { SA_TIME_DURATION, TMR_30_SECONDS, TMR_30_SECONDS }; ++ SaTmrTimerAttributesT attrs_b = { SA_TIME_DURATION, TMR_30_SECONDS, TMR_30_SECONDS }; + SaTmrTimerAttributesT new_attrs_a = { SA_TIME_DURATION, TMR_10_SECONDS, TMR_10_SECONDS }; + SaTmrTimerAttributesT new_attrs_b = { SA_TIME_DURATION, TMR_20_SECONDS, TMR_20_SECONDS }; + SaTmrTimerIdT id_a;
meta-cgl-common/recipes-cgl/openais/openais_1.1.4.bb +1 -0
@@ -10,6 +10,7 @@ SRC_URI = " \ file://build-cleanup-configure-ac.patch \ file://openais-fix-bash.patch \ file://openais-fix-init-script.patch \ + file://openais-saTmrTimerReschedule-test-error.patch \ file://openais.service \ "
Signature · 1 line
2.11.0
PATCH 4/5 openais: fix corosync not quit
In reply to [email protected]From: Jackie Huang <[email protected]>
On some targets, "/etc/init.d/openais stop" can not make corosync quit since corosync does not respond to signal TERM.
--- .../files/openais-fix-corosync-not-quit.patch | 53 ++++++++++++++++++++++ .../recipes-cgl/openais/openais_1.1.4.bb | 1 + 2 files changed, 54 insertions(+) create mode 100644 meta-cgl-common/recipes-cgl/openais/files/openais-fix-corosync-not-quit.patch
meta-cgl-common/recipes-cgl/openais/files/openais-fix-corosync-not-quit.patch new file +53 -0
@@ -0,0 +1,53 @@ +commit e26a778dc3726666f6c15838c16efaca2e98abd6 +Author: yanjun.zhu <[email protected]> +Date: Wed Mar 13 10:10:03 2013 +0800 + + openais: fix corosync not quit + + In fsl-p5040, "/etc/init.d/openais stop" can not make corosync quit since corosync + does not respond to signal TERM. + + Upstream-Status: Pending + + Signed-off-by: yanjun.zhu <[email protected]> + +diff -urpN a/init/generic.in b/init/generic.in +--- a/init/generic.in ++++ b/init/generic.in +@@ -39,18 +39,6 @@ failure() + echo -ne "[FAILED]\r" + } + +-status() +-{ +- pid=$(pidof $1 2>/dev/null) +- rtrn=$? +- if [ $rtrn -ne 0 ]; then +- echo "$1 is stopped" +- else +- echo "$1 ($proc with pid $pid) is running..." +- fi +- return $rtrn +-} +- + # rpm based distros + if [ -d @SYSCONFDIR@/sysconfig ]; then + [ -f @INITDDIR@/functions ] && . @INITDDIR@/functions +@@ -98,16 +86,10 @@ stop() + ! status $proc > /dev/null 2>&1 && return + + echo -n "Signaling $desc ($prog) to terminate: " +- kill -TERM $(pidof $proc) > /dev/null 2>&1 ++ echo -n "Please stop corosync using /etc/init.d/corosync-daemon stop" + success + echo + +- echo -n "Waiting for $prog services to unload:" +- while status $proc > /dev/null 2>&1; do +- sleep 1 +- echo -n "." +- done +- + rm -f $LOCK_FILE + rm -f @LOCALSTATEDIR@/run/$prog.pid + success
meta-cgl-common/recipes-cgl/openais/openais_1.1.4.bb +1 -0
@@ -11,6 +11,7 @@ SRC_URI = " \ file://openais-fix-bash.patch \ file://openais-fix-init-script.patch \ file://openais-saTmrTimerReschedule-test-error.patch \ + file://openais-fix-corosync-not-quit.patch \ file://openais.service \ "
Signature · 1 line
2.11.0
PATCH 5/5 openais: remove cleanup entry from openais
In reply to [email protected]From: Jackie Huang <[email protected]>
message_handler_req_exec_lck_resourceclose is to remove cleanup entry from corosync. Now this job is done by pacemaker. So remove this feature from openais.
--- .../files/openais-fix-resource-cleanup-entry.patch | 37 ++++++++++++++++++++++ .../recipes-cgl/openais/openais_1.1.4.bb | 1 + 2 files changed, 38 insertions(+) create mode 100644 meta-cgl-common/recipes-cgl/openais/files/openais-fix-resource-cleanup-entry.patch
meta-cgl-common/recipes-cgl/openais/files/openais-fix-resource-cleanup-entry.patch new file +37 -0
@@ -0,0 +1,37 @@ +commit f70bea251f21a8bd646e59b34e6f74f6ee3fe29b +Author: yanjun.zhu <[email protected]> +Date: Tue Mar 19 12:23:55 2013 +0800 + + openais: remove cleanup entry from openais + + message_handler_req_exec_lck_resourceclose is to remove cleanup + entry from corosync. Now this job is done by pacemaker. So remove + this feature from openais. + + Upstream-Status: Pending + + Signed-off-by: yanjun.zhu <[email protected]> + +diff -urpN a/services/lck.c b/services/lck.c +--- a/services/lck.c ++++ b/services/lck.c +@@ -2304,17 +2304,9 @@ error_exit: + + if (error == SA_AIS_OK) { + /* +- * Remove the cleanup entry for this resource. ++ * cleanup entry for this resource can not be removed. ++ * This will be done by pacemaker. + */ +- cleanup = lck_resource_cleanup_find ( +- req_exec_lck_resourceclose->source.conn, +- &req_exec_lck_resourceclose->resource_name); +- +- if (cleanup != NULL) { +- list_del (&cleanup->cleanup_list); +- free (cleanup); +- } +- + hdb_handle_put (&resource_hdb, req_exec_lck_resourceclose->resource_id); + hdb_handle_destroy (&resource_hdb, req_exec_lck_resourceclose->resource_id); + }
meta-cgl-common/recipes-cgl/openais/openais_1.1.4.bb +1 -0
@@ -12,6 +12,7 @@ SRC_URI = " \ file://openais-fix-init-script.patch \ file://openais-saTmrTimerReschedule-test-error.patch \ file://openais-fix-corosync-not-quit.patch \ + file://openais-fix-resource-cleanup-entry.patch \ file://openais.service \ "
Signature · 1 line
2.11.0