Merge "Add synce4l config support to puppet"

This commit is contained in:
Zuul 2023-02-21 15:49:22 +00:00 committed by Gerrit Code Review
commit b35d762097
4 changed files with 48 additions and 3 deletions

View File

@ -9,7 +9,8 @@ define ptp_config_files(
$id,
$ptp_conf_dir,
$ptp_options_dir,
$pmc_gm_settings = ''
$pmc_gm_settings = '',
$device_parameters = ''
) {
file { $_name:
ensure => file,
@ -53,7 +54,8 @@ define set_ptp4l_pmc_parameters(
$id,
$ptp_conf_dir,
$ptp_options_dir,
$pmc_gm_settings = ''
$pmc_gm_settings = '',
$device_parameters = ''
) {
if ($service == 'ptp4l') and ($pmc_gm_settings != '') {
exec { "${_name}_set_initial_pmc_paramters":
@ -275,6 +277,12 @@ class platform::ptpinstance (
mode => '0644',
content => template('platform/ts2phc-instance.service.erb'),
}
-> file { 'synce4l_service_instance':
ensure => file,
path => '/etc/systemd/system/synce4l@.service',
mode => '0644',
content => template('platform/synce4l-instance.service.erb'),
}
-> exec { 'stop-ptp4l-instances':
command => '/usr/bin/systemctl stop ptp4l*',
}
@ -304,6 +312,13 @@ class platform::ptpinstance (
command => '/usr/bin/systemctl disable ts2phc@*',
onlyif => 'test -f /etc/systemd/system/ts2phc@.service',
}
-> exec { 'stop-synce4l-instance':
command => '/usr/bin/systemctl stop synce4l@*',
}
-> exec { 'disable-sycne4l-instance':
command => '/usr/bin/systemctl disable synce4l@*',
onlyif => 'test -f /etc/systemd/system/synce4l@.service',
}
-> exec { 'ptpinstance-systemctl-daemon-reload':
command => '/usr/bin/systemctl daemon-reload',
}
@ -316,6 +331,9 @@ class platform::ptpinstance (
-> exec { 'ptpinstance-systemctl-reset-failed-ts2phc':
command => '/usr/bin/systemctl reset-failed ts2phc@*',
}
-> exec { 'ptpinstance-systemctl-reset-failed-synce4l':
command => '/usr/bin/systemctl reset-failed synce4l*',
}
if $enabled {
create_resources('ptp_config_files', $config, $ptp_state)

View File

@ -8,6 +8,15 @@
<%- end -%>
<%- end -%>
<%- if @service == 'synce4l' -%>
[<<%= @_name %>>]
<%- if @device_parameters -%>
<%- @device_parameters.each do |key,value| -%>
<%= key %> <%= value %>
<%- end -%>
<%- end -%>
<%- end -%>
<%- if @interfaces -%>
<%- @interfaces.each do |interface| %>
<%- interface['port_names'].each do |port| -%>
@ -17,10 +26,10 @@
##
<%- interface['parameters'].each do |key,value| -%>
<%= key %> <%= value %>
<%- end -%>
<%- end -%>
<%- end -%>
<%- end -%>
<%- end -%>

View File

@ -0,0 +1 @@
OPTIONS="<%= @cmdline_opts %>"

View File

@ -0,0 +1,17 @@
[Unit]
Description=Synchronous Ethernet (SynceE) service
After=ptp4l.service
[Service]
Type=simple
EnvironmentFile=-<%= @ptp_options_dir %>/ptpinstance/synce4l-instance-%i
ExecStart=/usr/sbin/synce4l -f <%= @ptp_conf_dir %>/ptpinstance/synce4l-%i.conf $OPTIONS
ExecStartPost=/bin/bash -c 'echo $MAINPID > /var/run/synce4l-%i.pid'
ExecStopPost=/bin/rm -f /var/run/synce4l-%i.pid
Restart=on-failure
RestartPreventExitStatus=SIGTERM SIGINT SIGKILL SIGABRT 255
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=70
[Install]
WantedBy=multi-user.target