From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id C2B871FF13B for ; Mon, 08 Jun 2026 16:06:45 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A12CE1EC6B; Mon, 8 Jun 2026 16:06:45 +0200 (CEST) Content-Type: text/plain; charset=UTF-8 Date: Mon, 08 Jun 2026 16:06:12 +0200 Message-Id: Subject: Re: [PATCH storage v6 1/2] fix #7339: lvmthick: add worker to free space of to be deleted VMs From: =?utf-8?q?Michael_K=C3=B6ppl?= To: "Lukas Sichert" , Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0 References: <20260522130419.94386-1-l.sichert@proxmox.com> <20260522130419.94386-2-l.sichert@proxmox.com> In-Reply-To: <20260522130419.94386-2-l.sichert@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1780927528867 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.091 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: BSBZBIT7IYOZE3ON4KDFSE2TDXY5PWB6 X-Message-ID-Hash: BSBZBIT7IYOZE3ON4KDFSE2TDXY5PWB6 X-MailFrom: m.koeppl@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Left some comments inline. On Fri May 22, 2026 at 3:04 PM CEST, Lukas Sichert wrote: [snip] > - > + my $on_remove_opts; > + if ($scfg->{'on-volume-remove'}) { > + $on_remove_opts =3D > + PVE::JSONSchema::parse_property_string('on-volume-remove', $= scfg->{'on-volume-remove'}); > + } > # we need to zero out LVM data for security reasons > - # and to allow thin provisioning > - my $zero_out_worker =3D sub { > + # and discard images to free storage space to allow > + # thin provisioning > + my $cleanup_worker =3D sub { > + > for my $name (@$volnames) { > my $lvmpath =3D "/dev/$vg/del-$name"; > - print "zero-out data on image $name ($lvmpath)\n"; > + > + my $discard_action; > + if ($scfg->{saferemove} && $on_remove_opts->{'discard'}) { nit: can just be $on_remove_opts->{discard} > + $discard_action =3D 'zero-out data and discard (TRIM)'; > + } elsif ($scfg->{saferemove}) { > + $discard_action =3D 'zero-out data on'; > + } elsif ($on_remove_opts->{'discard'}) { nit: same as above > + $discard_action =3D 'discard (TRIM)'; > + } > + print "$discard_action image $name ($lvmpath)\n"; > =20 > my $cmd_activate =3D ['/sbin/lvchange', '-aly', $lvmpath]; > run_command( > @@ -367,8 +383,18 @@ my sub free_lvm_volumes_locked { > $cmd_activate, > errmsg =3D> "can't refresh LV '$lvmpath' to zero-out its= data", This error message and the one a few lines above it (can't active ...) should also be updated because they're otherwise a bit misleading. Since the cleanup worker is now also called when using just `discard` without `saferemove`, data is not always zeroed-out. > ); > + syslog('info', "starting to $discard_action $name ($lvmpath)= ") > + if defined($discard_action); > =20 > - $secure_delete_cmd->($lvmpath); > + if ($scfg->{saferemove}) { > + print "zero-out data on image $name ($lvmpath)\n"; nit: not sure if the prints inside these if-blocks are necessary. Because there's already the $discard_action being printed above and then you'd have output like zero-out data and discard (TRIM) image vm-100-disk-0 (/dev/.../del-vm-1= 00-disk-0) zero-out data on image vm-100-disk-0 (/dev/.../del-vm-100-disk-0) discard image vm-100-disk-0 (/dev/.../del-vm-100-disk-0) > + $secure_delete_cmd->($lvmpath); > + } > + if ($on_remove_opts->{'discard'}) { nit: can also just be $on_remove_opts->{discard} > + print "discard image $name ($lvmpath)\n"; > + eval { run_command(['/sbin/blkdiscard', $lvmpath]); }; If blkdiscard fails for some reason, I think it'd make sense to explicitly inform the user in the warning message that the disk space was not reclaimed. Otherwise they'd "just" get a reason why it failed, while the consequences of this might not be clear. > + warn $@ if $@; > + } > =20 > $class->cluster_lock_storage( > $storeid, > @@ -383,13 +409,13 @@ my sub free_lvm_volumes_locked { > } [snip]