Skip to content

[action] [PR:4606] [config reload] Skip swss readiness check when swss is not present#384

Merged
mssonicbld merged 1 commit into
Azure:202608from
mssonicbld:cherry/msft-202608/4606
Jul 1, 2026
Merged

[action] [PR:4606] [config reload] Skip swss readiness check when swss is not present#384
mssonicbld merged 1 commit into
Azure:202608from
mssonicbld:cherry/msft-202608/4606

Conversation

@mssonicbld

Copy link
Copy Markdown
Collaborator

What I did

config reload (without -f) fails on platforms that do not ship the swss container (e.g. BMC) with swss container is not ready. Retry later or use -f to avoid system checks. The readiness gate waits on a swss.service that does not exist on such images, so reload can never proceed without -f. This makes the gate skip the wait when swss is not present.

How I did it

In _per_namespace_swss_ready(), check the service's systemd LoadState first. If it is not-found (service not built into the image) or masked, return ready — there is no swss to wait for. Platforms that ship swss read LoadState=loaded, so the existing active/120s-settle checks are unchanged. Added unit tests for the not-found/masked paths and regression guards for the loaded/inactive and active/settle behavior.

How to verify it

  • pytest tests/config_test.py::TestSwssReady
  • On a platform without swss (swss.service is not-found): config reload -y proceeds instead of aborting.
  • On a switch that ships swss: behavior is unchanged (still waits until swss has been active for >120s).

Previous command output (if the output of a command-line utility has changed)

root@sonic:~# config reload -y
Acquired lock on /etc/sonic/reload.lock
swss container is not ready. Retry later or use -f to avoid system checks
Released lock on /etc/sonic/reload.lock

New command output (if the output of a command-line utility has changed)

root@sonic:~# config reload -y
Acquired lock on /etc/sonic/reload.lock
Running command: ...   # reload proceeds normally
Released lock on /etc/sonic/reload.lock

Signed-off-by: Sonic Build Admin sonicbld@microsoft.com

#### What I did
`config reload` (without `-f`) fails on platforms that do not ship the swss container (e.g. BMC) with `swss container is not ready. Retry later or use -f to avoid system checks`. The readiness gate waits on a `swss.service` that does not exist on such images, so reload can never proceed without `-f`. This makes the gate skip the wait when swss is not present.

#### How I did it
In `_per_namespace_swss_ready()`, check the service's systemd `LoadState` first. If it is `not-found` (service not built into the image) or `masked`, return ready — there is no swss to wait for. Platforms that ship swss read `LoadState=loaded`, so the existing active/120s-settle checks are unchanged. Added unit tests for the not-found/masked paths and regression guards for the loaded/inactive and active/settle behavior.

#### How to verify it
- `pytest tests/config_test.py::TestSwssReady`
- On a platform without swss (`swss.service` is `not-found`): `config reload -y` proceeds instead of aborting.
- On a switch that ships swss: behavior is unchanged (still waits until swss has been active for >120s).

#### Previous command output (if the output of a command-line utility has changed)
```
root@sonic:~# config reload -y
Acquired lock on /etc/sonic/reload.lock
swss container is not ready. Retry later or use -f to avoid system checks
Released lock on /etc/sonic/reload.lock
```

#### New command output (if the output of a command-line utility has changed)
```
root@sonic:~# config reload -y
Acquired lock on /etc/sonic/reload.lock
Running command: ...   # reload proceeds normally
Released lock on /etc/sonic/reload.lock
```

Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator Author

Original PR: sonic-net/sonic-utilities#4606

@mssonicbld

Copy link
Copy Markdown
Collaborator Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@mssonicbld mssonicbld merged commit 69c164d into Azure:202608 Jul 1, 2026
4 checks passed
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.

1 participant