all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager v3 08/12] remote updates: add support for PBS remotes
Date: Thu, 23 Oct 2025 14:44:16 +0200	[thread overview]
Message-ID: <20251023124420.244585-9-l.wagner@proxmox.com> (raw)
In-Reply-To: <20251023124420.244585-1-l.wagner@proxmox.com>

The 'update_apt_database' function starts a new tracked remote task. The
remote task infrastructure needs a bit more work to work with PBS UPIDs,
so the code is commented out for now.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Shannon Sterz <s.sterz@proxmox.com>
Tested-by: Shannon Sterz <s.sterz@proxmox.com>
---
 server/src/api/pbs/mod.rs    | 15 ++++++++++++++-
 server/src/remote_updates.rs | 37 +++++++++++++++++++++++++++++++-----
 2 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/server/src/api/pbs/mod.rs b/server/src/api/pbs/mod.rs
index ad82ab38..56192c01 100644
--- a/server/src/api/pbs/mod.rs
+++ b/server/src/api/pbs/mod.rs
@@ -9,13 +9,17 @@ use proxmox_sortable_macro::sortable;
 use pdm_api_types::remotes::{
     NodeUrl, Remote, RemoteListEntry, RemoteType, TlsProbeOutcome, REMOTE_ID_SCHEMA,
 };
-use pdm_api_types::{Authid, HOST_OPTIONAL_PORT_FORMAT, PRIV_RESOURCE_AUDIT, PRIV_SYS_MODIFY};
+use pdm_api_types::{
+    Authid, RemoteUpid, HOST_OPTIONAL_PORT_FORMAT, PRIV_RESOURCE_AUDIT, PRIV_SYS_MODIFY,
+};
 
 use crate::{
     connection::{self, probe_tls_connection},
     pbs_client::{self, get_remote, PbsClient},
 };
 
+use crate::remote_tasks;
+
 mod rrddata;
 
 pub const ROUTER: Router = Router::new()
@@ -65,6 +69,15 @@ const DATASTORE_ITEM_SUBDIRS: SubdirMap = &sorted!([
     ),
 ]);
 
+// converts a remote + pbs_api_types::UPID into a RemoteUpid and starts tracking it
+pub async fn new_remote_upid(
+    remote: String,
+    upid: pbs_api_types::UPID,
+) -> Result<RemoteUpid, Error> {
+    let remote_upid = remote_tasks::track_running_pbs_task(remote, upid).await?;
+    Ok(remote_upid)
+}
+
 #[api(
     returns: {
         type: Array,
diff --git a/server/src/remote_updates.rs b/server/src/remote_updates.rs
index c7b678b8..cdba7f18 100644
--- a/server/src/remote_updates.rs
+++ b/server/src/remote_updates.rs
@@ -14,7 +14,6 @@ use pdm_api_types::remotes::{Remote, RemoteType};
 use pdm_api_types::RemoteUpid;
 use pdm_buildcfg::PDM_CACHE_DIR_M;
 
-use crate::api::pve::new_remote_upid;
 use crate::connection;
 use crate::parallel_fetcher::{NodeResults, ParallelFetcher};
 
@@ -64,9 +63,22 @@ pub async fn update_apt_database(remote: &Remote, node: &str) -> Result<RemoteUp
             };
             let upid = client.update_apt_database(node, params).await?;
 
-            new_remote_upid(remote.id.clone(), upid).await
+            crate::api::pve::new_remote_upid(remote.id.clone(), upid).await
+        }
+        RemoteType::Pbs => {
+            // let client = connection::make_pbs_client(remote)?;
+            //
+            // let params = crate::pbs_client::AptUpdateParams {
+            //     notify: Some(false),
+            //     quiet: Some(false),
+            // };
+            // let upid = client.update_apt_database(params).await?;
+            //
+            // crate::api::pbs::new_remote_upid(remote.id.clone(), upid).await
+            // TODO: task infrastructure for PBS not finished yet, uncomment once
+            // this is done.
+            bail!("PBS is not supported yet");
         }
-        RemoteType::Pbs => bail!("PBS is not supported yet"),
     }
 }
 
@@ -81,7 +93,14 @@ pub async fn get_changelog(remote: Remote, node: &str, package: String) -> Resul
                 .await
                 .map_err(Into::into)
         }
-        RemoteType::Pbs => bail!("PBS is not supported yet"),
+        RemoteType::Pbs => {
+            let client = connection::make_pbs_client(&remote)?;
+
+            client
+                .get_package_changelog(package, None)
+                .await
+                .map_err(Into::into)
+        }
     }
 }
 
@@ -252,7 +271,15 @@ async fn fetch_available_updates(
                 updates,
             })
         }
-        RemoteType::Pbs => bail!("PBS is not supported yet"),
+        RemoteType::Pbs => {
+            let client = connection::make_pbs_client(&remote)?;
+            let updates = client.list_available_updates().await?;
+
+            Ok(NodeUpdateInfo {
+                last_refresh: proxmox_time::epoch_i64(),
+                updates,
+            })
+        }
     }
 }
 
-- 
2.47.3



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  parent reply	other threads:[~2025-10-23 12:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 12:44 [pdm-devel] [PATCH datacenter-manager v3 00/12] add global remote update view Lukas Wagner
2025-10-23 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 01/12] pdm-api-types: add types for remote upgrade summary Lukas Wagner
2025-10-23 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 02/12] remote updates: add cache for remote update availability Lukas Wagner
2025-10-23 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 03/12] api: add API for retrieving/refreshing the remote update summary Lukas Wagner
2025-10-23 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 04/12] unprivileged api daemon: tasks: add remote update refresh task Lukas Wagner
2025-10-23 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 05/12] pdm-client: add API methods for remote update summaries Lukas Wagner
2025-10-23 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 06/12] pbs-client: add bindings for APT-related API calls Lukas Wagner
2025-10-23 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 07/12] task cache: use separate functions for tracking PVE and PBS tasks Lukas Wagner
2025-10-23 12:44 ` Lukas Wagner [this message]
2025-10-23 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 09/12] api: add APT endpoints for PBS remotes Lukas Wagner
2025-10-23 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 10/12] ui: add remote update view Lukas Wagner
2025-10-23 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 11/12] ui: show new remote update view in the 'Remotes' section Lukas Wagner
2025-10-23 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 12/12] remote updates: avoid unnecessary clone Lukas Wagner
2025-10-23 20:30 ` [pdm-devel] applied-series: [PATCH datacenter-manager v3 00/12] add global remote update view Thomas Lamprecht

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=20251023124420.244585-9-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pdm-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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal