From 188fcb2b5009d3894210c65aa343d55951bfd728 Mon Sep 17 00:00:00 2001 From: Sonic Build Admin Date: Mon, 13 Jul 2026 18:11:59 +0000 Subject: [PATCH] hamgrd: ignore DPU HA set/scope state deletion messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description of PR `get_dpu_ha_set_state` and `get_dpu_ha_scope_state` previously deserialized every incoming `DASH_HA_SET_STATE` / `DASH_HA_SCOPE_STATE` message regardless of the DB operation. A `Del` message carries empty field values, so it could be misinterpreted as an (empty) state update rather than being ignored. This PR adds an explicit `KeyOperation::Del` check to both accessors so deletion notifications are logged at debug level and skipped (returning `None`), which causes the callers to ignore them. ## Type of change - [x] Bug fix Fix https://github.com/sonic-net/sonic-buildimage/issues/28162 ## Approach **How it works:** Both accessor functions now inspect `kfv.operation` after deserializing the `KeyOpFieldValues`. When the operation is `KeyOperation::Del`, they return `None` early instead of attempting to deserialize the (empty) field values. **How it was verified:** `cargo test -p hamgrd` — all 41 unit tests pass, including the ha_set and ha_scope NPU/DPU suites. Signed-off-by: Sonic Build Admin --- crates/hamgrd/src/actors/ha_scope/base.rs | 5 +++++ crates/hamgrd/src/actors/ha_set.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/crates/hamgrd/src/actors/ha_scope/base.rs b/crates/hamgrd/src/actors/ha_scope/base.rs index 78649102..082bfca5 100644 --- a/crates/hamgrd/src/actors/ha_scope/base.rs +++ b/crates/hamgrd/src/actors/ha_scope/base.rs @@ -160,6 +160,11 @@ impl HaScopeBase { } }; + if kfv.operation == KeyOperation::Del { + debug!("Ignoring DASH_HA_SCOPE_STATE deletion for key={}", kfv.key); + return None; + } + match swss_serde::from_field_values(&kfv.field_values) { Ok(state) => Some(state), Err(e) => { diff --git a/crates/hamgrd/src/actors/ha_set.rs b/crates/hamgrd/src/actors/ha_set.rs index de71063e..969d9bca 100644 --- a/crates/hamgrd/src/actors/ha_set.rs +++ b/crates/hamgrd/src/actors/ha_set.rs @@ -157,6 +157,11 @@ impl HaSetActor { } }; + if kfv.operation == KeyOperation::Del { + debug!("Ignoring DASH_HA_SET_STATE deletion for key={}", kfv.key); + return None; + } + match swss_serde::from_field_values(&kfv.field_values) { Ok(state) => Some((kfv.key, state)), Err(e) => {