Change in osmo-bts[master]: bts_shutdown_fsm: Allow configuring FSM to shutdown without exiting p...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Sep 21 16:56:21 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/25531 )


Change subject: bts_shutdown_fsm: Allow configuring FSM to shutdown without exiting process
......................................................................

bts_shutdown_fsm: Allow configuring FSM to shutdown without exiting process

This feature is not yet used by any bts_shutdown_fsm caller, but will be
used in the future when Abis link goes down.

Change-Id: I5dc282fdbcf862067be326e72b6183dd544222ae
---
M include/osmo-bts/bts.h
M src/common/bts_shutdown_fsm.c
2 files changed, 20 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/31/25531/1

diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index d3cb6bf..a601423 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -368,6 +368,7 @@
 	} gsmtap;
 
 	struct osmo_fsm_inst *shutdown_fi; /* FSM instance to manage shutdown procedure during process exit */
+	bool shutdown_fi_exit_proc; /* exit process when shutdown_fsm is finished? */
 	struct osmo_fsm_inst *abis_link_fi; /* FSM instance to manage abis connection during process startup and link failure */
 	struct osmo_tdef *T_defs; /* Timer defines */
 
@@ -390,6 +391,7 @@
 
 int bts_init(struct gsm_bts *bts);
 void bts_shutdown(struct gsm_bts *bts, const char *reason);
+void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc);
 
 int bts_link_estab(struct gsm_bts *bts);
 
diff --git a/src/common/bts_shutdown_fsm.c b/src/common/bts_shutdown_fsm.c
index c16b76a..47888b8 100644
--- a/src/common/bts_shutdown_fsm.c
+++ b/src/common/bts_shutdown_fsm.c
@@ -156,8 +156,11 @@
 
 	osmo_fsm_inst_dispatch(bts->site_mgr.mo.fi, NM_EV_SHUTDOWN_FINISH, NULL);
 
-	LOGPFSML(fi, LOGL_NOTICE, "Shutdown process completed successfuly, exiting process\n");
-	exit(0);
+	if (bts->shutdown_fi_exit_proc) {
+		LOGPFSML(fi, LOGL_NOTICE, "Shutdown process completed successfuly, exiting process\n");
+		exit(0);
+	}
+	bts_shutdown_fsm_state_chg(fi, BTS_SHUTDOWN_ST_NONE);
 }
 
 static struct osmo_fsm_state bts_shutdown_fsm_states[] = {
@@ -190,6 +193,8 @@
 	},
 	[BTS_SHUTDOWN_ST_EXIT] = {
 		.name = "EXIT",
+		.out_state_mask =
+			X(BTS_SHUTDOWN_ST_NONE),
 		.onenter = st_exit_on_enter,
 	}
 };
@@ -232,18 +237,26 @@
 	OSMO_ASSERT(osmo_fsm_register(&bts_shutdown_fsm) == 0);
 }
 
-void bts_shutdown(struct gsm_bts *bts, const char *reason)
+void bts_shutdown_ext(struct gsm_bts *bts, const char *reason, bool exit_proc)
 {
 	struct osmo_fsm_inst *fi = bts->shutdown_fi;
 	if (fi->state != BTS_SHUTDOWN_ST_NONE) {
 		LOGPFSML(fi, LOGL_NOTICE, "BTS is already being shutdown.\n");
+		if (exit_proc)
+			bts->shutdown_fi_exit_proc = true;
 		return;
 	}
-
-	LOGPFSML(fi, LOGL_NOTICE, "Shutting down BTS, reason: %s\n", reason);
+	bts->shutdown_fi_exit_proc = exit_proc;
+	LOGPFSML(fi, LOGL_NOTICE, "Shutting down BTS, exit %u, reason: %s\n",
+		 exit_proc, reason);
 	osmo_fsm_inst_dispatch(fi, BTS_SHUTDOWN_EV_START, NULL);
 }
 
+void bts_shutdown(struct gsm_bts *bts, const char *reason)
+{
+	bts_shutdown_ext(bts, reason, true);
+}
+
 void bts_model_trx_close_cb(struct gsm_bts_trx *trx, int rc)
 {
 	struct osmo_fsm_inst *fi = trx->bts->shutdown_fi;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/25531
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I5dc282fdbcf862067be326e72b6183dd544222ae
Gerrit-Change-Number: 25531
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210921/cd4bf2c6/attachment.htm>


More information about the gerrit-log mailing list