aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-16 18:26:35 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-16 20:22:28 +0100
commitffc193443c177c3e41851c445c71fc1095ae2201 (patch)
tree441065297c14604b289ccdb2e5c99dc8331b107d /src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
parent8968b48643686683046a0af403178960f8baf9ed (diff)
sysmobts: Add "normal" actions to execute
Instead of keeping state to remember what was done and needs to be undone this patch introduces actions that will be executed when the system is back to normal. By design the system is considered to be in the normal state and these actions will be only executed after the system is coming back to the normal state. One advantage of this scheme is that an operator can decide that an overheated systems hould be off duty and requires manual interaction to be allowed back in service. The change has only been smoke tested Fixes: SYS#833
Diffstat (limited to 'src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c')
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
index c757f63a..39b20dca 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
@@ -77,6 +77,34 @@ static int next_state(enum sysmobts_temp_state current_state, int critical, int
return next_state;
}
+static void handle_normal_actions(int actions)
+{
+ /* switch off the PA */
+ if (actions & TEMP_ACT_NORM_PA_ON) {
+ if (!is_sbts2050()) {
+ LOGP(DTEMP, LOGL_NOTICE,
+ "PA can only be switched-on on the master\n");
+ } else if (sbts2050_uc_set_pa_power(1) != 0) {
+ LOGP(DTEMP, LOGL_ERROR,
+ "Failed to switch on the PA\n");
+ } else {
+ LOGP(DTEMP, LOGL_NOTICE,
+ "Switched on the PA as normal action.\n");
+ }
+ }
+
+ if (actions & TEMP_ACT_NORM_BTS_SRV_ON) {
+ LOGP(DTEMP, LOGL_NOTICE,
+ "Going to switch on the BTS service\n");
+ /*
+ * TODO: use/create something like nspawn that serializes
+ * and used SIGCHLD/waitpid to pick up the dead processes
+ * without invoking shell.
+ */
+ system("/bin/systemctl start sysmobts.service");
+ }
+}
+
static void handle_actions(int actions)
{
/* switch off the PA */
@@ -91,12 +119,6 @@ static void handle_actions(int actions)
LOGP(DTEMP, LOGL_NOTICE,
"Switched off the PA due temperature.\n");
}
- /*
- * TODO: remember we switched off things so we could switch
- * it back on. But we would need to make sure that the BTS
- * will not transmit with full power at that time. This
- * requires the control protocol.
- */
}
if (actions & TEMP_ACT_BTS_SRV_OFF) {
@@ -112,14 +134,16 @@ static void handle_actions(int actions)
}
/**
- * Go back to normal! Undo everything we did in the other states. For
- * reducint the transmit power, the question is if we should slowly set
- * it back to normal, let the BTS slowly increase it.. or handle it here
- * as well?
+ * Go back to normal! Depending on the configuration execute the normal
+ * actions that could (start to) undo everything we did in the other
+ * states. What is still missing is the power increase/decrease depending
+ * on the state. E.g. starting from WARNING_HYST we might want to slowly
+ * ramp up the output power again.
*/
static void execute_normal_act(struct sysmobts_mgr_instance *manager)
{
LOGP(DTEMP, LOGL_NOTICE, "System is back to normal temperature.\n");
+ handle_normal_actions(manager->action_norm);
}
static void execute_warning_act(struct sysmobts_mgr_instance *manager)