Skip to content
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

Problem: QEMUVM killed before shutdown command #698

Merged
merged 3 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ WorkingDirectory=/opt/aleph-vm
Environment=PYTHONPATH=/opt/aleph-vm/:$PYTHONPATH
ExecStart=/usr/bin/python3 -m aleph.vm.controllers --config=/var/lib/aleph/vm/%i-controller.json
Restart=on-failure
# Kill Mixed mode is used there so at first only the python controller process receive the SIGTERM signal
# That process catch it and send a qemu command to shut down the Guest VM (for QEMU VM), giving it a
# change to clean up properly and prevent disk corruption.
# After 30s (TimeoutStopSec) if the process is not stopped, the controller and subproccess will be SIGKILL
hoh marked this conversation as resolved.
Show resolved Hide resolved
KillMode=mixed
TimeoutStopSec=30

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions src/aleph/vm/controllers/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@

def callback():
"""Callback for the signal handler to stop the VM and cleanup properly on SIGTERM."""
print("Received SIGTERM")

Check warning on line 93 in src/aleph/vm/controllers/__main__.py

View check run for this annotation

Codecov / codecov/patch

src/aleph/vm/controllers/__main__.py#L93

Added line #L93 was not covered by tests
olethanh marked this conversation as resolved.
Show resolved Hide resolved
loop.create_task(execution.stop())

loop.add_signal_handler(signal.SIGTERM, callback)
Expand Down