-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(magmad): restart options #15586
base: master
Are you sure you want to change the base?
fix(magmad): restart options #15586
Conversation
Signed-off-by: Lucas Amaral <lucaaamaral@gmail.com>
Signed-off-by: Lucas Amaral <lucaaamaral@gmail.com>
Signed-off-by: Lucas Amaral <lucaaamaral@gmail.com>
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
- policydb | ||
- state | ||
- eventd | ||
- smsd | ||
- ctraced | ||
- health | ||
- redirectd | ||
- sctpd | ||
- monitord |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[misspell] reported by reviewdog 🐶
"monitord" is a misspelling of "monitored"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
monitord
is the name of the container, so it is not misspelled.
@@ -106,7 +106,7 @@ def Reboot(self, _, context): | |||
""" | |||
async def run_reboot(): | |||
await asyncio.sleep(1) | |||
os.system('reboot') | |||
os.system('echo b > /proc/sysrq-trigger') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
S605 Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find a better solution than this, please let me know if you can come up with a solution that does not uses shell.
Signed-off-by: Lucas Amaral <lucaaamaral@gmail.com>
@@ -106,7 +106,7 @@ def Reboot(self, _, context): | |||
""" | |||
async def run_reboot(): | |||
await asyncio.sleep(1) | |||
os.system('reboot') | |||
os.system('/usr/bin/echo b > /proc/sysrq-trigger') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
S605 Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
fix(magmad): restart options
Summary
There were misbehaviors in the
Equipment -> Actions -> Restart services/Reboot
from the nms:During tests, it was found that:
Test Plan
Selecting for the “restart“ option triggers a series of messages that results in the magmad component the below output:
This command is triggered by the
orc8r/gateway/python/magma/magmad/rpc_servicer.py:109
file which depends on the reboot command being installed in the magmad container.Docker containers don't have the ability to restart the host system or control the host machine's processes, neither implement full OS.
The solution was to Replace the “reboot“ command to
echo b > /proc/sysrq-trigger
in the python scriptorc8r/gateway/python/magma/magmad/rpc_servicer.py:109
and add the below lines to the magmad section on the compose filelte/gateway/docker/docker-compose.yaml
or/var/opt/magma/docker/docker-compose.yaml
:*Note: the command
echo b > /proc/sysrq-trigger
might be too harsh on the machine, it might be interesting to examine for the advantages of other commands, such as 'echo _sub > /proc/sysrq-trigger'. I've tried using_reisub
as commonly recommended, even_sb
to assure the disks are being synchronized, but without success, so I left only with theb
from reboot. Please let me know if this is enough or a better solution is needed.Selecting for the “restart services“ option triggers a series of messages that results in the magmad component the below output:
It is possible to recognize the attempt to restart services from the lines:
It is possible to see that a couple of services failed to be found from the lines:
And it is possible to confirm that some of the services has been restarted from the docker compose ps command:
From that list, it is safe to assume that all containers had been restarted except for
connectiond
,magmad
,monitord
,oai_mme
,redirectd
andsctpd
.The function to restart the tasks is
RestartServices
, definedorc8r/gateway/python/magma/magmad/rpc_servicer.py:115
and the services seems to be originated from an parse_args object, as fromorc8r/gateway/python/scripts/magmad_cli.py:42
.At the first inspection, I could not locate where the list is being generated.
The solution found was to add the remaining service names to the configuration file
lte/gateway/configs/magmad.yml
to resolve the issue of restarting the remaining items.The “restart services” option is functional, although some services are not being targeted. A fix is to include the docker container names in the configuration file
lte/gateway/configs/magmad.yml
, under themagma_services
section.Additional Information
Security Considerations
Restarting the machine without proper caution might corrupt disk data. It might be interesting to look after a safest way to restart the host system.