[PATCH proxmox v3 03/40] resource-scheduling: rename service to resource where appropriate

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

The term `resource` is more appropriate with respect to the crate name
and also the preferred name for the current main application in the HA
Manager.

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

proxmox-resource-scheduling/src/pve_static.rs | 2 +-
proxmox-resource-scheduling/src/scheduler.rs | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/proxmox-resource-scheduling/src/pve_static.rs b/proxmox-resource-scheduling/src/pve_static.rs
index 5df0be37..c7e1d1b1 100644
--- a/proxmox-resource-scheduling/src/pve_static.rs
+++ b/proxmox-resource-scheduling/src/pve_static.rs
@@ -62,5 +62,5 @@ pub fn score_nodes_to_start_service<T: AsRef<StaticNodeUsage>>(
nodes: &[T],
service: &StaticServiceUsage,
) -> Result<Vec<(String, f64)>, Error> {
- scheduler::score_nodes_to_start_service(nodes, service)
+ scheduler::score_nodes_to_start_resource(nodes, service)
}
diff --git a/proxmox-resource-scheduling/src/scheduler.rs b/proxmox-resource-scheduling/src/scheduler.rs
index 385015e3..39ee44ce 100644
--- a/proxmox-resource-scheduling/src/scheduler.rs
+++ b/proxmox-resource-scheduling/src/scheduler.rs
@@ -22,14 +22,14 @@ criteria_struct! {
static PVE_HA_TOPSIS_CRITERIA;
}

-/// Scores candidate `nodes` to start a `service` on. Scoring is done according to the static memory
-/// and CPU usages of the nodes as if the service would already be running on each.
+/// Scores candidate `nodes` to start a `resource` on. Scoring is done according to the static memory
+/// and CPU usages of the nodes as if the resource would already be running on each.
///
/// Returns a vector of (nodename, score) pairs. Scores are between 0.0 and 1.0 and a higher score
/// is better.
-pub fn score_nodes_to_start_service<T: AsRef<StaticNodeUsage>>(
+pub fn score_nodes_to_start_resource<T: AsRef<StaticNodeUsage>>(
nodes: &[T],
- service: &StaticServiceUsage,
+ resource: &StaticServiceUsage,
) -> Result<Vec<(String, f64)>, Error> {
let len = nodes.len();

@@ -46,10 +46,10 @@ pub fn score_nodes_to_start_service<T: AsRef<StaticNodeUsage>>(
for (index, node) in nodes.iter().enumerate() {
let node = node.as_ref();
let new_cpu = if index == target_index {
- if service.maxcpu == 0.0 {
+ if resource.maxcpu == 0.0 {
node.cpu + node.maxcpu as f64
} else {
- node.cpu + service.maxcpu
+ node.cpu + resource.maxcpu
}
} else {
node.cpu
@@ -58,7 +58,7 @@ pub fn score_nodes_to_start_service<T: AsRef<StaticNodeUsage>>(
squares_cpu += new_cpu.powi(2);

let new_mem = if index == target_index {
- node.mem + service.maxmem
+ node.mem + resource.maxmem
} else {
node.mem
} as f64
--
2.47.3