[PATCH perl-rs v2 10/40] pve-rs: resource-scheduling: remove pedantic error handling from remove_node

Daniel Kral
2026-03-24T18:30:40Z

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

While technically a API break, removing the error does not change any
callers, which do not handle the error anyway. Additionally,
remove_node(...) is only used in testing code in this package and
pve-ha-manager, but is currently unused for production code.

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>
---
changes v1 -> v2:
- new!

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 5b91d36..6e57b9d 100644
--- a/pve-rs/src/bindings/resource_scheduling_static.rs
+++ b/pve-rs/src/bindings/resource_scheduling_static.rs
@@ -75,25 +75,16 @@ pub mod pve_rs_resource_scheduling_static {

/// Method: Remove a node from the scheduler.
#[export]
- pub fn remove_node(#[try_from_ref] this: &Scheduler, nodename: &str) -> Result<(), Error> {
+ pub fn remove_node(#[try_from_ref] this: &Scheduler, nodename: &str) {
let mut usage = this.inner.lock().unwrap();

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

/// Method: Get a list of all the nodes in the scheduler.
--
2.47.3