all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [RFC storage 3/3] close #7204: lvm thin plugin: die if thin pool does not have zeroing configured
Date: Thu,  5 Feb 2026 17:38:06 +0100	[thread overview]
Message-ID: <20260205163819.219322-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260205163819.219322-1-f.ebner@proxmox.com>

Thin pools with zeroing during allocation turned off are currently not
supported for VM images. Using such a pool may lead to data
corruption for various operations like drive mirror.

In the future, a dedicated storage configuration option could be
introduced that can be checked by volume_has_feature() and enforced
upon storage activation.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

RFC - it is rather noisy since pvestatd will log it every time, OTOH
it may cause data corruption so being noisy can be justified. An
alternative might be to just automatically set it after detecting that
the flag is missing and only warn once, mentioning that that this is
done, but might be too much automagic.

 src/PVE/Storage/LvmThinPlugin.pm | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Storage/LvmThinPlugin.pm b/src/PVE/Storage/LvmThinPlugin.pm
index 256ec43..dae40b6 100644
--- a/src/PVE/Storage/LvmThinPlugin.pm
+++ b/src/PVE/Storage/LvmThinPlugin.pm
@@ -6,6 +6,7 @@ use warnings;
 use IO::File;
 
 use PVE::JSONSchema qw(get_standard_option);
+use PVE::RESTEnvironment qw(log_warn);
 use PVE::Tools qw(run_command trim);
 
 use PVE::Storage::Plugin;
@@ -263,7 +264,21 @@ sub activate_storage {
 
     $class->SUPER::activate_storage($storeid, $scfg, $cache);
 
-    $activate_lv->($scfg->{vgname}, $scfg->{thinpool}, $cache);
+    my ($vg_name, $thin_pool) = $scfg->@{qw(vgname thinpool)};
+
+    $activate_lv->($vg_name, $thin_pool, $cache);
+
+    if ($scfg->{content}->{images}) {
+        my $lvs = $cache->{lvs} ||= PVE::Storage::LVMPlugin::lvm_list_volumes();
+        my $thin_pool_zero = $lvs->{$vg_name}->{$thin_pool}->{zero};
+        if (!defined($thin_pool_zero) || $thin_pool_zero ne 'zero') {
+            # TODO Add dedicated storage configuration option to support thin pools without zero to
+            # allow cheap checking in volume_has_feature() and check that it matches here.
+            # TODO PVE 10 - enforce?
+            log_warn("$storeid: thin pool without zeroing is not supported for VM images!"
+                . " Use 'lvchange -Z y $vg_name/$thin_pool' to enable zeroing");
+        }
+    }
 }
 
 sub activate_volume {
-- 
2.47.3





      parent reply	other threads:[~2026-02-05 16:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 16:38 [PATCH-SERIES docs/storage 0/3] close #7204: document and check that thin pools have zeroing enabled Fiona Ebner
2026-02-05 16:38 ` [PATCH docs 1/3] close #7204: storage: lvm thin: document that thin pools must " Fiona Ebner
2026-02-05 16:38 ` [RFC storage 2/3] lvm plugin: list volumes: also query 'zero' property Fiona Ebner
2026-02-05 16:38 ` Fiona Ebner [this message]

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