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

[y_cable] Support for initialization of new daemon ycable to support ycables #9125

Merged
merged 8 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
19 changes: 19 additions & 0 deletions dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,25 @@ 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_xcvrd %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this check 'skip_xcvrd'? how is this new daemon dependent on xcvrd?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a separate flag for skip_ycabled, to keep homogeneous with other daemons

[program:ycable]
{% if delay_xcvrd %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why delay start of ycable daemon based upon 'delay_xcvrd'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a separate flag for delay_ycabled

command=bash -c "sleep 30 && {% if API_VERSION == 3 and 'ycable' not in python2_daemons %}nice -n -20 python3 {% else %} nice -n -20 python2 {% endif %}/usr/local/bin/ycable"
{% else %}
command=nice -n -20 {% if API_VERSION == 3 and 'ycable' not in python2_daemons %}python3 {% else %} python2 {% endif %}/usr/local/bin/ycable
{% endif %}
priority=6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you seem to be reusing the 'priority' level of xcvrd. is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking about it, all daemons have a priority from 1-10. Maybe need to have this as 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
Expand Down
4 changes: 2 additions & 2 deletions dockers/docker-platform-monitor/docker_init.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions rules/docker-platform-monitor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PSUD_PY2)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_SYSEEPROMD_PY2)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_THERMALCTLD_PY2)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_XCVRD_PY2)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_YCABLE_PY2)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_LEDD_PY3)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PCIED_PY3)
$(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_YCABLE_PY3)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_CHASSISD_PY3)

ifeq ($(PDDF_SUPPORT),y)
Expand Down
16 changes: 16 additions & 0 deletions rules/sonic-ycable.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SPATH := $($(SONIC_YCABLE_PY2)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-ycable.mk rules/sonic-xcvrd.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files))

$(SONIC_YCABLE_PY2)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC_YCABLE_PY2)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SONIC_YCABLE_PY2)_DEP_FILES := $(DEP_FILES)
$(SONIC_YCABLE_PY2)_SMDEP_FILES := $(SMDEP_FILES)
$(SONIC_YCABLE_PY2)_SMDEP_PATHS := $(SPATH)

$(SONIC_YCABLE_PY3)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC_YCABLE_PY3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SONIC_YCABLE_PY3)_DEP_FILES := $(DEP_FILES)
$(SONIC_YCABLE_PY3)_SMDEP_FILES := $(SMDEP_FILES)
$(SONIC_YCABLE_PY3)_SMDEP_PATHS := $(SPATH)
19 changes: 19 additions & 0 deletions rules/sonic-ycable.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# sonic-ycable (SONiC Y-Cable daemon) Debian package

# SONIC_YCABLE_PY2 package

SONIC_YCABLE_PY2 = sonic_ycable-1.0-py2-none-any.whl
$(SONIC_YCABLE_PY2)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-ycable
$(SONIC_YCABLE_PY2)_DEPENDS = $(SONIC_PY_COMMON_PY2) $(SONIC_PLATFORM_COMMON_PY2)
$(SONIC_YCABLE_PY2)_DEBS_DEPENDS = $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON)
$(SONIC_YCABLE_PY2)_PYTHON_VERSION = 2
SONIC_PYTHON_WHEELS += $(SONIC_YCABLE_PY2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are moving to PY3 only, then why PY2 support?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


# SONIC_YCABLE_PY3 package

SONIC_YCABLE_PY3 = sonic_ycable-1.0-py3-none-any.whl
$(SONIC_YCABLE_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-daemons/sonic-ycable
$(SONIC_YCABLE_PY3)_DEPENDS = $(SONIC_PY_COMMON_PY3) $(SONIC_YCABLE_PY2) $(SONIC_PLATFORM_COMMON_PY3)
$(SONIC_YCABLE_PY3)_DEBS_DEPENDS = $(LIBSWSSCOMMON) $(PYTHON3_SWSSCOMMON)
$(SONIC_YCABLE_PY3)_PYTHON_VERSION = 3
SONIC_PYTHON_WHEELS += $(SONIC_YCABLE_PY3)