From 61e9a7683c0b17a536b9fa488088e33b52d64560 Mon Sep 17 00:00:00 2001 From: vdahiya12 <67608553+vdahiya12@users.noreply.github.com> Date: Tue, 25 Jan 2022 11:10:25 -0800 Subject: [PATCH] [y_cable] Support for initialization of new daemon ycable to support ycables (#9125) * [y_cable] Support for initialization of new Daemon ycable to support ycables This PR also adds the commit in sonic-platform-daemons 94fa239 [y_cable] refactor y_cable to a seperate logic and new daemon from xcvrd (#219) Why I did it This PR separates the logic of Y-Cable from xcvrd. Before this change we were utilizing xcvrd daemon to control all aspects of Y-Cable right from initialization to processing requests from other entities like orch,linkmgr. Now we would have another daemon ycabled which will serve this purpose. Logically everything still remains the same from the perspective of other daemons. it also take care aspects like init/delete daemon from Y-Cable perspective. How I did it To serve the purpose we build a new wheel sonic_ycabled-1.0-py3-none-any.whl and install it inside pmon. We also initalize the daemon ycabled which serves our purpose for refactor inside pmon How to verify it Ran the changes with an image for dualtor tests on a 7050cx3 platform Signed-off-by: vaibhav-dahiya --- .../pmon_daemon_control.json | 3 ++- .../docker-pmon.supervisord.conf.j2 | 27 ++++++++++++++++--- .../docker-platform-monitor/docker_init.j2 | 4 +-- rules/docker-platform-monitor.mk | 1 + rules/sonic-ycabled.dep | 10 +++++++ rules/sonic-ycabled.mk | 10 +++++++ src/sonic-platform-daemons | 2 +- 7 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 rules/sonic-ycabled.dep create mode 100644 rules/sonic-ycabled.mk diff --git a/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json b/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json index 101db0ffea..35fd93caad 100644 --- a/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json +++ b/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json @@ -4,5 +4,6 @@ "skip_pcied": true, "skip_psud": true, "skip_syseepromd": true, - "skip_thermalctld": true + "skip_thermalctld": true, + "skip_ycabled": false } diff --git a/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 b/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 index fb1cdf2caa..5652bd17d6 100644 --- a/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 +++ b/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 @@ -110,10 +110,29 @@ dependent_startup=true dependent_startup_wait_for=rsyslogd:running {% endif %} +{% if 'subtype' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['subtype'] == 'DualToR' %} +{% if not skip_ycabled %} +[program:ycabled] +{% if delay_ycabled %} +command=bash -c "sleep 30 && nice -n -20 python3 /usr/local/bin/ycabled" +{% else %} +command=nice -n -20 python3 /usr/local/bin/ycabled +{% endif %} +priority=7 +autostart=false +autorestart=unexpected +stdout_logfile=syslog +stderr_logfile=syslog +startsecs=10 +dependent_startup=true +dependent_startup_wait_for=rsyslogd:running +{% endif %} +{% endif %} + {% if not skip_psud %} [program:psud] command={% if API_VERSION == 3 and 'psud' not in python2_daemons %}python3 {% else %} python2 {% endif %}/usr/local/bin/psud -priority=7 +priority=8 autostart=false autorestart=unexpected stdout_logfile=syslog @@ -126,7 +145,7 @@ dependent_startup_wait_for=rsyslogd:running {% if not skip_syseepromd %} [program:syseepromd] command={% if API_VERSION == 3 and 'syseepromd' not in python2_daemons %}python3 {% else %} python2 {% endif %}/usr/local/bin/syseepromd -priority=8 +priority=9 autostart=false autorestart=unexpected stdout_logfile=syslog @@ -139,7 +158,7 @@ dependent_startup_wait_for=rsyslogd:running {% if not skip_thermalctld %} [program:thermalctld] command={% if API_VERSION == 3 and 'thermalctld' not in python2_daemons %}python3 {% else %} python2 {% endif %}/usr/local/bin/thermalctld -priority=9 +priority=10 autostart=false autorestart=unexpected stdout_logfile=syslog @@ -153,7 +172,7 @@ dependent_startup_wait_for=rsyslogd:running {% if not skip_pcied %} [program:pcied] command={% if API_VERSION == 3 and 'pcied' not in python2_daemons %}python3 {% else %} python2 {% endif %}/usr/local/bin/pcied -priority=10 +priority=11 autostart=false autorestart=unexpected stdout_logfile=syslog diff --git a/dockers/docker-platform-monitor/docker_init.j2 b/dockers/docker-platform-monitor/docker_init.j2 index 1d22e19b23..c93d1790bd 100755 --- a/dockers/docker-platform-monitor/docker_init.j2 +++ b/dockers/docker-platform-monitor/docker_init.j2 @@ -105,9 +105,9 @@ confvar="{\"HAVE_SENSORS_CONF\":$HAVE_SENSORS_CONF, \"HAVE_FANCONTROL_CONF\":$HA if [ -e $PMON_DAEMON_CONTROL_FILE ]; then - sonic-cfggen -j $PMON_DAEMON_CONTROL_FILE -a "$confvar" -t $SUPERVISOR_CONF_TEMPLATE > $SUPERVISOR_CONF_FILE + sonic-cfggen -d -j $PMON_DAEMON_CONTROL_FILE -a "$confvar" -t $SUPERVISOR_CONF_TEMPLATE > $SUPERVISOR_CONF_FILE else - sonic-cfggen -a "$confvar" -t $SUPERVISOR_CONF_TEMPLATE > $SUPERVISOR_CONF_FILE + sonic-cfggen -d -a "$confvar" -t $SUPERVISOR_CONF_TEMPLATE > $SUPERVISOR_CONF_FILE fi exec /usr/local/bin/supervisord diff --git a/rules/docker-platform-monitor.mk b/rules/docker-platform-monitor.mk index d215988519..0a0efa435f 100644 --- a/rules/docker-platform-monitor.mk +++ b/rules/docker-platform-monitor.mk @@ -20,6 +20,7 @@ $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PSUD_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_SYSEEPROMD_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_THERMALCTLD_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_XCVRD_PY3) +$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_YCABLED_PY3) $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_CHASSISD_PY3) ifeq ($(PDDF_SUPPORT),y) diff --git a/rules/sonic-ycabled.dep b/rules/sonic-ycabled.dep new file mode 100644 index 0000000000..b7eed99e8a --- /dev/null +++ b/rules/sonic-ycabled.dep @@ -0,0 +1,10 @@ +SPATH := $($(SONIC_YCABLED_PY3)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-ycabled.mk rules/sonic-ycabled.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) + +$(SONIC_YCABLED_PY3)_CACHE_MODE := GIT_CONTENT_SHA +$(SONIC_YCABLED_PY3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(SONIC_YCABLED_PY3)_DEP_FILES := $(DEP_FILES) +$(SONIC_YCABLED_PY3)_SMDEP_FILES := $(SMDEP_FILES) +$(SONIC_YCABLED_PY3)_SMDEP_PATHS := $(SPATH) diff --git a/rules/sonic-ycabled.mk b/rules/sonic-ycabled.mk new file mode 100644 index 0000000000..ba3531d2db --- /dev/null +++ b/rules/sonic-ycabled.mk @@ -0,0 +1,10 @@ +# sonic-ycabled (SONiC Y-Cable daemon) Debian package + +# SONIC_YCABLED_PY3 package + +SONIC_YCABLED_PY3 = sonic_ycabled-1.0-py3-none-any.whl +$(SONIC_YCABLED_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-ycabled +$(SONIC_YCABLED_PY3)_DEPENDS = $(SONIC_PY_COMMON_PY3) $(SONIC_PLATFORM_COMMON_PY3) +$(SONIC_YCABLED_PY3)_DEBS_DEPENDS = $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON) +$(SONIC_YCABLED_PY3)_PYTHON_VERSION = 3 +SONIC_PYTHON_WHEELS += $(SONIC_YCABLED_PY3) diff --git a/src/sonic-platform-daemons b/src/sonic-platform-daemons index c4127c28ad..94fa239a7b 160000 --- a/src/sonic-platform-daemons +++ b/src/sonic-platform-daemons @@ -1 +1 @@ -Subproject commit c4127c28ada0cbc7fd8cb730320cbc65ef78ead8 +Subproject commit 94fa239a7bcfcab008e94fb5c118b628e4256561