From d642361b29ab3ed95bef54116059625f4f248b5f Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 9 Mar 2012 09:38:06 +0100 Subject: [PATCH] new lvm option 'saferemove' to zero-out data when removing LVs --- Makefile | 2 +- PVE/Storage.pm | 18 ++++++++++++------ changelog.Debian | 6 ++++++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index c6db209..e955ddf 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ RELEASE=2.0 VERSION=2.0 PACKAGE=libpve-storage-perl -PKGREL=12 +PKGREL=13 DESTDIR= PREFIX=/usr diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 29e827b..6209f82 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -138,6 +138,7 @@ my $confvars = { path => 'path', shared => 'bool', disable => 'bool', + saferemove => 'bool', format => 'format', content => 'content', server => 'server', @@ -192,6 +193,7 @@ my $default_config = { nodes => 0, shared => 0, disable => 0, + saferemove => 0, content => [ {images => 1}, { images => 1 }], base => 1, }, @@ -1341,12 +1343,16 @@ sub vdisk_free { } } elsif ($scfg->{type} eq 'lvm') { - $vg = $scfg->{vgname}; - - # avoid long running task, so we only rename here - my $cmd = ['/sbin/lvrename', $vg, $volname, "del-$volname"]; - run_command($cmd, errmsg => "lvrename '$vg/$volname' error"); - + if ($scfg->{saferemove}) { + # avoid long running task, so we only rename here + $vg = $scfg->{vgname}; + my $cmd = ['/sbin/lvrename', $vg, $volname, "del-$volname"]; + run_command($cmd, errmsg => "lvrename '$vg/$volname' error"); + } else { + my $tmpvg = $scfg->{vgname}; + my $cmd = ['/sbin/lvremove', '-f', "$tmpvg/$volname"]; + run_command($cmd, errmsg => "lvremove '$tmpvg/$volname' error"); + } } elsif ($scfg->{type} eq 'iscsi') { die "can't free space in iscsi storage\n"; diff --git a/changelog.Debian b/changelog.Debian index 75b713a..0bfa375 100644 --- a/changelog.Debian +++ b/changelog.Debian @@ -1,3 +1,9 @@ +libpve-storage-perl (2.0-13) unstable; urgency=low + + * new lvm option 'saferemove' to zero-out data when removing LVs + + -- Proxmox Support Team Fri, 09 Mar 2012 09:37:02 +0100 + libpve-storage-perl (2.0-12) unstable; urgency=low * fix permission checks (delete volume requires Datastore.Allocate)