Activating an LV creates a device-mapper device. In a cluster with a shared LVM VG (e.g. on top of iSCSI) where an LV is active on nodes 1 and 2, deleting the LV on node 1 will not clean up the device-mapper device on node 2. If an LV with the same name is recreated later, the leftover device-mapper device will cause activation of that LV on node 2 to fail with:
> device-mapper: create ioctl on [...] failed: Device or resource busy By default, LVM autoactivates all discovered LVs after boot, thus creating device-mapper device for all discovered LVs. As a result, certain combinations of guest removal (and thus LV removals) and node reboots can cause guest creation or VM live migration (which both entail LV activation) to fail with the above error message, see [1]. To avoid this issue in the future, adjust the LVM plugin to create new LVs with the "activation skip" flag. LVs with that flag are not activated unless `-K` is passed to the activation command. Consequently, new LVs will not be autoactivated after boot anymore, and removing LVs will not leave behind device-mapper devices on other nodes anymore. The LVM plugin is still able to activate LVs, as it already passes `-K` to all activation commands. Note that the flag is only set for newly created LVs, so LVs created before this patch can still trigger #4997. To avoid this, users can manually set the "activation skip" flag on existing LVs. [1] https://bugzilla.proxmox.com/show_bug.cgi?id=4997 Suggested-by: Fabian Grünbichler <f.gruenbich...@proxmox.com> Signed-off-by: Friedrich Weber <f.we...@proxmox.com> --- Notes: Should only be applied close to the next major release, see cover letter. src/PVE/Storage/LVMPlugin.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm index 66b42de..191e8d3 100644 --- a/src/PVE/Storage/LVMPlugin.pm +++ b/src/PVE/Storage/LVMPlugin.pm @@ -342,7 +342,7 @@ sub lvcreate { $size .= "k"; # default to kilobytes } - my $cmd = ['/sbin/lvcreate', '-aly', '-K', '-Wy', '--yes', '--size', $size, '--name', $name]; + my $cmd = ['/sbin/lvcreate', '-aly', '-K', '-ky', '-Wy', '--yes', '--size', $size, '--name', $name]; for my $tag (@$tags) { push @$cmd, '--addtag', $tag; } -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel