Skip to content

[featured] fix non existing feature start#314

Merged
lihuay merged 1 commit intosonic-net:masterfrom
stepanblyschak:fix-non-existing-feature-start2
Feb 25, 2026
Merged

[featured] fix non existing feature start#314
lihuay merged 1 commit intosonic-net:masterfrom
stepanblyschak:fix-non-existing-feature-start2

Conversation

@stepanblyschak
Copy link
Copy Markdown
Contributor

Fix an issue that when starting a non existing feature and then installing it with sonic-package-manager it won't start.

E.g:

admin@sonic:~$ redis-cli -n 4 hmset 'FEATURE|non-existing' state enabled OK
admin@sonic:~$ sudo zless /var/log/syslog | grep featured 2025 Mar 26 15:19:33.237090 sonic INFO featured: Feature non-existing is enabled and started

With this patch an error is recordded and feature state is not cached:

2025 Mar 26 15:35:32.794640 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:33.233685 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:33.233743 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:33.247238 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:33.247300 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started
2025 Mar 26 15:35:39.331762 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:39.780474 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:39.780513 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:39.795113 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:39.795153 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started

Feature will start next time when setting state field in FEATURE table

Fix an issue that when starting a non existing feature and then
installing it with sonic-package-manager it won't start.

E.g:

admin@sonic:~$ redis-cli -n 4 hmset 'FEATURE|non-existing' state enabled
OK

admin@sonic:~$ sudo zless /var/log/syslog | grep featured
2025 Mar 26 15:19:33.237090 sonic INFO featured: Feature non-existing is enabled and started

With this patch an error is recorded and feature state is not cached:

2025 Mar 26 15:35:32.794640 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:33.233685 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:33.233743 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:33.247238 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:33.247300 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started
2025 Mar 26 15:35:39.331762 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'unmask', 'non-existing.service']'
2025 Mar 26 15:35:39.780474 sonic INFO featured: Output:  , Stderr: Unit non-existing.service does not exist, proceeding anyway.
2025 Mar 26 15:35:39.780513 sonic INFO featured: Running cmd: '['sudo', 'systemctl', 'enable', 'non-existing.service']'
2025 Mar 26 15:35:39.795113 sonic ERR featured: ['sudo', 'systemctl', 'enable', 'non-existing.service'] - failed: return code - 1, output:
2025 Mar 26 15:35:39.795153 sonic ERR featured: Feature 'non-existing.service' failed to be enabled and started

Feature will start next time when setting state field in FEATURE table

Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@stepanblyschak
Copy link
Copy Markdown
Contributor Author

Depends on #317

@stepanblyschak stepanblyschak marked this pull request as ready for review November 12, 2025 11:24
@stepanblyschak
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Collaborator

@liat-grozovik liat-grozovik left a comment

Choose a reason for hiding this comment

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

LGTM. Pending others to review and confirm

if enable:
self.enable_feature(feature)
if not self.enable_feature(feature):
return False
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

False

Seems no caller is consume the return value. Will you add some logging if this branch happen?

@lihuay lihuay merged commit 2c5bf36 into sonic-net:master Feb 25, 2026
6 checks passed
@mssonicbld
Copy link
Copy Markdown

Cherry-pick PR to 202511: #354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants