[pbs-devel] [PATCH proxmox-backup 2/2] api: create default garbage collection schedule

Christian Ebner c.ebner at proxmox.com
Wed Nov 29 12:36:37 CET 2023


Create a default garbage collection schedule when a datastore is created
as part of a disk/zpool creation transaction via e.g.
`proxmox-backup-manager disk fs create <storage-name> --disk <block-device>
--add-datastore true`

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 src/api2/node/disks/directory.rs | 5 +++--
 src/api2/node/disks/zfs.rs       | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
index 89260b8e..a3e1ba71 100644
--- a/src/api2/node/disks/directory.rs
+++ b/src/api2/node/disks/directory.rs
@@ -196,8 +196,9 @@ pub fn create_datastore_disk(
 
             if add_datastore {
                 let lock = pbs_config::datastore::lock_config()?;
-                let datastore: DataStoreConfig =
-                    serde_json::from_value(json!({ "name": name, "path": mount_point }))?;
+                let datastore: DataStoreConfig = serde_json::from_value(
+                    json!({ "name": name, "path": mount_point, "gc-schedule": String::from("daily") }),
+                )?;
 
                 let (config, _digest) = pbs_config::datastore::config()?;
 
diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
index 7bc46986..7b8a3891 100644
--- a/src/api2/node/disks/zfs.rs
+++ b/src/api2/node/disks/zfs.rs
@@ -311,8 +311,9 @@ pub fn create_zpool(
 
             if add_datastore {
                 let lock = pbs_config::datastore::lock_config()?;
-                let datastore: DataStoreConfig =
-                    serde_json::from_value(json!({ "name": name, "path": mount_point }))?;
+                let datastore: DataStoreConfig = serde_json::from_value(
+                    json!({ "name": name, "path": mount_point, "gc-scheudle": String::from("daily") }),
+                )?;
 
                 let (config, _digest) = pbs_config::datastore::config()?;
 
-- 
2.39.2





More information about the pbs-devel mailing list