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

vmupdate: Send SIGUSR1 to meminfo-writer #179

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
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
15 changes: 10 additions & 5 deletions vmupdate/agent/source/plugins/fix_meminfo_writer_label.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import subprocess
import os
import signal


def fix_meminfo_writer_label(os_data, log, **kwargs):
Expand Down Expand Up @@ -33,9 +34,13 @@ def fix_meminfo_writer_label(os_data, log, **kwargs):

if label_changed:
try:
subprocess.check_call(
["systemctl", "restart", "qubes-meminfo-writer"]
with open("/run/meminfo-writer.pid", "r", encoding="utf-8") as f:
target_pid = int(f.read().strip())
os.kill(target_pid, signal.SIGUSR1)
log.info(
f"USR1 signal sent to meminfo-writer process id: {target_pid}"
)
except (FileNotFoundError, ValueError, OSError) as e:
log.error(
f"Error sending USR1 signal to meminfo-writer process: {e}"
)
log.info("qubes-meminfo-writer service restarted")
except subprocess.CalledProcessError as e:
log.error(f"Error restarting qubes-meminfo-writer service: {e}")