From 42cc96e2c1edb6863909ef460770bd9e0b23ad58 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 12 Dec 2014 14:53:23 +0100 Subject: sysmobts: Add an option to stop the systemd sysmobts.service For systems without direct access to the PA the best option is to simply switch off the bts service. This will stop the transmission which will take load from the DSP/FPGA/RF circuit and indirectly from the PA as well. We should introduce "pa-on and bts-on" that can be executed as "normal" action. --- src/osmo-bts-sysmo/misc/sysmobts_mgr.h | 1 + src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c | 11 +++++++++++ src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c | 22 ++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h index fd6f2bcb..f4058674 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h @@ -16,6 +16,7 @@ enum { TEMP_ACT_MASTER_OFF = 0x2, TEMP_ACT_SLAVE_OFF = 0x4, TEMP_ACT_PA_OFF = 0x8, + TEMP_ACT_BTS_SRV_OFF = 0x10, }; enum sysmobts_temp_state { diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c index d110c131..c757f63a 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c @@ -98,6 +98,17 @@ static void handle_actions(int actions) * requires the control protocol. */ } + + if (actions & TEMP_ACT_BTS_SRV_OFF) { + LOGP(DTEMP, LOGL_NOTICE, + "Going to switch off 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 stop sysmobts.service"); + } } /** diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c index 9c8b15b3..5c75840e 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c @@ -170,6 +170,8 @@ static void write_action(struct vty *vty, const char *name, int actions) #endif vty_out(vty, " %spa-off%s", (actions & TEMP_ACT_PA_OFF) ? "" : "no ", VTY_NEWLINE); + vty_out(vty, " %sbts-service-off%s", + (actions & TEMP_ACT_BTS_SRV_OFF) ? "" : "no ", VTY_NEWLINE); } static int config_write_mgr(struct vty *vty) @@ -257,6 +259,24 @@ DEFUN(cfg_no_action_pa_off, cfg_no_action_pa_off_cmd, return CMD_SUCCESS; } +DEFUN(cfg_action_bts_srv_off, cfg_action_bts_srv_off_cmd, + "bts-service-off", + "Stop the systemd sysmobts.service\n") +{ + int *action = vty->index; + *action |= TEMP_ACT_BTS_SRV_OFF; + return CMD_SUCCESS; +} + +DEFUN(cfg_no_action_bts_srv_off, cfg_no_action_bts_srv_off_cmd, + "no bts-service-off", + NO_STR "Stop the systemd sysmobts.service\n") +{ + int *action = vty->index; + *action &= ~TEMP_ACT_BTS_SRV_OFF; + return CMD_SUCCESS; +} + DEFUN(show_mgr, show_mgr_cmd, "show manager", SHOW_STR "Display information about the manager") { @@ -327,6 +347,8 @@ static void register_action(int act) #endif install_element(act, &cfg_action_pa_off_cmd); install_element(act, &cfg_no_action_pa_off_cmd); + install_element(act, &cfg_action_bts_srv_off_cmd); + install_element(act, &cfg_no_action_bts_srv_off_cmd); } int sysmobts_mgr_vty_init(void) -- cgit v1.2.3