From: "Gabriel Goller" <g.goller@proxmox.com>
To: "Proxmox Backup Server development discussion"
<pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup 1/8] api: garbage collect job status
Date: Mon, 05 Feb 2024 14:58:56 +0100 [thread overview]
Message-ID: <CYX7634MW3YS.2EH7YHBK3T8G@proxmox.com> (raw)
In-Reply-To: <20240205115830.523721-3-s.lendl@proxmox.com>
On Mon Feb 5, 2024 at 12:58 PM CET, Stefan Lendl wrote:
> Adds an api endpoint on the datastore that reports the gc job status
> such as:
> - Schedule
> - State (of last run)
> - Duration (of last run)
> - Last Run
> - Next Run (if scheduled)
> - Pending Chunks (of last run)
> - Removed Chunks (of last run)
>
> Adds a dedicated endpoint admin/gc that reports gc job status for all
> datastores including the onces without a gc-schedule.
>
> Originally-by: Gabriel Goller <g.goller@proxmox.com>
> Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
> ---
> pbs-api-types/src/datastore.rs | 40 ++++++++++
> src/api2/admin/datastore.rs | 129 ++++++++++++++++++++++++++++++++-
> src/api2/admin/gc.rs | 57 +++++++++++++++
> src/api2/admin/mod.rs | 2 +
> src/api2/admin/prune.rs | 3 +
> 5 files changed, 228 insertions(+), 3 deletions(-)
> mode change 100644 => 100755 src/api2/admin/datastore.rs
> create mode 100644 src/api2/admin/gc.rs
>
> diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
> index cce9888b..ba3879c9 100644
> --- a/pbs-api-types/src/datastore.rs
> +++ b/pbs-api-types/src/datastore.rs
> @@ -1270,6 +1270,46 @@ pub struct GarbageCollectionStatus {
> pub still_bad: usize,
> }
>
> +#[api(
> + properties: {
> + "last-run-upid": {
> + optional: true,
> + type: UPID,
> + },
> + },
> +)]
> +#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)]
> +#[serde(rename_all = "kebab-case")]
> +/// Garbage Collection general info
> +pub struct GarbageCollectionJobStatus {
> + /// Datastore
> + pub store: String,
> + /// upid of the last run gc job
> + #[serde(skip_serializing_if = "Option::is_none")]
> + pub last_run_upid: Option<String>,
> + /// Number of removed chunks
> + #[serde(skip_serializing_if = "Option::is_none")]
> + pub removed_chunks: Option<usize>,
> + /// Number of pending chunks
> + #[serde(skip_serializing_if = "Option::is_none")]
> + pub pending_chunks: Option<usize>,
> + /// Schedule of the gc job
> + #[serde(skip_serializing_if = "Option::is_none")]
> + pub schedule: Option<String>,
> + /// Time of the next gc run
> + #[serde(skip_serializing_if = "Option::is_none")]
> + pub next_run: Option<i64>,
> + /// Endtime of the last gc run
> + #[serde(skip_serializing_if = "Option::is_none")]
> + pub last_run_endtime: Option<i64>,
> + /// State of the last gc run
> + #[serde(skip_serializing_if = "Option::is_none")]
> + pub last_run_state: Option<String>,
> + /// Duration of last gc run
> + #[serde(skip_serializing_if = "Option::is_none")]
> + pub duration: Option<i64>,
> +}
> +
> #[api(
> properties: {
> "gc-status": {
> diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
> old mode 100644
> new mode 100755
> index a95031e7..c46d7506
> --- a/src/api2/admin/datastore.rs
> +++ b/src/api2/admin/datastore.rs
> @@ -10,6 +10,7 @@ use anyhow::{bail, format_err, Error};
> use futures::*;
> use hyper::http::request::Parts;
> use hyper::{header, Body, Response, StatusCode};
> +use proxmox_time::CalendarEvent;
Please order this import with the other `proxmox_*` imports :)
> [..]
This here is not needed:
> diff --git a/src/api2/admin/prune.rs b/src/api2/admin/prune.rs
> index a5ebf297..4eca0807 100644
> --- a/src/api2/admin/prune.rs
> +++ b/src/api2/admin/prune.rs
> @@ -1,6 +1,7 @@
> //! Datastore Prune Job Management
>
> use anyhow::{format_err, Error};
> +
> use serde_json::Value;
>
> use proxmox_router::{
> @@ -21,6 +22,8 @@ use crate::server::{
> jobstate::{compute_schedule_status, Job, JobState},
> };
>
> +
> +
> #[api(
> input: {
> properties: {
next prev parent reply other threads:[~2024-02-05 13:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 11:58 [pbs-devel] [PATCH proxmox-backup 0/8] Add GC job status to datastore and global prune job view Stefan Lendl
2024-02-05 11:58 ` [pbs-devel] [PATCH proxmox-backup 1/8] api: garbage collect job status Stefan Lendl
2024-02-05 13:58 ` Gabriel Goller [this message]
2024-02-05 11:58 ` [pbs-devel] [PATCH proxmox-backup 2/8] gc: global prune and gc job view Stefan Lendl
2024-02-05 11:58 ` [pbs-devel] [PATCH proxmox-backup 3/8] prune: use NoneText as emptyValue in PruneJobEdit Stefan Lendl
2024-02-05 13:50 ` Gabriel Goller
2024-02-05 11:58 ` [pbs-devel] [PATCH proxmox-backup 4/8] gc: move datastore/PruneAndGC to config/PruneAndGC Stefan Lendl
2024-02-05 11:58 ` [pbs-devel] [PATCH proxmox-backup 5/8] gc: hide datastore column in local gc view Stefan Lendl
2024-02-05 11:58 ` [pbs-devel] [PATCH proxmox-backup 6/8] ui: order Prune&GC before SyncJobs Stefan Lendl
2024-02-05 11:58 ` [pbs-devel] [PATCH proxmox-backup 7/8] cli: list gc jobs with proxmox-backup-manager Stefan Lendl
2024-02-05 11:58 ` [pbs-devel] [PATCH proxmox-backup 8/8] gc: show removed and pending chunks of last run in ui Stefan Lendl
2024-02-05 13:33 ` [pbs-devel] [PATCH proxmox-backup 0/8] Add GC job status to datastore and global prune job view Gabriel Goller
2024-02-06 14:54 ` Stefan Lendl
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=CYX7634MW3YS.2EH7YHBK3T8G@proxmox.com \
--to=g.goller@proxmox.com \
--cc=pbs-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.