[PATCH perl-rs v3 11/40] pve-rs: resource-scheduling: remove pedantic error handling from remove_service_usage

Daniel Kral
2026-03-30T14:40:53Z

The error can only happen due to an error in
add_service_usage_to_node(...), but prevents all the following
node services entries from being cleaned up correctly.

While technically a API break, removing the error does not change any
callers.

This change makes the implementation more consistent with the new
proxmox_resource_scheduling::usage::Usage, which will replace this in
a following patch.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
Reviewed-by: Dominik Rusovac <d.rusovac@proxmox.com>
---
changes v2 -> v3:
- none

pve-rs/src/bindings/resource_scheduling_static.rs | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/pve-rs/src/bindings/resource_scheduling_static.rs b/pve-rs/src/bindings/resource_scheduling_static.rs
index 6e57b9d..b8eac57 100644
--- a/pve-rs/src/bindings/resource_scheduling_static.rs
+++ b/pve-rs/src/bindings/resource_scheduling_static.rs
@@ -145,25 +145,16 @@ pub mod pve_rs_resource_scheduling_static {

/// Method: Remove service `sid` and its usage from all assigned nodes.
#[export]
- fn remove_service_usage(#[try_from_ref] this: &Scheduler, sid: &str) -> Result<(), Error> {
+ fn remove_service_usage(#[try_from_ref] this: &Scheduler, sid: &str) {
let mut usage = this.inner.lock().unwrap();

if let Some(nodes) = usage.service_nodes.remove(sid) {
for nodename in &nodes {
- match usage.nodes.get_mut(nodename) {
- Some(node) => {
- node.services.remove(sid);
- }
- None => bail!(
- "service '{}' not present in usage hashmap on node '{}'",
- sid,
- nodename
- ),
+ if let Some(node) = usage.nodes.get_mut(nodename) {
+ node.services.remove(sid);
}
}
}
-
- Ok(())
}

/// Scores all previously added nodes for starting a `service` on.
--
2.47.3