public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/2] api: create default garbage collection schedule
Date: Wed, 29 Nov 2023 12:36:37 +0100	[thread overview]
Message-ID: <20231129113637.204053-3-c.ebner@proxmox.com> (raw)
In-Reply-To: <20231129113637.204053-1-c.ebner@proxmox.com>

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@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





  parent reply	other threads:[~2023-11-29 11:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 11:36 [pbs-devel] [PATCH proxmox-backup 0/2] add default prune job and gc-schedule Christian Ebner
2023-11-29 11:36 ` [pbs-devel] [PATCH proxmox-backup 1/2] api: create default prune job on datastore creation Christian Ebner
2023-11-29 13:27   ` Fabian Grünbichler
2023-11-29 13:31     ` Thomas Lamprecht
2023-11-29 13:54     ` Christian Ebner
2023-11-29 11:36 ` Christian Ebner [this message]
2023-11-29 13:27   ` [pbs-devel] [PATCH proxmox-backup 2/2] api: create default garbage collection schedule Fabian Grünbichler

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=20231129113637.204053-3-c.ebner@proxmox.com \
    --to=c.ebner@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal