From: "Michael Köppl" <m.koeppl@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH test-tools 3/4] instance: source certificate and task types directly
Date: Thu, 10 Sep 2026 18:20:29 +0200 [thread overview]
Message-ID: <20260910162030.1776719-4-m.koeppl@proxmox.com> (raw)
In-Reply-To: <20260910162030.1776719-1-m.koeppl@proxmox.com>
Both types pdm-api-types provided here were a detour. CertificateInfo is
its re-export of proxmox_acme_api::CertificateInfo, so take it from
there. TaskStateType is simple enough to warrant a direct declaration
here.
This leaves proxmox-test-instance free of pdm crates.
Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
proxmox-test-instance/Cargo.toml | 2 +-
proxmox-test-instance/src/api/pve_client.rs | 26 +++++++++++++++++++--
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/proxmox-test-instance/Cargo.toml b/proxmox-test-instance/Cargo.toml
index 5a7c333..9cbfc9b 100644
--- a/proxmox-test-instance/Cargo.toml
+++ b/proxmox-test-instance/Cargo.toml
@@ -9,7 +9,6 @@ repository.workspace = true
[dependencies]
proxmox-test-common = { workspace = true }
-pdm-api-types = { workspace = true }
anyhow.workspace = true
dirs-next.workspace = true
@@ -28,6 +27,7 @@ termcolor.workspace = true
tokio = { workspace = true, features = [ "rt" ]}
toml.workspace = true
+proxmox-acme-api.workspace = true
proxmox-async.workspace = true
proxmox-auth-api = { workspace = true, features = [ "api-types" ] }
proxmox-client = { workspace = true, features = ["hyper-client"] }
diff --git a/proxmox-test-instance/src/api/pve_client.rs b/proxmox-test-instance/src/api/pve_client.rs
index f719895..4e4c1f4 100644
--- a/proxmox-test-instance/src/api/pve_client.rs
+++ b/proxmox-test-instance/src/api/pve_client.rs
@@ -2,7 +2,7 @@ use std::net::Ipv4Addr;
use std::{collections::HashSet, sync::Arc, time::Duration};
use anyhow::{Context, Error, bail};
-use pdm_api_types::{CertificateInfo, TaskStateType};
+use proxmox_acme_api::CertificateInfo;
use proxmox_client::{AuthenticationKind, Client, HttpApiClient, HttpApiResponse, TlsOptions};
use proxmox_http::HttpOptions;
use proxmox_login::Login;
@@ -33,6 +33,28 @@ const SHUTDOWN_TIMEOUT_SECS: u64 = 300;
/// This does not cancel the server-side task; large or slow operations can outlive this deadline.
const TASK_TIMEOUT: Duration = Duration::from_secs(60 * 60);
+/// The state a finished PVE task ended up in, as derived from its exit status.
+enum TaskStateType {
+ Ok,
+ Warning,
+ Error,
+ Unknown,
+}
+
+impl TaskStateType {
+ fn new_from_str(status: &str) -> Self {
+ if status == "unknown" || status.is_empty() {
+ TaskStateType::Unknown
+ } else if status == "OK" {
+ TaskStateType::Ok
+ } else if status.starts_with("WARNINGS: ") {
+ TaskStateType::Warning
+ } else {
+ TaskStateType::Error
+ }
+ }
+}
+
#[derive(Debug)]
struct TaskFailure {
upid: String,
@@ -1049,7 +1071,7 @@ where
let exitstatus = value["exitstatus"].as_str().unwrap_or("unknown");
return match TaskStateType::new_from_str(exitstatus) {
- TaskStateType::OK | TaskStateType::Warning => Ok(()),
+ TaskStateType::Ok | TaskStateType::Warning => Ok(()),
TaskStateType::Error | TaskStateType::Unknown => {
bail!(TaskFailure {
upid: upid.to_string(),
--
2.47.3
next prev parent reply other threads:[~2026-09-10 16:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 16:20 [PATCH test-tools 0/4] remove PDM submodule Michael Köppl
2026-09-10 16:20 ` [PATCH test-tools 1/4] scheduler: drop the unused pdm-api-types dependency Michael Köppl
2026-09-10 16:20 ` [PATCH test-tools 2/4] instance: register PDM remotes without pdm-client Michael Köppl
2026-09-10 16:20 ` Michael Köppl [this message]
2026-09-10 16:20 ` [PATCH test-tools 4/4] buildsys: drop the proxmox-datacenter-manager submodule Michael Köppl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260910162030.1776719-4-m.koeppl@proxmox.com \
--to=m.koeppl@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.