From: Jonas Theisen <j.theisen@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup 07/14] fix #7904: Implement "Enable" checkbox for GC jobs
Date: Wed, 30 Sep 2026 17:18:05 +0200 [thread overview]
Message-ID: <20260930152131.317493-8-j.theisen@proxmox.com> (raw)
In-Reply-To: <20260930152131.317493-1-j.theisen@proxmox.com>
To allow users to disable a garbage-collection without
having to remove the schedule this patch introduces
an "Enable" checkbox.
The value is inserted into the datastore config and honored by
the scheduler by skipping GC if enabled is not set.
If the value is not present it is assumed GC should run
for backwards compatibility.
If the checkbox is unchecked the schedule input box in the UI is also
disabled and such is configured to not allow empty inputs anymore.
Signed-off-by: Jonas Theisen <j.theisen@proxmox.com>
---
src/api2/admin/datastore.rs | 1 +
src/api2/admin/gc.rs | 16 +++++++++++++-
src/api2/config/datastore.rs | 4 ++++
src/bin/proxmox-backup-proxy.rs | 8 +++++++
www/config/GCView.js | 2 ++
www/window/GCJobEdit.js | 39 ++++++++++++++++++++++++++++-----
6 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs
index bc2b2436e..641d4ee0e 100644
--- a/src/api2/admin/datastore.rs
+++ b/src/api2/admin/datastore.rs
@@ -1258,6 +1258,7 @@ pub fn garbage_collection_status(
let mut info = GarbageCollectionJobStatus {
store: store.clone(),
schedule: store_config.gc_schedule,
+ enable: store_config.gc_enable,
..Default::default()
};
diff --git a/src/api2/admin/gc.rs b/src/api2/admin/gc.rs
index bca06897b..4bbce7255 100644
--- a/src/api2/admin/gc.rs
+++ b/src/api2/admin/gc.rs
@@ -45,7 +45,21 @@ pub fn list_all_gc_jobs(
.collect::<Vec<_>>(),
};
- Ok(gc_info)
+ let mut list = Vec::new();
+
+ for mut job in gc_info {
+ let enabled = match job.enable {
+ Some(c) => c,
+ None => true,
+ };
+ if !enabled {
+ job.next_run = Some(0);
+ }
+
+ list.push(job);
+ }
+
+ Ok(list)
}
const GC_ROUTER: Router = Router::new().get(&API_METHOD_LIST_ALL_GC_JOBS);
diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs
index e7028480c..3c372b7f6 100644
--- a/src/api2/config/datastore.rs
+++ b/src/api2/config/datastore.rs
@@ -571,6 +571,10 @@ pub fn update_datastore(
data.gc_on_unmount = update.gc_on_unmount;
}
+ if update.gc_enable.is_some() {
+ data.gc_enable = update.gc_enable;
+ }
+
macro_rules! prune_disabled {
($(($param:literal, $($member:tt)+)),+) => {
$(
diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
index af3ebb7a7..c974da4bd 100644
--- a/src/bin/proxmox-backup-proxy.rs
+++ b/src/bin/proxmox-backup-proxy.rs
@@ -537,6 +537,14 @@ async fn schedule_datastore_garbage_collection() {
}
};
+ let gc_enabled = match store_config.gc_enable {
+ Some(c) => c,
+ None => true, //if not defined assume enabled for backwards compatibility
+ };
+ if !gc_enabled {
+ continue;
+ }
+
let event_str = match store_config.gc_schedule {
Some(event_str) => event_str,
None => continue,
diff --git a/www/config/GCView.js b/www/config/GCView.js
index 9fcc22344..5077f0566 100644
--- a/www/config/GCView.js
+++ b/www/config/GCView.js
@@ -5,6 +5,7 @@ Ext.define('pbs-gc-jobs-status', {
'upid',
'removed-bytes',
'pending-bytes',
+ 'enable',
'schedule',
'next-run',
'last-run-endtime',
@@ -73,6 +74,7 @@ Ext.define('PBS.config.GCJobView', {
datastore: data.store,
id: data.store,
schedule: data.schedule,
+ enable: data.enable,
listeners: {
destroy: () => this.reload(),
},
diff --git a/www/window/GCJobEdit.js b/www/window/GCJobEdit.js
index 6afcf7de1..e1a94754d 100644
--- a/www/window/GCJobEdit.js
+++ b/www/window/GCJobEdit.js
@@ -19,10 +19,39 @@ Ext.define('PBS.window.GCJobEdit', {
return {};
},
- items: {
- xtype: 'pbsCalendarEvent',
- name: 'gc-schedule',
- fieldLabel: gettext('GC Schedule'),
- emptyText: gettext('none (disabled)'),
+ setValues: function (values) {
+ let me = this;
+ if (!values['gc-schedule'] || values['gc-schedule'] === '') {
+ values['gc-enable'] = false;
+ }
+ me.callParent([values]);
},
+
+ items: [
+ {
+ xtype: 'proxmoxcheckbox',
+ fieldLabel: gettext('Enable'),
+ name: 'gc-enable',
+ autoEl: {
+ tag: 'div',
+ 'data-qtip': gettext('Enable scheduled execution of this task.'),
+ },
+ listeners: {
+ change: function (field, enabled) {
+ let me = this;
+ let view = me.up('pbsGCJobEdit');
+ let schedule = view.down('field[name=gc-schedule]');
+ schedule.setDisabled(!enabled);
+ },
+ },
+ uncheckedValue: false,
+ value: true,
+ },
+ {
+ xtype: 'pbsCalendarEvent',
+ name: 'gc-schedule',
+ fieldLabel: gettext('GC Schedule'),
+ allowBlank: false,
+ },
+ ],
});
--
2.47.3
next prev parent reply other threads:[~2026-09-30 15:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 15:17 [PATCH proxmox{,-backup} 00/14] fix #7904: Implement Enable checkboxes for all jobs Jonas Theisen
2026-09-30 15:17 ` [PATCH proxmox 01/14] fix #7904: Add 'enable' to sync job schema Jonas Theisen
2026-09-30 15:18 ` [PATCH proxmox 02/14] fix #7904: Add 'enable' to verify " Jonas Theisen
2026-09-30 15:18 ` [PATCH proxmox 03/14] fix #7904: Add 'enable' to datastore config and GC " Jonas Theisen
2026-09-30 15:18 ` [PATCH proxmox 04/14] fix #7904: Add 'enable' to Tape backup " Jonas Theisen
2026-09-30 15:18 ` [PATCH proxmox-backup 05/14] fix #7904: Implement "Enable" checkbox for Sync jobs Jonas Theisen
2026-09-30 15:18 ` [PATCH proxmox-backup 06/14] fix #7904: Implement "Enable" checkbox for Verify jobs Jonas Theisen
2026-09-30 15:18 ` Jonas Theisen [this message]
2026-09-30 15:18 ` [PATCH proxmox-backup 08/14] fix #7904: Implement "Enable" checkbox for Tape backup jobs Jonas Theisen
2026-09-30 15:18 ` [PATCH proxmox-backup 09/14] fix #7904: Improve visibility of disabled GC on the overview page Jonas Theisen
2026-09-30 15:18 ` [PATCH proxmox-backup 10/14] fix #7904: Improve visibility of disabled Verify jobs " Jonas Theisen
2026-09-30 15:18 ` [PATCH proxmox-backup 11/14] fix #7904: Improve visibility of disabled Sync " Jonas Theisen
2026-09-30 15:18 ` [PATCH proxmox-backup 12/14] fix #7904: Improve visibility of disabled Tape Backup " Jonas Theisen
2026-09-30 15:18 ` [PATCH proxmox-backup 13/14] fix #7904: Remove clear button from calendar selector Jonas Theisen
2026-09-30 15:18 ` [PATCH proxmox-backup 14/14] fix #7904: Align Prune Edit window to other "Enable" checkboxes Jonas Theisen
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=20260930152131.317493-8-j.theisen@proxmox.com \
--to=j.theisen@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox