]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/LVMPlugin.pm
LVM: Add '--refresh' when activating volumes
[pve-storage.git] / PVE / Storage / LVMPlugin.pm
index 3be680b4d605a2f6364406be8b34f4e830639ef9..72d74646349a3b1808fd4966e609081fd191bdd8 100644 (file)
@@ -362,6 +362,8 @@ sub free_image {
 
     my $cmd = ['/sbin/lvchange', '-aly', "$vg/$volname"];
     run_command($cmd, errmsg => "can't activate LV '$vg/$volname' to zero-out its data");
+    $cmd = ['/sbin/lvchange', '--refresh', "$vg/$volname"];
+    run_command($cmd, errmsg => "can't refresh LV '$vg/$volname' to zero-out its data");
 
     if ($scfg->{saferemove}) {
        # avoid long running task, so we only rename here
@@ -472,6 +474,8 @@ sub activate_volume {
 
     my $cmd = ['/sbin/lvchange', "-a$lvm_activate_mode", $path];
     run_command($cmd, errmsg => "can't activate LV '$path'");
+    $cmd = ['/sbin/lvchange', '--refresh', $path];
+    run_command($cmd, errmsg => "can't refresh LV '$path' for activation");
 }
 
 sub deactivate_volume {