[pdm-devel] [PATCH datacenter-manager 2/7] pbs-client: add bindings for task list, task status, task log
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Nov 12 21:23:40 CET 2025
Am 12.11.25 um 10:42 schrieb Lukas Wagner:
> diff --git a/server/src/pbs_client.rs b/server/src/pbs_client.rs
> index 49087360..4285f402 100644
> --- a/server/src/pbs_client.rs
> +++ b/server/src/pbs_client.rs
> @@ -125,6 +125,75 @@ pub struct AptUpdateParams {
> pub quiet: Option<bool>,
> }
>
> +// TODO: This is incomplete, it only contains the parameters needed for remote task fetching.
> +// Ideally, the task list API in PBS would use a parameter struct defined in pbs-api-types, which
> +// is then also used here.
As we have tasks in all projects it certainly can be something very common,
and some thought that crossed my mind more than once was splitting out upid
from the proxmox-schema crate, while I can relate to why it got placed there
initially, it just feels like the wrong place. In a dedicated proxmox-task
or proxmox-upid or the like crate these types here might also fit well in.
> +#[derive(Debug, Default, Deserialize, Serialize)]
> +pub struct ListTasks {
> + /// Only list this number of tasks.
> + #[serde(default, skip_serializing_if = "Option::is_none")]
> + pub limit: Option<u64>,
> +
> + /// Only list tasks since this UNIX epoch.
> + #[serde(default, skip_serializing_if = "Option::is_none")]
> + pub since: Option<i64>,
> +}
> +
> +// TODO: The task-status APIs in PBS as well as PDM don't have a
> +// proper type defined anywhere. This should be moved to a shared crate
> +// and then the API handlers adapted.
> +#[derive(Debug, Deserialize, Serialize)]
> +pub struct TaskStatus {
> + pub exitstatus: Option<String>,
> +
> + pub id: Option<String>,
> +
> + pub node: String,
> +
> + pub pid: i64,
> +
> + pub pstart: i64,
> +
> + pub starttime: i64,
> +
> + pub status: IsRunning,
> +
> + #[serde(rename = "type")]
> + pub ty: String,
> +
> + pub upid: String,
> +
> + pub user: String,
> +}
> +
> +#[derive(Debug, Deserialize, Serialize, PartialEq)]
> +#[serde(rename_all = "kebab-case")]
> +pub enum IsRunning {
> + Running,
> + Stopped,
> +}
> +
> +impl TaskStatus {
> + /// Checks if the task is currently running.
> + pub fn is_running(&self) -> bool {
> + self.status == IsRunning::Running
> + }
> +}
> +
More information about the pdm-devel
mailing list