mirror of
https://github.com/systemd/systemd.git
synced 2024-10-28 03:25:31 +03:00
test-network: show PID and Invocation ID of networkd
Then, we can easily find relevant journal entry on failure. This is especially useful when the test is running with --no-journal.
This commit is contained in:
parent
6fec598290
commit
653c38b3eb
@ -845,6 +845,9 @@ def radvd_check_config(config_file):
|
||||
def networkd_invocation_id():
|
||||
return check_output('systemctl show --value -p InvocationID systemd-networkd.service')
|
||||
|
||||
def networkd_pid():
|
||||
return check_output('systemctl show --value -p MainPID systemd-networkd.service')
|
||||
|
||||
def read_networkd_log(invocation_id=None, since=None):
|
||||
if not invocation_id:
|
||||
invocation_id = networkd_invocation_id()
|
||||
@ -876,6 +879,9 @@ def stop_networkd(show_logs=True):
|
||||
|
||||
def start_networkd():
|
||||
check_output('systemctl start systemd-networkd')
|
||||
invocation_id = networkd_invocation_id()
|
||||
pid = networkd_pid()
|
||||
print(f'Started systemd-networkd.service: PID={pid}, Invocation ID={invocation_id}')
|
||||
|
||||
def restart_networkd(show_logs=True):
|
||||
global show_journal
|
||||
@ -886,6 +892,10 @@ def restart_networkd(show_logs=True):
|
||||
if show_logs:
|
||||
print(read_networkd_log(invocation_id))
|
||||
|
||||
invocation_id = networkd_invocation_id()
|
||||
pid = networkd_pid()
|
||||
print(f'Restarted systemd-networkd.service: PID={pid}, Invocation ID={invocation_id}')
|
||||
|
||||
def networkd_pid():
|
||||
return int(check_output('systemctl show --value -p MainPID systemd-networkd.service'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user