From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage] api: disks: zfs: enable monthly scrub when creating a pool
Date: Tue, 27 Aug 2024 15:52:39 +0200 [thread overview]
Message-ID: <20240827135239.332986-1-m.sandoval@proxmox.com> (raw)
And disable it when destroying the pool.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
I think this should be safe to enable by default on a monthly basis. Please tell
me if this is something that should be enabled via a new API parameter.
src/PVE/API2/Disks/ZFS.pm | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/PVE/API2/Disks/ZFS.pm b/src/PVE/API2/Disks/ZFS.pm
index 6fb6bd6b..022710b4 100644
--- a/src/PVE/API2/Disks/ZFS.pm
+++ b/src/PVE/API2/Disks/ZFS.pm
@@ -490,6 +490,13 @@ __PACKAGE__->register_method ({
run_command($cmd);
}
+ if (-e '/lib/systemd/system/zfs-scrub-monthly@.timer') {
+ my $scrubtimer = 'zfs-scrub-monthly@'. PVE::Systemd::escape_unit($name, undef) . '.timer';
+ $cmd = ['systemctl', 'enable', $scrubtimer];
+ print "# ", join(' ', @$cmd), "\n";
+ run_command($cmd);
+ }
+
PVE::Diskmanage::udevadm_trigger($devs->@*);
if ($param->{add_storage}) {
@@ -583,6 +590,11 @@ __PACKAGE__->register_method ({
run_command(['systemctl', 'disable', $importunit]);
}
+ if (-e '/lib/systemd/system/zfs-scrub-monthly@.timer') {
+ my $scrubtimer = 'zfs-scrub-monthly@' . PVE::Systemd::escape_unit($name) . '.timer';
+ run_command(['systemctl', 'disable', $scrubtimer]);
+ }
+
run_command(['zpool', 'destroy', $name]);
my $config_err;
--
2.39.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
reply other threads:[~2024-08-27 13:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240827135239.332986-1-m.sandoval@proxmox.com \
--to=m.sandoval@proxmox.com \
--cc=pve-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