Skip to content

Commit

Permalink
ptpstatus: deal with when timemaster or ptp is not used
Browse files Browse the repository at this point in the history
Signed-off-by: Florent CARLI <[email protected]>
  • Loading branch information
insatomcat committed Oct 3, 2024
1 parent b5b6e7c commit e4270d3
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 37 deletions.
76 changes: 39 additions & 37 deletions roles/debian_hypervisor/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,44 +214,46 @@
name: ovs-vswitchd
when: ovsvswitchd.changed

- name: ptp/vsock when ptp is enabled
block:
- name: Copy ptp_status executable files
ansible.builtin.copy:
src: ../src/debian/ptpstatus/ptpstatus_script/ptpstatus.sh
dest: /usr/local/bin/ptpstatus.sh
mode: '0755'
- name: Copy ptp_vsock executable files
ansible.builtin.copy:
src: ptp_vsock.py
dest: /usr/local/bin/ptp_vsock.py
mode: '0755'

- name: Copy ptp_status executable files
ansible.builtin.copy:
src: ../src/debian/ptpstatus/ptpstatus_script/ptpstatus.sh
dest: /usr/local/bin/ptpstatus.sh
mode: '0755'
- name: Copy ptp_vsock executable files
ansible.builtin.copy:
src: ptp_vsock.py
dest: /usr/local/bin/ptp_vsock.py
mode: '0755'

- name: Copy ptp_status.service
ansible.builtin.copy:
src: ../src/debian/ptpstatus/ptpstatus.service
dest: /etc/systemd/system/ptpstatus.service
mode: '0644'
register: ptpstatus
- name: Copy ptp_vsock.service
ansible.builtin.copy:
src: ptp_vsock.service
dest: /etc/systemd/system/ptp_vsock.service
mode: '0644'
register: ptpvsock
- name: daemon-reload ptp status
ansible.builtin.service:
daemon_reload: yes
when: ptpstatus.changed or ptpvsock.changed
- name: enable ptpstatus.service
ansible.builtin.systemd:
name: ptpstatus.service
enabled: yes
state: started
- name: enable ptp_vsock.service
ansible.builtin.systemd:
name: ptp_vsock.service
enabled: yes
state: started
- name: Copy ptp_status.service
ansible.builtin.copy:
src: ../src/debian/ptpstatus/ptpstatus.service
dest: /etc/systemd/system/ptpstatus.service
mode: '0644'
register: ptpstatus
- name: Copy ptp_vsock.service
ansible.builtin.copy:
src: ptp_vsock.service
dest: /etc/systemd/system/ptp_vsock.service
mode: '0644'
register: ptpvsock
- name: daemon-reload ptp status
ansible.builtin.service:
daemon_reload: yes
when: ptpstatus.changed or ptpvsock.changed
- name: enable ptpstatus.service
ansible.builtin.systemd:
name: ptpstatus.service
enabled: yes
state: started
- name: enable ptp_vsock.service
ansible.builtin.systemd:
name: ptp_vsock.service
enabled: yes
state: started
when: ptp_interface is defined

- name: Create conntrackd.service.d directory
file:
Expand Down
2 changes: 2 additions & 0 deletions src/debian/ptpstatus/ptpstatus_script/ptpstatus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,8 @@ function getPtpStatus() {

if [[ -S /var/run/timemaster/ptp4l.0.socket ]]; then
PMC_SOCKET_OPTION="-s /var/run/timemaster/ptp4l.0.socket"
else
PMC_SOCKET_OPTION=""
fi

local _pmcOutput="$( \
Expand Down

0 comments on commit e4270d3

Please sign in to comment.